From 0ff552a2c5c542a1be9a1c73597c298e6ece358f Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 31 Jan 2003 23:28:09 +0000 Subject: [PATCH] 2003-01-31 Havoc Pennington * dbus/dbus-message.c (dbus_message_set_is_error_reply): rename just set_is_error/get_is_error as this is a commonly-used function, and write docs. --- ChangeLog | 6 ++++++ dbus/dbus-message.c | 29 +++++++++++++++++++++-------- dbus/dbus-message.h | 4 ++-- dbus/dbus-protocol.h | 2 +- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa4cada..8fd570e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-01-31 Havoc Pennington + + * dbus/dbus-message.c (dbus_message_set_is_error_reply): rename + just set_is_error/get_is_error as this is a commonly-used + function, and write docs. + 2003-01-31 Anders Carlsson * dbus/dbus-address.c: (dbus_address_entry_free): diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index be76caa..7875d90 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -1635,9 +1635,16 @@ dbus_message_set_sender (DBusMessage *message, } } +/** + * Sets a flag indicating that the message is an error reply + * message, i.e. an "exception" rather than a normal response. + * + * @param message the message + * @param is_error_reply #TRUE if this is an error message. + */ void -dbus_message_set_is_error_reply (DBusMessage *message, - dbus_bool_t is_error_reply) +dbus_message_set_is_error (DBusMessage *message, + dbus_bool_t is_error_reply) { char *header; @@ -1646,20 +1653,26 @@ dbus_message_set_is_error_reply (DBusMessage *message, _dbus_string_get_data_len (&message->header, &header, 1, 1); if (is_error_reply) - *header |= DBUS_HEADER_FLAG_IS_ERROR_REPLY; + *header |= DBUS_HEADER_FLAG_ERROR; else - *header &= ~DBUS_HEADER_FLAG_IS_ERROR_REPLY; - + *header &= ~DBUS_HEADER_FLAG_ERROR; } +/** + * Returns #TRUE if the message is an error + * reply to some previous message we sent. + * + * @param message the message + * @returns #TRUE if the message is an error + */ dbus_bool_t -dbus_message_get_is_error_reply (DBusMessage *message) +dbus_message_get_is_error (DBusMessage *message) { const char *header; - _dbus_string_get_data_len (&message->header, &header, 1, 1); + _dbus_string_get_const_data_len (&message->header, &header, 1, 1); - return (*header & DBUS_HEADER_FLAG_IS_ERROR_REPLY) != 0; + return (*header & DBUS_HEADER_FLAG_ERROR) != 0; } /** diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h index 0d6b533..3bec866 100644 --- a/dbus/dbus-message.h +++ b/dbus/dbus-message.h @@ -50,9 +50,9 @@ 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, +void dbus_message_set_is_error (DBusMessage *message, dbus_bool_t is_error_reply); -dbus_bool_t dbus_message_get_is_error_reply (DBusMessage *message); +dbus_bool_t dbus_message_get_is_error (DBusMessage *message); dbus_bool_t dbus_message_append_fields (DBusMessage *message, diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h index a345026..5ff6d58 100644 --- a/dbus/dbus-protocol.h +++ b/dbus/dbus-protocol.h @@ -53,7 +53,7 @@ extern "C" { #define DBUS_TYPE_STRING_ARRAY 10 /* Header flags */ -#define DBUS_HEADER_FLAG_IS_ERROR_REPLY 0x1 +#define DBUS_HEADER_FLAG_ERROR 0x1 /* Header fields */ #define DBUS_HEADER_FIELD_NAME "name" -- 2.7.4