summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--dbus/dbus-message.c29
-rw-r--r--dbus/dbus-message.h4
-rw-r--r--dbus/dbus-protocol.h2
4 files changed, 30 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index fa4cada7..8fd570e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-01-31 Havoc Pennington <hp@pobox.com>
+
+ * 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 <andersca@codefactory.se>
* dbus/dbus-address.c: (dbus_address_entry_free):
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index be76caa6..7875d90e 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 0d6b533e..3bec8666 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 a3450267..5ff6d580 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"