From ec8e14cfd591aa020b199161bacb01d90c6fa158 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 3 Jan 2005 04:25:32 +0000 Subject: just when the file was looking all beautiful, add horrible hacky code to fixup array lengths after setting a value somewhere within the array. --- dbus/dbus-marshal-recursive.h | 78 +++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 32 deletions(-) (limited to 'dbus/dbus-marshal-recursive.h') diff --git a/dbus/dbus-marshal-recursive.h b/dbus/dbus-marshal-recursive.h index 96c83062..025c3e04 100644 --- a/dbus/dbus-marshal-recursive.h +++ b/dbus/dbus-marshal-recursive.h @@ -26,6 +26,7 @@ #include #include +#include #include /* this can vanish when we merge */ #ifndef PACKAGE @@ -54,6 +55,7 @@ typedef struct DBusTypeMark DBusTypeMark; typedef struct DBusTypeReader DBusTypeReader; typedef struct DBusTypeWriter DBusTypeWriter; typedef struct DBusTypeReaderClass DBusTypeReaderClass; +typedef struct DBusArrayLenFixup DBusArrayLenFixup; /* The mark is a way to compress a TypeReader; it isn't all that * successful though. The idea was to use this for caching header @@ -104,7 +106,7 @@ struct DBusTypeWriter dbus_uint32_t type_pos_is_expectation : 1; /* type_pos is an insertion point or an expected next type */ dbus_uint32_t enabled : 1; /* whether to write values */ - + DBusString *type_str; int type_pos; DBusString *value_str; @@ -120,6 +122,12 @@ struct DBusTypeWriter } u; }; +struct DBusArrayLenFixup +{ + int len_pos_in_reader; + int new_len; +}; + void _dbus_type_reader_init (DBusTypeReader *reader, int byte_order, const DBusString *type_str, @@ -161,37 +169,43 @@ dbus_bool_t _dbus_type_reader_set_basic (DBusTypeReader * dbus_bool_t _dbus_type_reader_greater_than (const DBusTypeReader *lhs, const DBusTypeReader *rhs); -void _dbus_type_writer_init (DBusTypeWriter *writer, - int byte_order, - DBusString *type_str, - int type_pos, - DBusString *value_str, - int value_pos); -void _dbus_type_writer_init_values_only (DBusTypeWriter *writer, - int byte_order, - const DBusString *type_str, - int type_pos, - DBusString *value_str, - int value_pos); -dbus_bool_t _dbus_type_writer_write_basic (DBusTypeWriter *writer, - int type, - const void *value); -dbus_bool_t _dbus_type_writer_write_array (DBusTypeWriter *writer, - int type, - const void *array, - int array_len); -dbus_bool_t _dbus_type_writer_recurse (DBusTypeWriter *writer, - int container_type, - const DBusString *contained_type, - int contained_type_start, - DBusTypeWriter *sub); -dbus_bool_t _dbus_type_writer_unrecurse (DBusTypeWriter *writer, - DBusTypeWriter *sub); -dbus_bool_t _dbus_type_writer_write_reader (DBusTypeWriter *writer, - DBusTypeReader *reader, - const DBusTypeReader *start_after); -void _dbus_type_writer_set_enabled (DBusTypeWriter *writer, - dbus_bool_t enabled); +void _dbus_type_writer_init (DBusTypeWriter *writer, + int byte_order, + DBusString *type_str, + int type_pos, + DBusString *value_str, + int value_pos); +void _dbus_type_writer_init_values_only (DBusTypeWriter *writer, + int byte_order, + const DBusString *type_str, + int type_pos, + DBusString *value_str, + int value_pos); +dbus_bool_t _dbus_type_writer_write_basic (DBusTypeWriter *writer, + int type, + const void *value); +dbus_bool_t _dbus_type_writer_write_array (DBusTypeWriter *writer, + int type, + const void *array, + int array_len); +dbus_bool_t _dbus_type_writer_recurse (DBusTypeWriter *writer, + int container_type, + const DBusString *contained_type, + int contained_type_start, + DBusTypeWriter *sub); +dbus_bool_t _dbus_type_writer_unrecurse (DBusTypeWriter *writer, + DBusTypeWriter *sub); +dbus_bool_t _dbus_type_writer_write_reader (DBusTypeWriter *writer, + DBusTypeReader *reader); +dbus_bool_t _dbus_type_writer_write_reader_partial (DBusTypeWriter *writer, + DBusTypeReader *reader, + const DBusTypeReader *start_after, + int start_after_new_pos, + int start_after_new_len, + DBusList **fixups); +void _dbus_type_writer_set_enabled (DBusTypeWriter *writer, + dbus_bool_t enabled); + #endif /* DBUS_MARSHAL_RECURSIVE_H */ -- cgit