1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

fix in jsonparser: use float when int isn't big enough

This commit is contained in:
psyc://psyced.org/~lynX 2009-06-15 11:58:03 +02:00
parent 5a6e4d4ff2
commit 9d10b13569
2 changed files with 13 additions and 5 deletions

View file

@ -527,7 +527,9 @@ PROTECTED mixed nextObject() {
if ((b >= '0' && b <= '9') || b == '.' || b == '-' || b == '+') {
int a; float b_; string c_;
sscanf(s, "%d%s", a, c_);
if(c_ && sizeof(c_)) {
// some values of json ints exceed the limits of MAX_INT, in that case we need to use float -lynX
// maybe it is more efficient, if we used float in all cases then
if ((c_ && sizeof(c_)) || (a && s != to_string(a))) {
#ifdef __PIKE__
sscanf(s, "%f", b_);
#else