diff options
| author | Thiago Macieira <thiago@kde.org> | 2006-05-07 09:36:19 +0000 | 
|---|---|---|
| committer | Thiago Macieira <thiago@kde.org> | 2006-05-07 09:36:19 +0000 | 
| commit | e2f5ba2280a42978d27113b7ffcadd910c38a363 (patch) | |
| tree | 35fd6032f9537105ef64be0045f8615421ef4410 | |
| parent | b6c9d861058c2b9dec6a4491c37e8ef420704b96 (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.
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | qt/qdbusmarshall.cpp | 10 | 
2 files changed, 11 insertions, 6 deletions
| @@ -1,3 +1,10 @@ +2006-05-07  Thiago Macieira  <thiago.macieira@trolltech.com> + +	* 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. +  2006-05-06  Thiago Macieira  <thiago.macieira@trolltech.com>  	* qt/qdbusmessage.cpp: diff --git a/qt/qdbusmarshall.cpp b/qt/qdbusmarshall.cpp index 34202154..8d801524 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)); | 
