diff options
author | Anders Carlsson <andersca@codefactory.se> | 2003-01-07 23:08:41 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@codefactory.se> | 2003-01-07 23:08:41 +0000 |
commit | 000d29a283b06517f0cfb599516a390e3afbf25c (patch) | |
tree | 256cc7e3e73cb5c71f1eaa13da25fb7971b9ce27 /dbus/dbus-marshal.c | |
parent | 1f23ea99b37bfc8197f1c6a376f9afe08037f0f6 (diff) |
2003-01-08 Anders Carlsson <andersca@codefactory.se>
* dbus/dbus-internals.c: (_dbus_type_to_string):
New function that returns a string describing a type.
* dbus/dbus-marshal.c: (_dbus_demarshal_byte_array):
* dbus/dbus-marshal.h:
* dbus/dbus-message.c: (dbus_message_get_fields_valist),
(dbus_message_iter_get_field_type), (dbus_message_iter_get_double),
(dbus_message_iter_get_byte_array):
* dbus/dbus-message.h:
Add new convenience functions for appending and getting message fields.
Also add demarshalling routines for byte arrays.
Diffstat (limited to 'dbus/dbus-marshal.c')
-rw-r--r-- | dbus/dbus-marshal.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dbus/dbus-marshal.c b/dbus/dbus-marshal.c index 7c85ded0..14629362 100644 --- a/dbus/dbus-marshal.c +++ b/dbus/dbus-marshal.c @@ -396,6 +396,40 @@ _dbus_demarshal_string (DBusString *str, return retval; } +unsigned char * +_dbus_demarshal_byte_array (DBusString *str, + int byte_order, + int pos, + int *new_pos, + int *array_len) +{ + int len; + unsigned char *retval; + const char *data; + + len = _dbus_demarshal_uint32 (str, byte_order, pos, &pos); + + retval = dbus_malloc (len); + + if (!retval) + return NULL; + + _dbus_string_get_const_data_len (str, &data, pos, len); + + if (!data) + return NULL; + + memcpy (retval, data, len); + + if (new_pos) + *new_pos = pos + len; + + if (array_len) + *array_len = len; + + return retval; +} + /** * Returns the position right after the end position * end position of a field |