From c7816d45e82ba8dd7e1e969c2cb6c3a27577cf68 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 28 Jan 2005 05:30:53 +0000 Subject: 2005-01-28 Havoc Pennington * doc/dbus-specification.xml: update to describe 16-bit types and dict entries * dbus/dbus-marshal-basic.c (_dbus_unpack_uint16): fix broken assertion * dbus/dbus-protocol.h (DBUS_TYPE_DICT_ENTRY): add DICT_ENTRY as a type * dbus/dbus-marshal-recursive.c: implement --- dbus/dbus-message.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'dbus/dbus-message.c') diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 38ae317a..85252005 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -2112,10 +2112,10 @@ dbus_message_iter_append_fixed_array (DBusMessageIter *iter, * dbus_message_iter_close_container(). Container types are for * example struct, variant, and array. For variants, the * contained_signature should be the type of the single value inside - * the variant. For structs, contained_signature should be #NULL; it - * will be set to whatever types you write into the struct. For - * arrays, contained_signature should be the type of the array - * elements. + * the variant. For structs and dict entries, contained_signature + * should be #NULL; it will be set to whatever types you write into + * the struct. For arrays, contained_signature should be the type of + * the array elements. * * @todo If this fails due to lack of memory, the message is hosed and * you have to start over building the whole message. @@ -2142,7 +2142,21 @@ dbus_message_iter_open_container (DBusMessageIter *iter, _dbus_return_val_if_fail (sub != NULL, FALSE); _dbus_return_val_if_fail ((type == DBUS_TYPE_STRUCT && contained_signature == NULL) || + (type == DBUS_TYPE_DICT_ENTRY && + contained_signature == NULL) || contained_signature != NULL, FALSE); + _dbus_return_val_if_fail (type != DBUS_TYPE_DICT_ENTRY || + dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_ARRAY, + FALSE); + +#if 0 + /* FIXME this would fail if the contained_signature is a dict entry, + * since dict entries are invalid signatures standalone (they must be in + * an array) + */ + _dbus_return_val_if_fail (contained_signature == NULL || + _dbus_check_is_valid_signature (contained_signature)); +#endif if (!_dbus_message_iter_open_signature (real)) return FALSE; -- cgit