float parsing must be locale independent

This commit is contained in:
Remi Collet
2012-11-27 11:06:49 +01:00
parent f6b27cbb6c
commit 16a4a32e29
4 changed files with 29 additions and 3 deletions

View File

@@ -585,7 +585,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
double numd;
if (!tok->is_double && json_parse_int64(tok->pb->buf, &num64) == 0) {
current = json_object_new_int64(num64);
} else if(tok->is_double && sscanf(tok->pb->buf, "%lf", &numd) == 1) {
} else if(tok->is_double && json_parse_double(tok->pb->buf, &numd) == 0) {
current = json_object_new_double(numd);
} else {
tok->err = json_tokener_error_parse_number;