case DBUS_STRUCT_END_CHAR:
case DBUS_DICT_ENTRY_END_CHAR:
depth--;
+ /* For fixed-size structs we need to account padding.
+ */
+ if (!variable)
+ res = _DBUS_ALIGN_VALUE (res, current_alignment);
break;
case DBUS_STRUCT_BEGIN_CHAR:
case DBUS_DICT_ENTRY_BEGIN_CHAR:
writer->value_pos);
writer->value_pos += sub_len;
+ /* Structs may have padding if they are fixed-size structs.
+ * This is because of requirement that struct size must be a multiply
+ * of required alignment.
+ */
+ if (sub->is_fixed)
+ {
+ diff = _DBUS_ALIGN_VALUE (sub_len, sub->alignment) - sub_len;
+ result = result && _dbus_string_insert_bytes (writer->value_str, writer->value_pos, diff, 0);
+ writer->value_pos += diff;
+ }
+
_dbus_string_free (sub->value_str);
dbus_free (sub->value_str);