Can not create a array message correctly

Thiago Macieira thiago at kde.org
Tue Jul 21 23:50:54 PDT 2009


Alex Bunnett wrote:
> if ( dbus_message_iter_get_arg_type(&args1) == DBUS_TYPE_ARRAY)
>            {
>                        int maxlen = 100;
>                        uint8_t pBuff1[100];
>
>                        dbus_message_iter_recurse (&args1, &subiter);
>
>                        dbus_message_iter_get_fixed_array(&subiter,
> &pBuff1, &maxlen); // this is incorrect not what I wrote in }

That's because dbus_message_iter_get_fixed_array requires a pointer to a 
pointer to be passed in. Try this:

	char *data;
	int len;
	dbus_message_iter_get_fixed_array(&subiter, &data, &len);
	// use len bytes in 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/20090722/cae04a89/attachment.pgp 


More information about the dbus mailing list