dbus_message_get_array_len deprecated

Thiago Macieira thiago at kde.org
Wed Jun 4 15:16:03 PDT 2008


Gustavo wrote:
>In the libdbus documentation it says
>(here<http://dbus.freedesktop.org/doc/dbus/api/html/group__DBusMessage.h
>tml#g576dc085c82c1c8e005f269f461daf24>) that the function
> dbus_message_get_array_len is deprecated in the sense it is "stupid".
> Well, is it really stupid? I am currently creating bindings for the
> language Common Lisp (as I already told in another e-mail) and this
> function allows me to create an array with the correct length before
> inserting its contents (an array in Lisp don't care about the type of
> its elements so it fits well in any case, even if the array element
> type isn't "fixed").

The rationale for calling it stupid is also given in the documentation. I 
think you missed that point:

"Why would you want to know how many bytes are in the array as marshaled 
in the wire protocol?"

So, be careful with dbus_message_get_array_len. It doesn't return the 
number of elements in the array -- it returns the size in bytes of the 
marshalled data.

-- 
  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
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080605/61942d79/attachment.pgp 


More information about the dbus mailing list