From 59956987977279a6a5bb6834ffb4fbbf74c44ea3 Mon Sep 17 00:00:00 2001 From: Peter McCurdy Date: Mon, 1 Sep 2008 03:09:40 -0400 Subject: [PATCH] Get rid of unsigned char*s in dbus-marshal-validate.c Only a couple of places here do anything with the contents of character pointers beyond comparing them to character literals. However, those two places read in a (now signed) character to a uint32_t, which requires casting to an unsigned char first in order to get correct results. --- dbus/dbus-marshal-validate.c | 56 +++++++++++++++++++++--------------------- 1 files changed, 28 insertions(+), 28 deletions(-) diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c index e63a463..9a196f8 100644 --- a/dbus/dbus-marshal-validate.c +++ b/dbus/dbus-marshal-validate.c @@ -51,8 +51,8 @@ _dbus_validate_signature_with_reason (const DBusString *type_str, int type_pos, int len) { - const unsigned char *p; - const unsigned char *end; + const char *p; + const char *end; int last; int struct_depth; int array_depth; @@ -288,18 +288,18 @@ out: } static DBusValidity -validate_body_helper (DBusTypeReader *reader, - int byte_order, - dbus_bool_t walk_reader_to_end, - const unsigned char *p, - const unsigned char *end, - const unsigned char **new_p) +validate_body_helper (DBusTypeReader *reader, + int byte_order, + dbus_bool_t walk_reader_to_end, + const char *p, + const char *end, + const char **new_p) { int current_type; while ((current_type = _dbus_type_reader_get_current_type (reader)) != DBUS_TYPE_INVALID) { - const unsigned char *a; + const char *a; int alignment; #if 0 @@ -404,7 +404,7 @@ validate_body_helper (DBusTypeReader *reader, { DBusTypeReader sub; DBusValidity validity; - const unsigned char *array_end; + const char *array_end; if (claimed_len > DBUS_MAXIMUM_ARRAY_LENGTH) return DBUS_INVALID_ARRAY_LENGTH_EXCEEDS_MAXIMUM; @@ -452,7 +452,7 @@ validate_body_helper (DBusTypeReader *reader, DBusString str; DBusValidity validity; - claimed_len = *p; + claimed_len = (unsigned char)*p; ++p; /* 1 is for nul termination */ @@ -496,7 +496,7 @@ validate_body_helper (DBusTypeReader *reader, int contained_type; DBusValidity reason; - claimed_len = *p; + claimed_len = (unsigned char)*p; ++p; /* + 1 for nul */ @@ -635,8 +635,8 @@ _dbus_validate_body_with_reason (const DBusString *expected_signature, int len) { DBusTypeReader reader; - const unsigned char *p; - const unsigned char *end; + const char *p; + const char *end; DBusValidity validity; _dbus_assert (len >= 0); @@ -712,9 +712,9 @@ _dbus_validate_path (const DBusString *str, int start, int len) { - const unsigned char *s; - const unsigned char *end; - const unsigned char *last_slash; + const char *s; + const char *end; + const char *last_slash; _dbus_assert (start >= 0); _dbus_assert (len >= 0); @@ -777,10 +777,10 @@ _dbus_validate_interface (const DBusString *str, int start, int len) { - const unsigned char *s; - const unsigned char *end; - const unsigned char *iface; - const unsigned char *last_dot; + const char *s; + const char *end; + const char *iface; + const char *last_dot; _dbus_assert (start >= 0); _dbus_assert (len >= 0); @@ -853,9 +853,9 @@ _dbus_validate_member (const DBusString *str, int start, int len) { - const unsigned char *s; - const unsigned char *end; - const unsigned char *member; + const char *s; + const char *end; + const char *member; _dbus_assert (start >= 0); _dbus_assert (len >= 0); @@ -955,10 +955,10 @@ _dbus_validate_bus_name (const DBusString *str, int start, int len) { - const unsigned char *s; - const unsigned char *end; - const unsigned char *iface; - const unsigned char *last_dot; + const char *s; + const char *end; + const char *iface; + const char *last_dot; _dbus_assert (start >= 0); _dbus_assert (len >= 0); -- 1.5.4.3