Skip to content
Snippets Groups Projects
Commit 7dcfa20f authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't convert/store small integers to doubles when reading/writing .ini files

Fix issue #760

UINT_TO_JSVAL automatically handles the storage as the necsesary underlying
type in the JS engine.

Values > 0x7fffffff (2147483647) will still be stored (and re-written) as
doubles and could be problematic.
parent 4df2ae8f
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
Pipeline #6433 passed
......@@ -756,7 +756,7 @@ static jsval get_value(JSContext *cx, char* value, bool blanks)
if(f)
val=DOUBLE_TO_JSVAL(atof(value));
else
val=DOUBLE_TO_JSVAL((double)strtoul(value,NULL,10));
val=UINT_TO_JSVAL(strtoul(value,NULL,10));
return(val);
}
/* hexadecimal number? */
......@@ -765,7 +765,7 @@ static jsval get_value(JSContext *cx, char* value, bool blanks)
if(!isxdigit((uchar)*p))
break;
if(*p==0) {
val=DOUBLE_TO_JSVAL((double)strtoul(value,NULL,0));
val=UINT_TO_JSVAL(strtoul(value,NULL,0));
return(val);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment