diff options
-rw-r--r-- | ChangeLog | 26 | ||||
-rw-r--r-- | dbus/dbus-address.c | 6 | ||||
-rw-r--r-- | dbus/dbus-internals.c | 10 | ||||
-rw-r--r-- | dbus/dbus-marshal.c | 8 | ||||
-rw-r--r-- | dbus/dbus-message.c | 29 | ||||
-rw-r--r-- | dbus/dbus-message.h | 14 | ||||
-rw-r--r-- | dbus/dbus-protocol.h | 4 | ||||
-rw-r--r-- | test/data/valid-messages/opposite-endian.message | 2 |
8 files changed, 88 insertions, 11 deletions
@@ -1,3 +1,29 @@ +2003-01-31 Anders Carlsson <andersca@codefactory.se> + + * dbus/dbus-address.c: (dbus_address_entry_free): + Free key and value lists. + + * dbus/dbus-internals.c: (_dbus_type_to_string): + Add the types we didn't have. + + * dbus/dbus-marshal.c: (_dbus_marshal_get_arg_end_pos), + (_dbus_marshal_validate_arg): + Add NIL types. + + * dbus/dbus-message.c: (dbus_message_set_sender): + Remove todo about being able to set sender to NULL. + + (dbus_message_set_is_error_reply), + (dbus_message_get_is_error_reply): + * dbus/dbus-message.h: + New functions. + + * dbus/dbus-protocol.h: + Add error reply flag. + + * test/data/valid-messages/opposite-endian.message: + Add NIL type to test. + 2003-01-31 Havoc Pennington <hp@pobox.com> * doc/dbus-specification.sgml: fully specify the header. Add diff --git a/dbus/dbus-address.c b/dbus/dbus-address.c index 4c584bc0..fb8952b5 100644 --- a/dbus/dbus-address.c +++ b/dbus/dbus-address.c @@ -56,7 +56,8 @@ dbus_address_entry_free (DBusAddressEntry *entry) link = _dbus_list_get_next_link (&entry->keys, link); } - + _dbus_list_clear (&entry->keys); + link = _dbus_list_get_first_link (&entry->values); while (link != NULL) { @@ -65,6 +66,7 @@ dbus_address_entry_free (DBusAddressEntry *entry) link = _dbus_list_get_next_link (&entry->values, link); } + _dbus_list_clear (&entry->values); dbus_free (entry); } @@ -73,8 +75,6 @@ dbus_address_entry_free (DBusAddressEntry *entry) /** * Frees a #NULL-terminated array of address entries. * - * @todo dbus_address_entry_free() seems to leak list nodes - * * @param entries the array. */ void diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index eed91d14..78a1b687 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -366,6 +366,8 @@ _dbus_type_to_string (int type) { case DBUS_TYPE_INVALID: return "invalid"; + case DBUS_TYPE_NIL: + return "nil"; case DBUS_TYPE_INT32: return "int32"; case DBUS_TYPE_UINT32: @@ -374,8 +376,16 @@ _dbus_type_to_string (int type) return "double"; case DBUS_TYPE_STRING: return "string"; + case DBUS_TYPE_INT32_ARRAY: + return "int32 array"; + case DBUS_TYPE_UINT32_ARRAY: + return "uint32 array"; + case DBUS_TYPE_DOUBLE_ARRAY: + return "double array"; case DBUS_TYPE_BYTE_ARRAY: return "byte array"; + case DBUS_TYPE_STRING_ARRAY: + return "string array"; default: return "unknown"; } diff --git a/dbus/dbus-marshal.c b/dbus/dbus-marshal.c index efdc7efb..a31e0f49 100644 --- a/dbus/dbus-marshal.c +++ b/dbus/dbus-marshal.c @@ -875,6 +875,9 @@ _dbus_marshal_get_arg_end_pos (const DBusString *str, return FALSE; break; + case DBUS_TYPE_NIL: + *end_pos = pos + 1; + case DBUS_TYPE_INT32: *end_pos = _DBUS_ALIGN_VALUE (pos + 1, sizeof (dbus_int32_t)) + sizeof (dbus_int32_t); @@ -989,6 +992,7 @@ _dbus_marshal_get_arg_end_pos (const DBusString *str, * @param str the string * @param byte_order the byte order * @param pos the unaligned string position (snap to next aligned) + * @param new_pos return location for new position. */ static int demarshal_and_validate_len (const DBusString *str, @@ -1095,6 +1099,10 @@ _dbus_marshal_validate_arg (const DBusString *str, case DBUS_TYPE_INVALID: return FALSE; break; + + case DBUS_TYPE_NIL: + *end_pos = pos + 1; + break; case DBUS_TYPE_INT32: case DBUS_TYPE_UINT32: diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 3d0de77f..be76caa6 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -1612,8 +1612,6 @@ dbus_message_iter_get_string_array (DBusMessageIter *iter, /** * Sets the message sender. * - * @todo implement #NULL sender to unset - * * @param message the message * @param sender the sender * @returns #FALSE if not enough memory @@ -1637,6 +1635,33 @@ dbus_message_set_sender (DBusMessage *message, } } +void +dbus_message_set_is_error_reply (DBusMessage *message, + dbus_bool_t is_error_reply) +{ + char *header; + + _dbus_assert (!message->locked); + + _dbus_string_get_data_len (&message->header, &header, 1, 1); + + if (is_error_reply) + *header |= DBUS_HEADER_FLAG_IS_ERROR_REPLY; + else + *header &= ~DBUS_HEADER_FLAG_IS_ERROR_REPLY; + +} + +dbus_bool_t +dbus_message_get_is_error_reply (DBusMessage *message) +{ + const char *header; + + _dbus_string_get_data_len (&message->header, &header, 1, 1); + + return (*header & DBUS_HEADER_FLAG_IS_ERROR_REPLY) != 0; +} + /** * Gets the service which originated this message, * or #NULL if unknown or inapplicable. diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h index 77213f75..0d6b533e 100644 --- a/dbus/dbus-message.h +++ b/dbus/dbus-message.h @@ -45,11 +45,15 @@ DBusMessage *dbus_message_new_from_message (const DBusMessage *message); void dbus_message_ref (DBusMessage *message); void dbus_message_unref (DBusMessage *message); -const char* dbus_message_get_name (DBusMessage *message); -const char* dbus_message_get_service (DBusMessage *message); -dbus_bool_t dbus_message_set_sender (DBusMessage *message, - const char *sender); -const char* dbus_message_get_sender (DBusMessage *message); +const char* dbus_message_get_name (DBusMessage *message); +const char* dbus_message_get_service (DBusMessage *message); +dbus_bool_t dbus_message_set_sender (DBusMessage *message, + const char *sender); +const char* dbus_message_get_sender (DBusMessage *message); +void dbus_message_set_is_error_reply (DBusMessage *message, + dbus_bool_t is_error_reply); +dbus_bool_t dbus_message_get_is_error_reply (DBusMessage *message); + dbus_bool_t dbus_message_append_fields (DBusMessage *message, int first_field_type, diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h index 0df6c2e9..a3450267 100644 --- a/dbus/dbus-protocol.h +++ b/dbus/dbus-protocol.h @@ -52,7 +52,9 @@ extern "C" { #define DBUS_TYPE_BYTE_ARRAY 9 #define DBUS_TYPE_STRING_ARRAY 10 -# +/* Header flags */ +#define DBUS_HEADER_FLAG_IS_ERROR_REPLY 0x1 + /* Header fields */ #define DBUS_HEADER_FIELD_NAME "name" #define DBUS_HEADER_FIELD_SERVICE "srvc" diff --git a/test/data/valid-messages/opposite-endian.message b/test/data/valid-messages/opposite-endian.message index fb65d1d7..dba8918d 100644 --- a/test/data/valid-messages/opposite-endian.message +++ b/test/data/valid-messages/opposite-endian.message @@ -31,4 +31,6 @@ STRING 'Hello this is a string' TYPE DOUBLE DOUBLE 3.14159 +TYPE NIL + END_LENGTH Body |