summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-message.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-02-26 06:42:57 +0000
committerHavoc Pennington <hp@redhat.com>2003-02-26 06:42:57 +0000
commit7265423411609c14ddb9e6643463b840afcaa09b (patch)
tree199b4d4bee1531333292518bf83425eb01ad2fd3 /dbus/dbus-message.c
parent3781f063a6dfbdeafea6d1c6c8ac10c8b22f8586 (diff)
2003-02-26 Havoc Pennington <hp@pobox.com>
* dbus/dbus-connection.c (dbus_connection_send_message_with_reply_and_block): fix crash where we ref'd the outgoing message instead of the returned reply * dbus/dbus-transport-unix.c (do_authentication): check read watch at the end of this function, so if we didn't need to read for authentication, we reinstall it for receiving messages * dbus/dbus-message.c (dbus_message_new_reply): allow replies to a NULL sender for peer-to-peer case * dbus/dbus-transport-unix.c (check_read_watch): handle !authenticated case correctly * glib/dbus-gmain.c: add support for DBusServer * dbus/dbus-server.c: add data slot support * glib/dbus-gmain.c (dbus_connection_setup_with_g_main): check return values and handle errors * dbus/dbus-dataslot.c: factor out the data slot stuff from DBusConnection * Doxyfile.in (INPUT): add glib subdir * glib/dbus-gmain.c (dbus_connection_setup_with_g_main): rename setup_with_g_main instead of hookup_with_g_main; write docs
Diffstat (limited to 'dbus/dbus-message.c')
-rw-r--r--dbus/dbus-message.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 584acc7e..355d6310 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -184,8 +184,12 @@ get_string_field (DBusMessage *message,
int field,
int *len)
{
- int offset = message->header_fields[field].offset;
+ int offset;
const char *data;
+
+ offset = message->header_fields[field].offset;
+
+ _dbus_assert (field < FIELD_LAST);
if (offset < 0)
return NULL;
@@ -209,13 +213,17 @@ get_string_field (DBusMessage *message,
static dbus_int32_t
get_int_field (DBusMessage *message,
- int field)
+ int field)
{
- int offset = message->header_fields[field].offset;
+ int offset;
+
+ _dbus_assert (field < FIELD_LAST);
+
+ offset = message->header_fields[field].offset;
if (offset < 0)
return -1; /* useless if -1 is a valid value of course */
-
+
return _dbus_demarshal_int32 (&message->header,
message->byte_order,
offset,
@@ -798,8 +806,8 @@ dbus_message_new_reply (DBusMessage *original_message)
FIELD_SENDER, NULL);
name = get_string_field (original_message,
FIELD_NAME, NULL);
-
- _dbus_assert (sender != NULL);
+
+ /* sender is allowed to be null here in peer-to-peer case */
message = dbus_message_new (sender, name);
@@ -1703,6 +1711,10 @@ dbus_message_get_args_valist (DBusMessage *message,
* ref/unref is kind of annoying to deal with, and slower too.
* This implies not ref'ing the message from the iter.
*
+ * @todo I'd also name this dbus_message_iter_new() or
+ * for the static object dbus_message_iter_init() rather
+ * than making it a method on the message
+ *
* @param message the message
* @returns a new iter.
*/