]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Add an accessor for the loader's corruption reason
authorWill Thompson <will.thompson@collabora.co.uk>
Sat, 8 Aug 2009 13:29:12 +0000 (14:29 +0100)
committerWill Thompson <will.thompson@collabora.co.uk>
Sun, 1 Nov 2009 14:32:35 +0000 (14:32 +0000)
dbus/dbus-message-internal.h
dbus/dbus-message.c

index 5c616a124fd7b620fdae4c600812ebd645ae761e..870934b9180fc35cdc4650bc4faec6fd222b961f 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef DBUS_MESSAGE_INTERNAL_H
 #define DBUS_MESSAGE_INTERNAL_H
 
+#include <dbus/dbus-marshal-validate.h>
 #include <dbus/dbus-message.h>
 #include <dbus/dbus-resources.h>
 #include <dbus/dbus-list.h>
@@ -73,6 +74,7 @@ void               _dbus_message_loader_putback_message_link  (DBusMessageLoader
                                                                DBusList           *link);
 
 dbus_bool_t        _dbus_message_loader_get_is_corrupted      (DBusMessageLoader  *loader);
+DBusValidity       _dbus_message_loader_get_corruption_reason (DBusMessageLoader  *loader);
 
 void               _dbus_message_loader_set_max_message_size  (DBusMessageLoader  *loader,
                                                                long                size);
index 88f195a8b0c3bfaf439a1ac93571b886d9f45700..e5c0a1e3fc588ffe0248f8f428887e8e4d36bb8f 100644 (file)
@@ -4229,6 +4229,21 @@ _dbus_message_loader_get_is_corrupted (DBusMessageLoader *loader)
   return loader->corrupted;
 }
 
+/**
+ * Checks what kind of bad data confused the loader.
+ *
+ * @param loader the loader
+ * @returns why the loader is hosed, or DBUS_VALID if it isn't.
+ */
+DBusValidity
+_dbus_message_loader_get_corruption_reason (DBusMessageLoader *loader)
+{
+  _dbus_assert ((loader->corrupted && loader->corruption_reason != DBUS_VALID) ||
+                (!loader->corrupted && loader->corruption_reason == DBUS_VALID));
+
+  return loader->corruption_reason;
+}
+
 /**
  * Sets the maximum size message we allow.
  *