thiago at kde.org
Sun Jan 28 16:41:30 PST 2007
Kevin Krammer wrote:
>Today I found a problem when retrieving a zero length string array.
>The dbus_message_iter_recurse() call does not indicate whether the entry
>iterator points to a valid position and I haven't found a function which
>would tell me (might have missed it though).
>Right now I recurse and then detect that dbus_message_iter_get_arg_type
> is 0, i.e. directly checking this literal. In case this is the way to
> do this, is there a an official define/typedef to check against?
That is the correct way to detect it.
the dbus_message_iter_has_next function is broken: it tells you if there's
at least 2 items in the array, so it can't be used as loop conditionals.
Generally, you can loop like this:
while (dbus_message_iter_get_arg_type(&element_It) == DBUS_TYPE_INVALID)
/* do something with element_it */
This should work for 0-, 1- and many-sized arrays.
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070129/62da9921/attachment.pgp
More information about the dbus