]> granicus.if.org Git - json-c/commitdiff
Simple fix to double encode
authorRemi Collet <fedora@famillecollet.com>
Thu, 13 Dec 2012 10:16:03 +0000 (11:16 +0100)
committerRemi Collet <fedora@famillecollet.com>
Thu, 13 Dec 2012 10:16:03 +0000 (11:16 +0100)
json_object.c

index 5b60a06f4394166ea4850fde7aff28926118e918..eeba91b5bc153721310b7517a51f94aaadc3ddea 100644 (file)
@@ -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)