dbus-marshal-recursive.h: reduce padding in DBusType{Reader,Writer}

When building for Arm Morello (where pointers are 16 bytes), I hit the
static assertion that sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter)
inside _dbus_message_iter_init_common() otherwise. This can be fixed by
moving the pointers to the beginning of the struct to remove padding.
This commit is contained in:
Alex Richardson 2022-08-12 10:34:06 +00:00 committed by Simon McVittie
parent 33dbeb5ebe
commit 91f4ac9cf6

View file

@ -38,18 +38,19 @@ typedef struct DBusArrayLenFixup DBusArrayLenFixup;
*/
struct DBusTypeReader
{
const DBusTypeReaderClass *klass; /**< the vtable for the reader */
const DBusString *type_str; /**< string containing signature of block */
const DBusString *value_str; /**< string containing values of block */
dbus_uint32_t byte_order : 8; /**< byte order of the block */
dbus_uint32_t finished : 1; /**< marks we're at end iterator for cases
* where we don't have another way to tell
*/
dbus_uint32_t array_len_offset : 3; /**< bytes back from start_pos that len ends */
const DBusString *type_str; /**< string containing signature of block */
int type_pos; /**< current position in signature */
const DBusString *value_str; /**< string containing values of block */
int value_pos; /**< current position in values */
const DBusTypeReaderClass *klass; /**< the vtable for the reader */
union
{
struct {
@ -63,6 +64,8 @@ struct DBusTypeReader
*/
struct DBusTypeWriter
{
DBusString *type_str; /**< where to write typecodes (or read type expectations) */
DBusString *value_str; /**< where to write values */
dbus_uint32_t byte_order : 8; /**< byte order to write values with */
dbus_uint32_t container_type : 8; /**< what are we inside? (e.g. struct, variant, array) */
@ -71,9 +74,7 @@ struct DBusTypeWriter
dbus_uint32_t enabled : 1; /**< whether to write values */
DBusString *type_str; /**< where to write typecodes (or read type expectations) */
int type_pos; /**< current pos in type_str */
DBusString *value_str; /**< where to write values */
int value_pos; /**< next position to write */
union