summaryrefslogtreecommitdiff
path: root/qt
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@trolltech.com>2006-05-07 09:36:19 +0000
committerJohn Palmieri <johnp@remedyz.boston.redhat.com>2006-06-28 08:15:16 -0400
commit5d2e3e322064556ec805bae7d5fcf16f4951b1bb (patch)
tree4419fcbe8c341028cce9c51131be05c744001bf6 /qt
parent8d717a3b545ebfe8d848920b9c6c9e81ebb975db (diff)
* 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.
Diffstat (limited to 'qt')
-rw-r--r--qt/qdbusmarshall.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/qt/qdbusmarshall.cpp b/qt/qdbusmarshall.cpp
index 3420215..8d80152 100644
--- a/qt/qdbusmarshall.cpp
+++ b/qt/qdbusmarshall.cpp
@@ -61,8 +61,7 @@ inline QVariant qFetchList(DBusMessageIter *arrayIt)
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 @@ static QStringList qFetchStringList(DBusMessageIter *arrayIt)
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 @@ static QVariant qFetchParameter(DBusMessageIter *it)
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 @@ static QVariant qFetchParameter(DBusMessageIter *it)
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));