Browse Source

Fix parsing integer/hex numbers, also use a macro to show then as string

mingodad 7 years ago
parent
commit
c3d1c38b71
2 changed files with 2 additions and 2 deletions
  1. 1 1
      SquiLu/squirrel/sqlexer.cpp
  2. 1 1
      SquiLu/squirrel/sqvm.cpp

+ 1 - 1
SquiLu/squirrel/sqlexer.cpp

@@ -800,7 +800,7 @@ static int isneg (const SQChar **s) {
 }
 
 #define ADD_CHECK_DIGIT(dig, base) \
-	    if (a >= MAXBY10 && (a > MAXBY10 || a > MAXLASTD + neg))  /* overflow? */ \
+	    if (a >= MAXBY10 && (a > MAXBY10 || d > MAXLASTD + neg))  /* overflow? */ \
             return false;  /* do not accept it (as integer) */ \
 		a = a*base+dig;
 

+ 1 - 1
SquiLu/squirrel/sqvm.cpp

@@ -360,7 +360,7 @@ bool SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
 		res = o;
 		return true;
 	case OT_FLOAT:
-        scsprintf(_sp(sq_rsl(NUMBER_MAX_CHAR+1)),sq_rsl(NUMBER_MAX_CHAR),_SC("%g"),_float(o));
+        scsprintf(_sp(sq_rsl(NUMBER_MAX_CHAR+1)),sq_rsl(NUMBER_MAX_CHAR),_PRINT_FLOAT_PREC,_float(o));
         break;
     case OT_INTEGER:
         scsprintf(_sp(sq_rsl(NUMBER_MAX_CHAR+1)),sq_rsl(NUMBER_MAX_CHAR),_PRINT_INT_FMT,_integer(o));