summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorRobert McQueen <robot101@debian.org>2006-02-16 00:43:41 +0000
committerRobert McQueen <robot101@debian.org>2006-02-16 00:43:41 +0000
commit2dc8ac4f88f8fa08575b11b5632db1fd2812b4b2 (patch)
treeaef4a4dbdafe9802062c4806e1b52d57aa133737 /glib
parent0c04d2c69a65a5006093c5b9a83fcfb369683710 (diff)
2006-02-16 Robert McQueen <robot101@debian.org>
* dbus/dbus-message.c (dbus_message_iter_get_fixed_array): Patch from Rob Taylor <rob.taylor@collabora.co.uk> to correct a bogus assertion that the next element to read from the iter is fixed in size. This is not the case when you are at the end of the iter, because the next element type is INVALID. * dbus/dbus-string.c (_dbus_string_init_const_len): Correct a a bogus assert which means that you may not initialise a 0-length string unless you provide a non-NULL pointer. This prevented you from marshalling messages containing zero-length arrays in some cases. * glib/dbus-gvalue.c (demarshal_collection_array): Another patch from Rob to correct bogus asserts when trying to demarshal an array and get_fixed_array got you 0 elements. Append nothing to the GArray in this case. * test/glib/test-dbus-glib.c: Add a test case for round-tripping an empty array via the glib bindings. Without all of the above patches, this new test fails.
Diffstat (limited to 'glib')
-rw-r--r--glib/dbus-gvalue.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/glib/dbus-gvalue.c b/glib/dbus-gvalue.c
index 3e8cf1e..e06a8fe 100644
--- a/glib/dbus-gvalue.c
+++ b/glib/dbus-gvalue.c
@@ -1081,9 +1081,10 @@ demarshal_collection_array (DBusGValueMarshalCtx *context,
dbus_message_iter_get_fixed_array (&subiter,
&msgarray,
&msgarray_len);
- g_assert (msgarray != NULL);
- g_assert (msgarray_len >= 0);
- g_array_append_vals (ret, msgarray, (guint) msgarray_len);
+ g_assert (msgarray != NULL || msgarray_len == 0);
+
+ if (msgarray_len)
+ g_array_append_vals (ret, msgarray, (guint) msgarray_len);
g_value_set_boxed_take_ownership (value, ret);