Add an accessor for the loader's corruption reason

This commit is contained in:
Will Thompson 2009-08-08 14:29:12 +01:00 committed by Colin Walters
parent 7cf332d34e
commit 3171383ce9
2 changed files with 17 additions and 0 deletions

View 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>
@ -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);

View file

@ -3784,6 +3784,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.
*