mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-08 23:20:18 +01:00
just when the file was looking all beautiful, add horrible hacky code to
fixup array lengths after setting a value somewhere within the array.
This commit is contained in:
parent
f757adc797
commit
ec8e14cfd5
3 changed files with 818 additions and 138 deletions
|
|
@ -383,6 +383,7 @@ _dbus_marshal_set_basic (DBusString *str,
|
|||
break;
|
||||
case DBUS_TYPE_INT32:
|
||||
case DBUS_TYPE_UINT32:
|
||||
pos = _DBUS_ALIGN_VALUE (pos, 4);
|
||||
set_4_octets (str, pos, vp->u32, byte_order);
|
||||
if (old_end_pos)
|
||||
*old_end_pos = pos + 4;
|
||||
|
|
@ -393,14 +394,13 @@ _dbus_marshal_set_basic (DBusString *str,
|
|||
case DBUS_TYPE_INT64:
|
||||
case DBUS_TYPE_UINT64:
|
||||
case DBUS_TYPE_DOUBLE:
|
||||
{
|
||||
set_8_octets (str, pos, *vp, byte_order);
|
||||
if (old_end_pos)
|
||||
pos = _DBUS_ALIGN_VALUE (pos, 8);
|
||||
set_8_octets (str, pos, *vp, byte_order);
|
||||
if (old_end_pos)
|
||||
*old_end_pos = pos + 8;
|
||||
if (new_end_pos)
|
||||
*new_end_pos = pos + 8;
|
||||
return TRUE;
|
||||
}
|
||||
if (new_end_pos)
|
||||
*new_end_pos = pos + 8;
|
||||
return TRUE;
|
||||
break;
|
||||
case DBUS_TYPE_STRING:
|
||||
case DBUS_TYPE_OBJECT_PATH:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <dbus/dbus-protocol.h>
|
||||
#include <dbus/dbus-list.h>
|
||||
#include <dbus/dbus-marshal-basic.h> /* 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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue