dbus/qt qdbusmarshall.cpp,1.5,1.6

Thiago J. Macieira thiago at kemper.freedesktop.org
Sun May 7 02:36:21 PDT 2006


Update of /cvs/dbus/dbus/qt
In directory kemper:/tmp/cvs-serv24941/qt

Modified Files:
	qdbusmarshall.cpp 
Log Message:
        * qt/qdbusmarshall.cpp: Fix a problem of demarshalling lists
        and arrays when they had a single element: has_next returns
        false, even before you read the element. So, instead, check
        the array length.


Index: qdbusmarshall.cpp
===================================================================
RCS file: /cvs/dbus/dbus/qt/qdbusmarshall.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- qdbusmarshall.cpp	28 Mar 2006 18:56:08 -0000	1.5
+++ qdbusmarshall.cpp	7 May 2006 09:36:19 -0000	1.6
@@ -61,8 +61,7 @@
 
     DBusMessageIter it;
     dbus_message_iter_recurse(arrayIt, &it);
-
-    if (!dbus_message_iter_has_next(&it))
+    if (dbus_message_iter_get_array_len(&it) == 0)
         return QDBusTypeHelper<QList<QtType> >::toVariant(list);
 
     do {
@@ -78,8 +77,7 @@
 
     DBusMessageIter it;
     dbus_message_iter_recurse(arrayIt, &it);
-
-    if (!dbus_message_iter_has_next(&it))
+    if (dbus_message_iter_get_array_len(&it) == 0)
         return list;
 
     do {
@@ -157,7 +155,7 @@
             DBusMessageIter sub;
             
             dbus_message_iter_recurse(it, &sub);
-            if (!dbus_message_iter_has_next(&sub))
+            if (dbus_message_iter_get_array_len(&sub) == 0)
                 // empty map
                 return map;
             
@@ -179,7 +177,7 @@
         QList<QVariant> list;
         DBusMessageIter sub;
         dbus_message_iter_recurse(it, &sub);
-        if (!dbus_message_iter_has_next(&sub))
+        if (dbus_message_iter_get_array_len(&sub) == 0)
             return list;
         do {
             list.append(qFetchParameter(&sub));



More information about the dbus-commit mailing list