dbus/dbus dbus-message.c,1.174,1.175 dbus-string.c,1.68,1.69

Robert McQueen robot101 at freedesktop.org
Wed Feb 15 16:43:43 PST 2006


Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv3873/dbus

Modified Files:
	dbus-message.c dbus-string.c 
Log Message:
2006-02-16  Robert McQueen  <robot101 at debian.org>

	* dbus/dbus-message.c (dbus_message_iter_get_fixed_array):
	Patch from Rob Taylor <rob.taylor at 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.

Index: dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- dbus-message.c	9 Aug 2005 17:38:15 -0000	1.174
+++ dbus-message.c	16 Feb 2006 00:43:41 -0000	1.175
@@ -1735,10 +1735,12 @@
                                    int              *n_elements)
 {
   DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
+  int subtype = _dbus_type_reader_get_current_type(&real->u.reader);
 
   _dbus_return_if_fail (_dbus_message_iter_check (real));
   _dbus_return_if_fail (value != NULL);
-  _dbus_return_if_fail (dbus_type_is_fixed (_dbus_type_reader_get_current_type (&real->u.reader)));
+  _dbus_return_if_fail ((subtype == DBUS_TYPE_INVALID) ||
+                         dbus_type_is_fixed (subtype));
 
   _dbus_type_reader_read_fixed_multi (&real->u.reader,
                                       value, n_elements);

Index: dbus-string.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-string.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- dbus-string.c	10 Apr 2005 03:36:46 -0000	1.68
+++ dbus-string.c	16 Feb 2006 00:43:41 -0000	1.69
@@ -232,7 +232,7 @@
   DBusRealString *real;
   
   _dbus_assert (str != NULL);
-  _dbus_assert (value != NULL);
+  _dbus_assert (len == 0 || value != NULL);
   _dbus_assert (len <= _DBUS_STRING_MAX_MAX_LENGTH);
   _dbus_assert (len >= 0);
   



More information about the dbus-commit mailing list