logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

[patch] fix for return value bug in dbus_message_iter_init: msg#00178

Subject: [patch] fix for return value bug in dbus_message_iter_init
Hi,

There's a bug in the new type stuff where if you call
dbus_message_iter_init() on a message with only one argument, it'll
return FALSE, meaning that there are no arguments.  I think this is
because the code is moving the reader past the first argument and then
calling _dbus_type_reader_get_current_type(), but I don't have a great
grasp on this new type code...

There's also a minor string change to improve the error message when a
method doesn't exist.  Havoc, can you take a look at it and see if it's
sane?

Thanks,
Joe
Index: dbus/dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.89
diff -u -p -u -r1.89 dbus-connection.c
--- dbus/dbus-connection.c      17 Jan 2005 00:16:28 -0000      1.89
+++ dbus/dbus-connection.c      24 Jan 2005 18:29:06 -0000
@@ -2740,8 +2740,9 @@ dbus_connection_dispatch (DBusConnection
         }
               
       if (!_dbus_string_append_printf (&str,
-                                       "Method \"%s\" on interface \"%s\" 
doesn't exist\n",
+                                       "Method \"%s\" with signature \"%s\" on 
interface \"%s\" doesn't exist\n",
                                        dbus_message_get_member (message),
+                                       dbus_message_get_signature (message),
                                        dbus_message_get_interface (message)))
         {
           _dbus_string_free (&str);
Index: dbus/dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.155
diff -u -p -u -r1.155 dbus-message.c
--- dbus/dbus-message.c 24 Jan 2005 05:56:25 -0000      1.155
+++ dbus/dbus-message.c 24 Jan 2005 18:29:06 -0000
@@ -1381,7 +1381,7 @@ dbus_message_iter_init (DBusMessage     
                           &message->body,
                           0);
 
-  return _dbus_type_reader_has_next (&real->u.reader);
+  return _dbus_type_reader_get_current_type (&real->u.reader) != 
DBUS_TYPE_INVALID;
 }
 
 #ifndef DBUS_DISABLE_CHECKS

<Prev in Thread] Current Thread [Next in Thread>