Appending arrays of fixed arrays of bytes.

Havoc Pennington hp at redhat.com
Wed Jul 27 00:22:13 EST 2005


Hi,

On Mon, 2005-07-25 at 18:03 -0700, Christian Hammond wrote:
> dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY_AS_STRING,
> DBUS_TYPE_STRING_AS_STRING, &array_iter);

The compiler should be whining about this; the second arg is an int and
ARRAY_AS_STRING is a pointer.

> 
> for (i = 0; i < count; i++)
> {
>     dbus_message_iter_append_fixed_array(&array_iter, info[i].data,
> info[i].len);

Don't know what info[i].data is, but remember from the docs:

 * The "value" argument should be the address of the array.  So for
 * integer, "dbus_int32_t**" is expected for example.

> This method generates the following error:
> 
> "assertion failed "len <= real_source->len - start" file
> "dbus-string.c" line 1576 function _dbus_string_copy_len"

If you get a backtrace from this and then look at the relevant source
code, you can probably get some idea what's wrong.

> "arguments to dbus_message_iter_open_container() were incorrect,
> assertion "_dbus_message_iter_append_check (real)" failed in file
> dbus-message.c line 2229."

There should be another warning printed right before that one explaining
what was wrong with the iter...

Havoc




More information about the dbus mailing list