dbus_type_is_basic etc.: it is an error to pass in bad typecodes

Previously, the comments said "this function will crash", but that's not
strictly true (checks can be disabled or made non-fatal). Their behaviour
is undefined if you do that, though.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=20496
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
This commit is contained in:
Simon McVittie 2011-03-03 16:51:56 +00:00
parent eb6d268f58
commit d60cc351fe

View file

@ -283,9 +283,10 @@ dbus_signature_validate_single (const char *signature,
* A "container type" can contain basic types, or nested
* container types. #DBUS_TYPE_INVALID is not a container type.
*
* This function will crash if passed a typecode that isn't
* in dbus-protocol.h
* It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID,
* to this function. The valid type-codes are defined by dbus-protocol.h.
*
* @param typecode either a valid type-code or DBUS_TYPE_INVALID
* @returns #TRUE if type is a container
*/
dbus_bool_t
@ -305,9 +306,10 @@ dbus_type_is_container (int typecode)
* variants are not basic types. #DBUS_TYPE_INVALID is not a basic
* type.
*
* This function will crash if passed a typecode that isn't
* in dbus-protocol.h
* It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID,
* to this function. The valid type-codes are defined by dbus-protocol.h.
*
* @param typecode either a valid type-code or DBUS_TYPE_INVALID
* @returns #TRUE if type is basic
*/
dbus_bool_t
@ -334,9 +336,10 @@ dbus_type_is_basic (int typecode)
* but struct is not considered a fixed type for purposes of this
* function.
*
* This function will crash if passed a typecode that isn't
* in dbus-protocol.h
*
* It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID,
* to this function. The valid type-codes are defined by dbus-protocol.h.
*
* @param typecode either a valid type-code or DBUS_TYPE_INVALID
* @returns #FALSE if the type can occupy different lengths
*/
dbus_bool_t