26 #ifdef DBUS_ENABLE_EMBEDDED_TESTS 27 #include "dbus-marshal-byteswap.h" 28 #include "dbus-test.h" 29 #include <dbus/dbus-test-tap.h> 33 do_byteswap_test (
int byte_order)
41 _dbus_test_fatal (
"oom");
46 while (_dbus_test_generate_bodies (sequence, byte_order, &signature, &body))
53 _dbus_test_fatal (
"oom");
56 _dbus_test_fatal (
"oom");
68 if (!_dbus_type_reader_equal_values (&body_reader, ©_reader))
71 _dbus_string_get_length (&signature));
73 _dbus_string_get_length (&body));
75 _dbus_string_get_length (©));
77 _dbus_test_fatal (
"Byte-swapped data did not have same values as original data");
90 _dbus_test_diag (
" %d blocks swapped from order '%c' to '%c'",
91 sequence, byte_order, opposite_order);
95 _dbus_marshal_byteswap_test (
void)
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
dbus_bool_t _dbus_string_copy(const DBusString *source, int start, DBusString *dest, int insert_at)
Like _dbus_string_move(), but does not delete the section of the source string that's copied to the d...
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
#define DBUS_BIG_ENDIAN
Code marking MSB-first byte order in the wire protocol.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(), and fills it with the same contents as #_DBUS_STRING_I...
The type reader is an iterator for reading values from a block of values.
#define TRUE
Expands to "1".
void _dbus_type_reader_init(DBusTypeReader *reader, int byte_order, const DBusString *type_str, int type_pos, const DBusString *value_str, int value_pos)
Initializes a type reader.
dbus_bool_t _dbus_string_set_length(DBusString *str, int length)
Sets the length of a string.
DBUS_PRIVATE_EXPORT void _dbus_verbose_bytes_of_string(const DBusString *str, int start, int len)
Dump the given part of the string to verbose log.
void _dbus_marshal_byteswap(const DBusString *signature, int signature_start, int old_byte_order, int new_byte_order, DBusString *value_str, int value_pos)
Byteswaps the marshaled data in the given value_str.
#define DBUS_LITTLE_ENDIAN
Code marking LSB-first byte order in the wire protocol.