summaryrefslogtreecommitdiff
path: root/json-glib/json-gobject.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan@upstairslabs.com>2014-03-09 17:59:02 +0900
committerEmmanuele Bassi <ebassi@gnome.org>2014-12-30 11:25:08 +0000
commit23e69e79484d41c722ab8bcab78fe850b960316e (patch)
treecfc53d460e0970f718bb168511751af61d0a1d92 /json-glib/json-gobject.c
parentc183513e82e20e7f77821e6a667bf12dfa0b8b20 (diff)
downloadjson-glib-23e69e79484d41c722ab8bcab78fe850b960316e.tar.gz
Handle serialization/deserialization of glong gulong and guint64
Long and unsigned long was properly serialized but not deserialized, guint64 handling is not ideal as the type is cast into a gint64, however this is better than not handling the fundamental type at all. https://bugzilla.gnome.org/show_bug.cgi?id=725972
Diffstat (limited to 'json-glib/json-gobject.c')
-rw-r--r--json-glib/json-gobject.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c
index 3beb0e6..d39088e 100644
--- a/json-glib/json-gobject.c
+++ b/json-glib/json-gobject.c
@@ -553,6 +553,30 @@ json_deserialize_pspec (GValue *value,
}
break;
+ case G_TYPE_LONG:
+ if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
+ {
+ g_value_set_long (value, (glong) g_value_get_int64 (&node_value));
+ retval = TRUE;
+ }
+ break;
+
+ case G_TYPE_ULONG:
+ if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
+ {
+ g_value_set_ulong (value, (gulong) g_value_get_int64 (&node_value));
+ retval = TRUE;
+ }
+ break;
+
+ case G_TYPE_UINT64:
+ if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
+ {
+ g_value_set_uint64 (value, (guint64) g_value_get_int64 (&node_value));
+ retval = TRUE;
+ }
+ break;
+
case G_TYPE_DOUBLE:
if (G_VALUE_HOLDS (&node_value, G_TYPE_DOUBLE))
@@ -695,6 +719,10 @@ json_serialize_pspec (const GValue *real_value,
retval = json_node_init_int (json_node_alloc (), g_value_get_ulong (real_value));
break;
+ case G_TYPE_UINT64:
+ retval = json_node_init_int (json_node_alloc (), g_value_get_uint64 (real_value));
+ break;
+
case G_TYPE_FLOAT:
retval = json_node_init_double (json_node_alloc (), g_value_get_float (real_value));
break;