From 3cf919e9c7f3201305a1a63a3c270e422a37efed Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 23 Nov 2009 22:20:58 +0000 Subject: boxed: Split (de)serialization registration A GBoxed type defined as: struct Boxed { int foo; gboolean bar; int baz; }; Can be represented either by a JSON object: { "foo" : 1, "bar" : true, "baz" : 3 } Or by a JSON array: [ 1, true, 3 ] The current function for registering a serialization and a deserialization pair does not allow registering more than one deserialization function - which means that there can only be one way to deserialize a GBoxed type into a specific JsonNode type. To allow having more than one JsonNodeType associated to a GBoxed type and a deserialization function we need to split out the registration of the serialization and deserialization functions into two distinct functions. --- json-glib/json-gobject.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'json-glib/json-gobject.c') diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c index 574ff38..0a98aa8 100644 --- a/json-glib/json-gobject.c +++ b/json-glib/json-gobject.c @@ -627,9 +627,7 @@ json_serialize_pspec (const GValue *real_value, { gpointer boxed = g_value_get_boxed (real_value); - retval = json_boxed_serialize (G_VALUE_TYPE (real_value), - node_type, - boxed); + retval = json_boxed_serialize (G_VALUE_TYPE (real_value), boxed); } else g_warning ("Boxed type '%s' is not handled by JSON-GLib", -- cgit v1.2.1