diff options
author | Havoc Pennington <hp@redhat.com> | 2005-01-27 23:39:26 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2005-01-27 23:39:26 +0000 |
commit | fddbc09c4a9125fcb168fb31ff300d4132919ea6 (patch) | |
tree | b9f9779991f96ea4207a6795679a2f55087ac8ed /dbus/dbus-marshal-header.c | |
parent | 382d5ad0b4adf0070948fc2da623bc52894a7788 (diff) |
2005-01-27 Havoc Pennington <hp@redhat.com>
* dbus/dbus-message.c: byteswap the message if you init an
iterator to read/write from it
* dbus/dbus-marshal-byteswap.c: new file implementing
_dbus_marshal_byteswap()
* dbus/dbus-marshal-basic.c: add _dbus_swap_array()
Diffstat (limited to 'dbus/dbus-marshal-header.c')
-rw-r--r-- | dbus/dbus-marshal-header.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/dbus/dbus-marshal-header.c b/dbus/dbus-marshal-header.c index 6102b6f0..b5a8d3d7 100644 --- a/dbus/dbus-marshal-header.c +++ b/dbus/dbus-marshal-header.c @@ -23,6 +23,7 @@ #include "dbus-marshal-header.h" #include "dbus-marshal-recursive.h" +#include "dbus-marshal-byteswap.h" /** * @addtogroup DBusMarshal @@ -1448,6 +1449,27 @@ _dbus_header_get_flag (DBusHeader *header, return (*flags_p & flag) != 0; } +/** + * Swaps the header into the given order if required. + * + * @param header the header + * @param new_order the new byte order + */ +void +_dbus_header_byteswap (DBusHeader *header, + int new_order) +{ + if (header->byte_order == new_order) + return; + + _dbus_marshal_byteswap (&_dbus_header_signature_str, + 0, header->byte_order, + new_order, + &header->data, 0); + + header->byte_order = new_order; +} + /** @} */ #ifdef DBUS_BUILD_TESTS |