From d5235687487b33a834994a201be09dccaaf6bd20 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Fri, 27 Sep 2013 11:09:13 +0800 Subject: [PATCH] Use char instead of unsigned char to fix cast warning Since there is no mathematical operation based on char or unsigned char, the only mathematical operations are cast to int, so it's safe. It's nothing about unsigned or signed char when operate on its address, so just use char rather than unsigned char to fix cast problem because _dbus_string_get_data_len() returns a char pointer. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=15522 --- dbus/dbus-marshal-byteswap.c | 10 +++++----- dbus/dbus-marshal-header.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dbus/dbus-marshal-byteswap.c b/dbus/dbus-marshal-byteswap.c index e6711be..80d3ae5 100644 --- a/dbus/dbus-marshal-byteswap.c +++ b/dbus/dbus-marshal-byteswap.c @@ -36,8 +36,8 @@ byteswap_body_helper (DBusTypeReader *reader, dbus_bool_t walk_reader_to_end, int old_byte_order, int new_byte_order, - unsigned char *p, - unsigned char **new_p) + char *p, + char **new_p) { int current_type; @@ -112,7 +112,7 @@ byteswap_body_helper (DBusTypeReader *reader, else { DBusTypeReader sub; - const unsigned char *array_end; + const char *array_end; array_end = p + array_len; @@ -140,7 +140,7 @@ byteswap_body_helper (DBusTypeReader *reader, case DBUS_TYPE_SIGNATURE: { - dbus_uint32_t sig_len; + int sig_len; sig_len = *p; @@ -153,7 +153,7 @@ byteswap_body_helper (DBusTypeReader *reader, /* 1 byte sig len, sig typecodes, align to * contained-type-boundary, values. */ - dbus_uint32_t sig_len; + int sig_len; DBusString sig; DBusTypeReader sub; int contained_alignment; diff --git a/dbus/dbus-marshal-header.c b/dbus/dbus-marshal-header.c index 48151c6..73a6152 100644 --- a/dbus/dbus-marshal-header.c +++ b/dbus/dbus-marshal-header.c @@ -1458,7 +1458,7 @@ _dbus_header_toggle_flag (DBusHeader *header, dbus_uint32_t flag, dbus_bool_t value) { - unsigned char *flags_p; + char *flags_p; flags_p = _dbus_string_get_data_len (&header->data, FLAGS_OFFSET, 1); @@ -1479,7 +1479,7 @@ dbus_bool_t _dbus_header_get_flag (DBusHeader *header, dbus_uint32_t flag) { - const unsigned char *flags_p; + const char *flags_p; flags_p = _dbus_string_get_const_data_len (&header->data, FLAGS_OFFSET, 1); -- 1.7.9.5