summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-marshal.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-10-12 00:55:11 +0000
committerHavoc Pennington <hp@redhat.com>2003-10-12 00:55:11 +0000
commit56cc4ae1a241d36b64dbe26de89714f7771f6e78 (patch)
treeb0180844a5d5ead62328f02071936a111ebf32d5 /dbus/dbus-marshal.c
parenta4d928b7a0e9619e0cc7d69e7eec427cec1dc725 (diff)
2003-10-11 Havoc Pennington <hp@pobox.com>
* test/decode-gcov.c (function_solve_graph): make broken block graph a nonfatal error since it seems to be broken. Need to debug this. * dbus/dbus-marshal.c (_dbus_type_is_valid): new function since we can't just check type > INVALID < LAST anymore * dbus/dbus-message.c (dbus_message_get_signature): new function (dbus_message_has_signature): new function (struct DBusMessage): add signature field (right now it isn't sent over the wire, just generated on the fly) (dbus_message_copy): copy the signature, and init strings to proper length to avoid some reallocs (dbus_message_iter_init_array_iterator): return void, since it can't fail (dbus_message_iter_init_dict_iterator): return void since it can't fail (_dbus_message_loader_queue_messages): add silly temporary hack to fill in message->signature on load * dbus/dbus-protocol.h: change DBUS_TYPE_* values to be ASCII characters, so they are relatively human-readable.
Diffstat (limited to 'dbus/dbus-marshal.c')
-rw-r--r--dbus/dbus-marshal.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/dbus/dbus-marshal.c b/dbus/dbus-marshal.c
index cb989891..1e4992ad 100644
--- a/dbus/dbus-marshal.c
+++ b/dbus/dbus-marshal.c
@@ -1801,7 +1801,7 @@ _dbus_marshal_validate_type (const DBusString *str,
data = _dbus_string_get_const_data_len (str, pos, 1);
- if (*data > DBUS_TYPE_INVALID && *data <= DBUS_TYPE_LAST)
+ if (_dbus_type_is_valid (*data))
{
*type = *data;
if (end_pos != NULL)
@@ -2207,6 +2207,35 @@ _dbus_marshal_validate_arg (const DBusString *str,
return TRUE;
}
+/**
+ * Return #TRUE if the typecode is a valid typecode
+ *
+ * @returns #TRUE if valid
+ */
+dbus_bool_t
+_dbus_type_is_valid (int typecode)
+{
+ switch (typecode)
+ {
+ case DBUS_TYPE_NIL:
+ case DBUS_TYPE_BYTE:
+ case DBUS_TYPE_BOOLEAN:
+ case DBUS_TYPE_INT32:
+ case DBUS_TYPE_UINT32:
+ case DBUS_TYPE_INT64:
+ case DBUS_TYPE_UINT64:
+ case DBUS_TYPE_DOUBLE:
+ case DBUS_TYPE_STRING:
+ case DBUS_TYPE_NAMED:
+ case DBUS_TYPE_ARRAY:
+ case DBUS_TYPE_DICT:
+ case DBUS_TYPE_OBJECT_PATH:
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+}
/**
* If in verbose mode, print a block of binary data.