From: Will Thompson Date: Sat, 8 Aug 2009 13:29:12 +0000 (+0100) Subject: Add an accessor for the loader's corruption reason X-Git-Tag: dbus-1.2.18~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3171383ce9bac0c2718da4ce288db890d5d7bfda;hp=7cf332d34ea974b9781f47f4af4efca4de71b96a;p=platform%2Fupstream%2Fdbus.git Add an accessor for the loader's corruption reason --- diff --git a/dbus/dbus-message-internal.h b/dbus/dbus-message-internal.h index 7cd88d5..0134f8d 100644 --- a/dbus/dbus-message-internal.h +++ b/dbus/dbus-message-internal.h @@ -23,6 +23,7 @@ #ifndef DBUS_MESSAGE_INTERNAL_H #define DBUS_MESSAGE_INTERNAL_H +#include #include #include #include @@ -62,6 +63,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); diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 0b81806..272592e 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -3785,6 +3785,21 @@ _dbus_message_loader_get_is_corrupted (DBusMessageLoader *loader) } /** + * 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. * * @param loader the loader