After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753763 - [PATCH] Don't loose decimal in whole-double -> string conversion
[PATCH] Don't loose decimal in whole-double -> string conversion
Status: RESOLVED FIXED
Product: json-glib
Classification: Core
Component: Generator
git master
Other Linux
: Normal normal
: ---
Assigned To: json-glib-maint
json-glib-maint
Depends on:
Blocks:
 
 
Reported: 2015-08-18 13:36 UTC by Dirk-Jan C. Binnema
Modified: 2017-03-13 11:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to avoid whole-double losing their decimal (3.41 KB, patch)
2015-08-18 13:36 UTC, Dirk-Jan C. Binnema
committed Details | Review

Description Dirk-Jan C. Binnema 2015-08-18 13:36:15 UTC
Created attachment 309471 [details] [review]
Patch to avoid whole-double losing their decimal

When converting json to its string representation, whole-doubles (such
 as 1.0) would be converted into strings without decimals ("1"). That can
 be inconvenient e.g. when converting from/to GVariants.
Comment 1 Emmanuele Bassi (:ebassi) 2015-08-18 13:49:23 UTC
Review of attachment 309471 [details] [review]:

::: json-glib/tests/gvariant.c
@@ +159,3 @@
     { "/string-to-uint64", "(t)", "(uint64 1999999999999999,)", "[\"1999999999999999\"]" },
     { "/string-to-double", "(d)", "(1.23,)", "[\"1.23\"]" },
+    { "/string-to-double-whole", "(d)", "(123.0,)", "[\"123.0\"]" },

This seems to undo the changes we were testing with bug 724319.
Comment 2 Dirk-Jan C. Binnema 2015-08-18 18:53:00 UTC
Yes -- in fact the it seems this change avoids the problem in bug 724319 altogether; and the test-program attached to that bug still works.
Comment 3 Emmanuele Bassi (:ebassi) 2015-08-18 19:30:55 UTC
Review of attachment 309471 [details] [review]:

Okay, let's go with it.
Comment 4 Emmanuele Bassi (:ebassi) 2017-03-13 11:36:27 UTC
Attachment 309471 [details] pushed to master