[D-BUS] How append array of struct

Havoc Pennington hp at redhat.com
Wed Aug 3 05:23:30 EST 2005


On Tue, 2005-08-02 at 15:32 -0300, Claudio Takahasi wrote:
> Hi Havoc,
> 
> No error is returned.
> At the ending of appending this code, the message signature should be
> "yya(ss)(ss)". Is that correct?

No, the signature remains yya(ss) regardless of how many array elements.

a(ss)(ss) is an array of struct, followed by a single struct.

> D-Bus message iterators is a new subject for me. I don't know the iterators
> pointers works. What happens with the "struct_iter" when I close the container?

The iterator becomes invalid when you close the container.

> At first glance the elements are being overwritten inside the loop, isn't it?

You are writing a series of structs I think.

> Regarding the restore. When I tryed get the arguments using the code
> below, the message "arguments to dbus_message_iter_open_container()
> were incorrect, assertion "real->iter_type ==
> DBUS_MESSAGE_ITER_TYPE_WRITER" failed" appeared.

Iterators for writing and reading are different; you can't mix the get()
functions with appending values.

Havoc




More information about the dbus mailing list