From ccd5eab3207b2c123735be948a304de617abc648 Mon Sep 17 00:00:00 2001 From: Peter McCurdy Date: Mon, 1 Sep 2008 22:56:41 -0400 Subject: [PATCH] Fix signed vs unsigned char* warnings in dbus-sha.c The SHA algorithm is tricky, so instead of running around changing types, this patch just adds casts to convert the SHA results to the signed char* that gets returned. The exception is check_sha_binary, which was taking an unsigned char* and converting it straight away to a signed char*. Taking the unsigned version was unhelpful. Of course, the only place calling it sent in an unsigned char array that couldn't sensibly be changed, so it does the cast itself instead of hiding it in the called function. --- dbus/dbus-sha.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dbus/dbus-sha.c b/dbus/dbus-sha.c index 8ec50b6..a79f898 100644 --- a/dbus/dbus-sha.c +++ b/dbus/dbus-sha.c @@ -459,7 +459,7 @@ _dbus_sha_final (DBusSHAContext *context, sha_finish (context, digest); - if (!_dbus_string_append_len (results, digest, 20)) + if (!_dbus_string_append_len (results, (char *)digest, 20)) return FALSE; /* some kind of security paranoia, though it seems pointless @@ -515,9 +515,9 @@ _dbus_sha_compute (const DBusString *data, #include static dbus_bool_t -check_sha_binary (const unsigned char *input, - int input_len, - const char *expected) +check_sha_binary (const char *input, + int input_len, + const char *expected) { DBusString input_str; DBusString expected_str; @@ -946,7 +946,7 @@ _dbus_sha_test (const char *test_data_dir) ++i; } - if (!check_sha_binary (all_bytes, 256, + if (!check_sha_binary ((char*)all_bytes, 256, "4916d6bdb7f78e6803698cab32d1586ea457dfc8")) return FALSE; -- 1.5.4.3