From cefb84edc5f84011c5a171e5d052e37c56c55d27 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 7 Aug 2003 02:18:54 +0000 Subject: 2003-08-06 Havoc Pennington * dbus/dbus-object-registry.c: implement signal connection and dispatch * dbus/dbus-connection.c (_dbus_connection_unref_unlocked): new * dbus/dbus-internals.c (_dbus_memdup): new function --- dbus/dbus-internals.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'dbus/dbus-internals.c') diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 6e7f9e16..ccc11776 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -248,7 +248,7 @@ _dbus_verbose_reset_real (void) char* _dbus_strdup (const char *str) { - int len; + size_t len; char *copy; if (str == NULL) @@ -265,6 +265,31 @@ _dbus_strdup (const char *str) return copy; } +#ifdef DBUS_BUILD_TESTS /* memdup not used at the moment */ +/** + * Duplicates a block of memory. Returns + * #NULL on failure. + * + * @param mem memory to copy + * @param n_bytes number of bytes to copy + * @returns the copy + */ +void* +_dbus_memdup (const void *mem, + size_t n_bytes) +{ + void *copy; + + copy = dbus_malloc (n_bytes); + if (copy == NULL) + return NULL; + + memcpy (copy, mem, n_bytes); + + return copy; +} +#endif + /** * Duplicates a string array. Result may be freed with * dbus_free_string_array(). Returns #NULL if memory allocation fails. -- cgit From fdb114e5cce2790fd3c68cfa13113c7b59b83e4e Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 31 Aug 2003 17:26:22 +0000 Subject: 2003-08-31 Havoc Pennington * fix build with --disable-tests --- dbus/dbus-internals.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'dbus/dbus-internals.c') diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index ccc11776..47a2b404 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -265,7 +265,6 @@ _dbus_strdup (const char *str) return copy; } -#ifdef DBUS_BUILD_TESTS /* memdup not used at the moment */ /** * Duplicates a block of memory. Returns * #NULL on failure. @@ -288,7 +287,6 @@ _dbus_memdup (const void *mem, return copy; } -#endif /** * Duplicates a string array. Result may be freed with -- cgit From 85ab0327d82e4945ad16630e583d8cc68df25a90 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 7 Sep 2003 23:04:54 +0000 Subject: 2003-09-07 Havoc Pennington * Make Doxygen contented. --- dbus/dbus-internals.c | 1 + 1 file changed, 1 insertion(+) (limited to 'dbus/dbus-internals.c') diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 47a2b404..463e62e1 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -390,6 +390,7 @@ _dbus_type_to_string (int type) } #ifndef DBUS_DISABLE_CHECKS +/** String used in _dbus_return_if_fail macro */ const char _dbus_return_if_fail_warning_format[] = "Arguments to %s were incorrect, assertion \"%s\" failed in file %s line %d.\n" "This is normally a bug in some application using the D-BUS library.\n"; -- cgit From daf8d6579e1ae0ea748810b63180bd5eea2ab9c4 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Sun, 21 Sep 2003 18:43:20 +0000 Subject: 2003-09-21 Mark McLoughlin * doc/dbus-specification.sgml: Change the header field name to be an enum and update the rest of the spec to reference the fields using the conventinal name. * dbus/dbus-protocol.h: update to reflect the spec. * doc/TODO: add item to remove the 4 byte alignment requirement. * dbus/dbus-message.c: Remove the code to generalise the header/body length and serial number header fields as named header fields so we can reference field names using the protocol values. (append_int_field), (append_uint_field), (append_string_field): Append the field name as a byte rather than four chars. (delete_int_or_uint_field), (delete_string_field): reflect the fact that the field name and typecode now occupy 4 bytes instead of 8. (decode_string_field), (decode_header_data): update to reflect protocol changes and move the field specific encoding from decode_string_field() back into decode_header_data(). * dbus/dbus-internals.[ch]: (_dbus_header_field_to_string): Add utility to aid debugging. * dbus/dbus-message-builder.c: (append_string_field), (_dbus_message_data_load): Update to reflect protocol changes; Change the FIELD_NAME directive to HEADER_FIELD and allow it to take the field's conventional name rather than the actual value. * test/data/*/*.message: Update to use HEADER_FIELD instead of FIELD_NAME; Always align the header on an 8 byte boundary *before* updating the header length. --- dbus/dbus-internals.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'dbus/dbus-internals.c') diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 463e62e1..cf1cc391 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -389,6 +389,38 @@ _dbus_type_to_string (int type) } } +/** + * Returns a string describing the given name. + * + * @param header_field the field to describe + * @returns a constant string describing the field + */ +const char * +_dbus_header_field_to_string (int header_field) +{ + switch (header_field) + { + case DBUS_HEADER_FIELD_INVALID: + return "invalid"; + case DBUS_HEADER_FIELD_PATH: + return "path"; + case DBUS_HEADER_FIELD_INTERFACE: + return "interface"; + case DBUS_HEADER_FIELD_MEMBER: + return "member"; + case DBUS_HEADER_FIELD_ERROR_NAME: + return "error-name"; + case DBUS_HEADER_FIELD_REPLY_SERIAL: + return "reply-serial"; + case DBUS_HEADER_FIELD_SERVICE: + return "service"; + case DBUS_HEADER_FIELD_SENDER_SERVICE: + return "sender-service"; + default: + return "unknown"; + } +} + #ifndef DBUS_DISABLE_CHECKS /** String used in _dbus_return_if_fail macro */ const char _dbus_return_if_fail_warning_format[] = -- cgit