diff options
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 |