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 724319 - json_gvariant_deserialize() doesn't decode doubles that json_gvariant_serialize() has encoded
json_gvariant_deserialize() doesn't decode doubles that json_gvariant_seriali...
Status: RESOLVED FIXED
Product: json-glib
Classification: Core
Component: GObject
git master
Other Linux
: Normal normal
: ---
Assigned To: json-glib-maint
json-glib-maint
Depends on:
Blocks:
 
 
Reported: 2014-02-13 21:11 UTC by Stef Walter
Modified: 2015-01-26 06:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case demonstrating the problem (1.01 KB, text/plain)
2014-02-13 21:14 UTC, Stef Walter
  Details
json-gvariant: Parse json doubles that are whole numbers (2.23 KB, patch)
2014-02-13 21:22 UTC, Stef Walter
committed Details | Review

Description Stef Walter 2014-02-13 21:11:40 UTC
json_gvariant_deserialize() doesn't decode doubles that json_gvariant_serialize() has encoded. This is because whole number doubles are encoded without a dot, and thus decode as integers in the JsonNode, rather than doubles.

We need to account for this in json_to_gvariant_recurse().
Comment 1 Stef Walter 2014-02-13 21:14:48 UTC
Created attachment 269071 [details]
Test case demonstrating the problem

Build this test case with the command in the first comment.
Comment 2 Stef Walter 2014-02-13 21:22:26 UTC
Created attachment 269072 [details] [review]
json-gvariant: Parse json doubles that are whole numbers

The json gvariant serializer encodes whole number doubles without
a dot. The deserializer needs to be able to parse these as well.

Fix problem, and add test cases.
Comment 3 Emmanuele Bassi (:ebassi) 2015-01-25 15:52:52 UTC
Review of attachment 269072 [details] [review]:

LGTM
Comment 4 Stef Walter 2015-01-26 06:42:10 UTC
Attachment 269072 [details] pushed as 80e44db - json-gvariant: Parse json doubles that are whole numbers