From 8f8ce87730fc0bf102a707e84c4f6106b215cfab Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 28 Oct 2009 16:23:39 +0000 Subject: gobject: Use from/to data naming convention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Be more GLib-like, and use __from_data() __to_data() Instead of the homebrew "construct" and "serialize", when dealing with string buffers. This means: • adding json_gobject_from_data() to deprecate json_construct_gobject() • adding json_gobject_to_data() to deprecate json_serialize_gobject() The json_construct_gobject() function also contains a mistake: it uses gsize with the special value of -1 meaning "slurp the whole string", but gsize is an unsigned type. The newly added json_gobject_from_data() correctly uses gssize instead. --- json-glib/json-gobject.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'json-glib/json-gobject.h') diff --git a/json-glib/json-gobject.h b/json-glib/json-gobject.h index d294702..8b6568d 100644 --- a/json-glib/json-gobject.h +++ b/json-glib/json-gobject.h @@ -121,12 +121,22 @@ JsonNode *json_gobject_serialize (GObject *gobject) GObject * json_gobject_deserialize (GType gtype, JsonNode *node); +GObject * json_gobject_from_data (GType gtype, + const gchar *data, + gssize length, + GError **error); +gchar * json_gobject_to_data (GObject *gobject, + gsize *length); + +#ifndef JSON_DISABLE_DEPRECATED GObject * json_construct_gobject (GType gtype, const gchar *data, gsize length, GError **error); gchar * json_serialize_gobject (GObject *gobject, gsize *length) G_GNUC_MALLOC; +#endif + G_END_DECLS -- cgit v1.2.1