From 65884f4d9e619fc797e273a338e2391442cca9f6 Mon Sep 17 00:00:00 2001 From: topilski Date: Sun, 30 Jul 2017 07:30:05 +0300 Subject: [PATCH 1/2] Fix parsing doubles for mingw --- json_util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/json_util.c b/json_util.c index 3a717b7..cc57e34 100644 --- a/json_util.c +++ b/json_util.c @@ -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; } /* From 0a99e7a5c1b1ec576a516485bbd96b0a116c6825 Mon Sep 17 00:00:00 2001 From: topilski Date: Sun, 30 Jul 2017 07:37:17 +0300 Subject: [PATCH 2/2] Fix Mingw build --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24ddac5..bf6929f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ set(JSON_C_SOURCES ./linkhash.c ./printbuf.c ./random_seed.c + ./strerror_override.c ) add_library(json-c