nested arrays and get_element_type
Havoc Pennington
hp at redhat.com
Fri Jul 28 10:45:31 PDT 2006
Thiago Macieira wrote:
> Havoc Pennington wrote:
>>> I need to know what the full type is so if I want to take this
>>> de-serialized message and re-serialize it back into a different
>>> DBusMessage I can pass the appropriate args to open_container()...
>>> right?
>> Yep, for something like this you would need the whole type.
>
> I have some code that does exactly that. I called it "cross-marshalling".
> You can find it on the tools/qdbus/src/qdbusmarshall.cpp (at the very
> end) in a Qt 4.2 snapshot or technical preview.
>
> You can also see it here:
> http://websvn.kde.org/trunk/kdesupport/qt-dbus/src/qdbusmarshaller.cpp?rev=552662&view=auto
> (but this is no longer the most recent version)
>
>
If this is a common thing people want to do, the following could be
implemented internal to dbus with just a memcpy:
dbus_bool_t
dbus_message_copy_args(DBusMessage *source, DBusMessage *dest)
{
/* this isn't real code but shows the idea */
set_length(dest->body, source->body->length);
memcpy(dest->body, source->body, source->body->length);
/* signature in header would also need to be copied */
}
I don't know the use-case or whether this optimization would matter though.
Havoc
More information about the dbus
mailing list