]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Fix parsing doubles for mingw
authortopilski <atopilski@gmail.com>
Sun, 30 Jul 2017 04:30:05 +0000 (07:30 +0300)
committertopilski <atopilski@gmail.com>
Sun, 30 Jul 2017 04:30:05 +0000 (07:30 +0300)
json_util.c

index 3a717b7994e70aa5a2c8678ff97ec2a32cd7aae5..cc57e34f7338c47e7e754e5ca4eb9c310d407806 100644 (file)
@@ -195,7 +195,9 @@ int json_object_to_file(const char *filename, struct json_object *obj)
 
 int json_parse_double(const char *buf, double *retval)
 {
-  return (sscanf(buf, "%lf", retval)==1 ? 0 : 1);
+  char *end;
+  *retval = strtod(buf, &end);
+  return end == buf ? 1 : 0;
 }
 
 /*