summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-marshal-basic.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-01-17 22:03:19 +0000
committerHavoc Pennington <hp@redhat.com>2005-01-17 22:03:19 +0000
commitad937e16957c76f21b0df79d742cb4c401d2abb9 (patch)
treee1d62f2663c5901ad6f340dee4a6e0973dddc1f1 /dbus/dbus-marshal-basic.c
parent62e465339a306fa564b69935da494dad6e1b474a (diff)
2005-01-17 Havoc Pennington <hp@redhat.com>
* Throughout, align variant bodies according to the contained type, rather than always to 8. Should save a fair bit of space in message headers. * dbus/dbus-marshal-validate.c (_dbus_validate_body_with_reason): fix handling of case where p == end * doc/TODO: remove the dbus_bool_t item and variant alignment items
Diffstat (limited to 'dbus/dbus-marshal-basic.c')
-rw-r--r--dbus/dbus-marshal-basic.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c
index fce935fa..5cb43b88 100644
--- a/dbus/dbus-marshal-basic.c
+++ b/dbus/dbus-marshal-basic.c
@@ -1389,6 +1389,30 @@ _dbus_verbose_bytes_of_string (const DBusString *str,
_dbus_verbose_bytes (d, len, start);
}
+/**
+ * Get the first type in the signature. The difference between this
+ * and just getting the first byte of the signature is that you won't
+ * get DBUS_STRUCT_BEGIN_CHAR, you'll get DBUS_TYPE_STRUCT
+ * instead.
+ *
+ * @param str string containing signature
+ * @param pos where the signature starts
+ * @returns the first type in the signature
+ */
+int
+_dbus_first_type_in_signature (const DBusString *str,
+ int pos)
+{
+ unsigned char t;
+
+ t = _dbus_string_get_byte (str, pos);
+
+ if (t == DBUS_STRUCT_BEGIN_CHAR)
+ return DBUS_TYPE_STRUCT;
+ else
+ return t;
+}
+
/** @} */
#ifdef DBUS_BUILD_TESTS