From: Remi Collet Date: Thu, 13 Dec 2012 10:16:03 +0000 (+0100) Subject: Simple fix to double encode X-Git-Tag: json-c-0.11-20130402~14^2~2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=4014fe86d96d850271a1bd724ccf5a83d27dceb8;p=thirdparty%2Fjson-c.git Simple fix to double encode --- diff --git a/json_object.c b/json_object.c index 5b60a06f..eeba91b5 100644 --- a/json_object.c +++ b/json_object.c @@ -552,7 +552,16 @@ static int json_object_double_to_json_string(struct json_object* jso, int level, int flags) { - return sprintbuf(pb, "%f", jso->o.c_double); + char buf[128], *p; + int size; + + size = snprintf(buf, 128, "%f", jso->o.c_double); + p = strchr(buf, ','); + if (p) { + *p = '.'; + } + printbuf_memappend(pb, buf, size); + return size; } struct json_object* json_object_new_double(double d)