diff --git a/main/gbx/gbx_api.c b/main/gbx/gbx_api.c index f4cbc64e0..4ebeda851 100644 --- a/main/gbx/gbx_api.c +++ b/main/gbx/gbx_api.c @@ -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) { diff --git a/main/gbx/gbx_api.h b/main/gbx/gbx_api.h index 3e11e6777..3b2ff0812 100644 --- a/main/gbx/gbx_api.h +++ b/main/gbx/gbx_api.h @@ -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); diff --git a/main/gbx/gbx_c_string.c b/main/gbx/gbx_c_string.c index 728c8c93c..00a7276b8 100644 --- a/main/gbx/gbx_c_string.c +++ b/main/gbx/gbx_c_string.c @@ -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; } diff --git a/main/gbx/gbx_date.c b/main/gbx/gbx_date.c index f823c24d3..37348dceb 100644 --- a/main/gbx/gbx_date.c +++ b/main/gbx/gbx_date.c @@ -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; diff --git a/main/gbx/gbx_eval.c b/main/gbx/gbx_eval.c index c365f929c..a6738c9b4 100644 --- a/main/gbx/gbx_eval.c +++ b/main/gbx/gbx_eval.c @@ -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; diff --git a/main/gbx/gbx_subr_time.c b/main/gbx/gbx_subr_time.c index dc603d0e0..b9afb602d 100644 --- a/main/gbx/gbx_subr_time.c +++ b/main/gbx/gbx_subr_time.c @@ -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);