Appending arrays of fixed arrays of bytes.

Christian Hammond chipx86 at
Fri Jul 29 03:16:47 EST 2005

On 7/26/05, Havoc Pennington <hp at> wrote:
> 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.

Sorry, I had my files on one computer (which had no net access at the
time) and e-mail on another, so I was typing what I had. I messed up
as I wrote the first AS_STRING. That is, of course, DBUS_TYPE_ARRAY.

> >
> > 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:

it's an array of dbus_int32_t.

>  * 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.

It ended up in a nice maze of confusion. I didn't get an idea as to
what's wrong, except maybe that this usage was incorrect. If so, it
would be nice if this was validated at first and a human-readable
error was produced.

Can I please just get some example of the correct way to do this? From
what I can gather, nobody has tested this case, and I'm fairly sure
it's broken. I need to know one way or another soon.

Also, due to the new type system, it seems there is no way to use two
different data types as values in a dictionary, right? This is proving
problematic, as now if you want to send a bundle of properties of
different types in key/value form, you're out of luck, from what I can


More information about the dbus mailing list