[INTERPRETER]
* BUG: Fix a useless and incorrect string initialization in the UTF-8 to UTF-16 internal conversion routine. * BUG: Native functions that return a string must not use the GB.ReturnNull() API, but GB.ReturnVoidString() instead. Fix the String.LCase() and String.UCase() functions accordingly. * BUG: Date() function takes one argument, or at least three arguments now. git-svn-id: svn://localhost/gambas/trunk@4213 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
4dbe9557a9
commit
348f1cefbd
6 changed files with 17 additions and 8 deletions
|
@ -1323,7 +1323,7 @@ void GB_ReturnNewString(const char *src, int len)
|
|||
}
|
||||
else
|
||||
{
|
||||
GB_ReturnNull();
|
||||
GB_ReturnVoidString();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1343,6 +1343,11 @@ void GB_ReturnNull(void)
|
|||
TEMP.type = T_NULL;
|
||||
}
|
||||
|
||||
void GB_ReturnVoidString(void)
|
||||
{
|
||||
STRING_void_value(&TEMP);
|
||||
}
|
||||
|
||||
|
||||
void *GB_GetClass(void *object)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,7 @@ void GB_ReturnSelf(void *object);
|
|||
void GB_ReturnVariant(GB_VARIANT_VALUE *value);
|
||||
|
||||
void GB_ReturnString(char *str);
|
||||
void GB_ReturnVoidString(void);
|
||||
void GB_ReturnConstString(const char *str, int len);
|
||||
void GB_ReturnConstZeroString(const char *str);
|
||||
void GB_ReturnNewString(const char *src, int len);
|
||||
|
|
|
@ -405,7 +405,7 @@ bool STRING_convert_to_unicode(wchar_t **pwstr, int *pwlen, const char *str, int
|
|||
int i, lc;
|
||||
wchar_t *wstr;
|
||||
|
||||
result = STRING_new_temp(str, wlen * sizeof(wchar_t) + 3);
|
||||
result = STRING_new_temp(NULL, wlen * sizeof(wchar_t) + 3);
|
||||
wstr = (wchar_t *)result;
|
||||
|
||||
for (i = 0; i < wlen; i++)
|
||||
|
@ -464,7 +464,7 @@ static void convert_string(char *str, int len, bool upper)
|
|||
|
||||
if (len <= 0)
|
||||
{
|
||||
GB_ReturnNull();
|
||||
GB_ReturnVoidString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -346,11 +346,10 @@ static bool read_integer(int *number)
|
|||
int nbr = 0;
|
||||
int nbr2;
|
||||
int c;
|
||||
//bool minus = FALSE;
|
||||
bool minus = FALSE;
|
||||
|
||||
c = get_char();
|
||||
|
||||
/*
|
||||
if (c == '-')
|
||||
{
|
||||
minus = TRUE;
|
||||
|
@ -358,7 +357,6 @@ static bool read_integer(int *number)
|
|||
}
|
||||
else if (c == '+')
|
||||
c = get_char();
|
||||
*/
|
||||
|
||||
if ((c < 0) || !isdigit(c))
|
||||
return TRUE;
|
||||
|
@ -376,6 +374,9 @@ static bool read_integer(int *number)
|
|||
|
||||
buffer_pos++;
|
||||
}
|
||||
|
||||
if (minus)
|
||||
nbr = (-nbr);
|
||||
|
||||
*number = nbr;
|
||||
return FALSE;
|
||||
|
|
|
@ -96,7 +96,7 @@ bool EVAL_expression(EXPRESSION *expr, EVAL_FUNCTION func)
|
|||
EVAL = expr;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("EVAL: %s\n", EVAL->source);
|
||||
fprintf(stderr, "EVAL: %s\n", EVAL->source);
|
||||
#endif
|
||||
|
||||
nvar = EVAL->nvar;
|
||||
|
|
|
@ -104,7 +104,7 @@ void SUBR_date(ushort code)
|
|||
date.sec = 0;
|
||||
date.msec = 0;
|
||||
}
|
||||
else
|
||||
else if (NPARAM >= 3)
|
||||
{
|
||||
VALUE_conv_integer(PARAM);
|
||||
VALUE_conv_integer(&PARAM[1]);
|
||||
|
@ -133,6 +133,8 @@ void SUBR_date(ushort code)
|
|||
date.sec = PARAM[5]._integer.value;
|
||||
}
|
||||
}
|
||||
else
|
||||
THROW(E_NEPARAM);
|
||||
|
||||
if (DATE_make(&date, RETURN))
|
||||
THROW(E_DATE);
|
||||
|
|
Loading…
Reference in a new issue