summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbus/dbus-marshal.c')
-rw-r--r--dbus/dbus-marshal.c34
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