From 698f7bebe775face0334054c68faebb74875391e Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Sun, 21 Aug 2016 21:30:49 +0200 Subject: Fix warnings from compiler option '-Wshadow' Signed-off-by: Thomas Zimmermann --- configure.ac | 1 - dbus/dbus-address.c | 6 +++--- dbus/dbus-address.h | 2 +- dbus/dbus-list.c | 2 -- dbus/dbus-marshal-recursive-util.c | 12 ++++++------ dbus/dbus-message-factory.c | 6 +++--- dbus/dbus-timeout.c | 6 +++--- dbus/dbus-watch.c | 6 +++--- test/dbus-daemon.c | 4 ++-- tools/dbus-launch-x11.c | 2 +- tools/dbus-send.c | 16 ++++++++-------- 11 files changed, 30 insertions(+), 33 deletions(-) diff --git a/configure.ac b/configure.ac index 250492a..8c05157 100644 --- a/configure.ac +++ b/configure.ac @@ -1365,7 +1365,6 @@ dnl code and remove these flags. DISABLE_WARNINGS="$DISABLE_WARNINGS -Wno-suggest-attribute=format -Wno-suggest-attribute=noreturn - -Wno-shadow -Wno-switch-default -Wno-switch-enum -Wno-type-limits diff --git a/dbus/dbus-address.c b/dbus/dbus-address.c index 8e397e5..66b26d5 100644 --- a/dbus/dbus-address.c +++ b/dbus/dbus-address.c @@ -354,14 +354,14 @@ append_unescaped_value (DBusString *unescaped, * in the semicolon-separated list should be tried first. * * @param address the address. - * @param entry return location to an array of entries. + * @param entry_result return location to an array of entries. * @param array_len return location for array length. * @param error address where an error can be returned. * @returns #TRUE on success, #FALSE otherwise. */ dbus_bool_t dbus_parse_address (const char *address, - DBusAddressEntry ***entry, + DBusAddressEntry ***entry_result, int *array_len, DBusError *error) { @@ -553,7 +553,7 @@ dbus_parse_address (const char *address, } _dbus_list_clear (&entries); - *entry = entry_array; + *entry_result = entry_array; return TRUE; diff --git a/dbus/dbus-address.h b/dbus/dbus-address.h index e51ef0a..4d14fdf 100644 --- a/dbus/dbus-address.h +++ b/dbus/dbus-address.h @@ -42,7 +42,7 @@ typedef struct DBusAddressEntry DBusAddressEntry; DBUS_EXPORT dbus_bool_t dbus_parse_address (const char *address, - DBusAddressEntry ***entry, + DBusAddressEntry ***entry_result, int *array_len, DBusError *error); DBUS_EXPORT diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c index c4c1856..df7c72f 100644 --- a/dbus/dbus-list.c +++ b/dbus/dbus-list.c @@ -1044,8 +1044,6 @@ _dbus_list_test (void) { DBusList *got_link1; DBusList *got_link2; - - DBusList *link2; void *data1_indirect; void *data1; diff --git a/dbus/dbus-marshal-recursive-util.c b/dbus/dbus-marshal-recursive-util.c index e00ac5c..1f57ed8 100644 --- a/dbus/dbus-marshal-recursive-util.c +++ b/dbus/dbus-marshal-recursive-util.c @@ -3068,10 +3068,10 @@ array_write_value (TestTypeNode *node, link = _dbus_list_get_first_link (&container->children); while (link != NULL) { - TestTypeNode *child = link->data; + TestTypeNode *child2 = link->data; DBusList *next = _dbus_list_get_next_link (&container->children, link); - if (!node_write_value (child, block, &sub, seed + i)) + if (!node_write_value (child2, block, &sub, seed + i)) goto oom; link = next; @@ -3132,20 +3132,20 @@ array_read_or_set_value (TestTypeNode *node, link = _dbus_list_get_first_link (&container->children); while (link != NULL) { - TestTypeNode *child = link->data; + TestTypeNode *child2 = link->data; DBusList *next = _dbus_list_get_next_link (&container->children, link); - _dbus_assert (child->klass->typecode == + _dbus_assert (child2->klass->typecode == _dbus_type_reader_get_element_type (reader)); if (realign_root == NULL) { - if (!node_read_value (child, &sub, seed + i)) + if (!node_read_value (child2, &sub, seed + i)) return FALSE; } else { - if (!node_set_value (child, &sub, realign_root, seed + i)) + if (!node_set_value (child2, &sub, realign_root, seed + i)) return FALSE; } diff --git a/dbus/dbus-message-factory.c b/dbus/dbus-message-factory.c index b742e4c..a3e2b6a 100644 --- a/dbus/dbus-message-factory.c +++ b/dbus/dbus-message-factory.c @@ -139,11 +139,11 @@ generate_trivial_inner (DBusMessageDataIter *iter, _dbus_assert_not_reached ("oom"); { - DBusMessageIter iter; + DBusMessageIter iter2; const char *v_STRING = "This is an error"; - dbus_message_iter_init_append (message, &iter); - if (!dbus_message_iter_append_basic (&iter, + dbus_message_iter_init_append (message, &iter2); + if (!dbus_message_iter_append_basic (&iter2, DBUS_TYPE_STRING, &v_STRING)) _dbus_assert_not_reached ("oom"); diff --git a/dbus/dbus-timeout.c b/dbus/dbus-timeout.c index a1d6ce5..413178d 100644 --- a/dbus/dbus-timeout.c +++ b/dbus/dbus-timeout.c @@ -262,12 +262,12 @@ _dbus_timeout_list_set_functions (DBusTimeoutList *timeout_list, link2 = _dbus_list_get_first_link (&timeout_list->timeouts); while (link2 != link) { - DBusList *next = _dbus_list_get_next_link (&timeout_list->timeouts, - link2); + DBusList *next2 = _dbus_list_get_next_link (&timeout_list->timeouts, + link2); (* remove_function) (link2->data, data); - link2 = next; + link2 = next2; } return FALSE; diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c index 3257f0e..9842296 100644 --- a/dbus/dbus-watch.c +++ b/dbus/dbus-watch.c @@ -326,8 +326,8 @@ _dbus_watch_list_set_functions (DBusWatchList *watch_list, link2 = _dbus_list_get_first_link (&watch_list->watches); while (link2 != link) { - DBusList *next = _dbus_list_get_next_link (&watch_list->watches, - link2); + DBusList *next2 = _dbus_list_get_next_link (&watch_list->watches, + link2); #ifdef DBUS_ENABLE_VERBOSE_MODE DBusWatch *watch2 = link2->data; @@ -337,7 +337,7 @@ _dbus_watch_list_set_functions (DBusWatchList *watch_list, (* remove_function) (link2->data, data); - link2 = next; + link2 = next2; } return FALSE; diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 5d121ca..44b3dfb 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -951,14 +951,14 @@ static const guchar partial_message[] = static void send_all_with_fd (GSocket *socket, - const guchar *partial_message, + const guchar *local_partial_message, gsize len, int fd) { GSocketControlMessage *fdm = g_unix_fd_message_new (); GError *error = NULL; gssize sent; - GOutputVector vector = { partial_message, len }; + GOutputVector vector = { local_partial_message, len }; g_unix_fd_message_append_fd (G_UNIX_FD_MESSAGE (fdm), fd, &error); g_assert_no_error (error); diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c index d22ef5d..e8b29f8 100644 --- a/tools/dbus-launch-x11.c +++ b/tools/dbus-launch-x11.c @@ -43,7 +43,7 @@ static Atom address_atom; static Atom pid_atom; static int -x_io_error_handler (Display *xdisplay) +x_io_error_handler (Display *local_xdisplay) { verbose ("X IO error\n"); kill_bus_and_exit (0); diff --git a/tools/dbus-send.c b/tools/dbus-send.c index 0dc1f5b..b77bfe5 100644 --- a/tools/dbus-send.c +++ b/tools/dbus-send.c @@ -457,13 +457,13 @@ main (int argc, char *argv[]) { char *arg; char *c; - int type; + int type2; int secondary_type; int container_type; DBusMessageIter *target_iter; DBusMessageIter container_iter; - type = DBUS_TYPE_INVALID; + type2 = DBUS_TYPE_INVALID; arg = argv[i++]; c = strchr (arg, ':'); @@ -497,9 +497,9 @@ main (int argc, char *argv[]) } if (arg[0] == 0) - type = DBUS_TYPE_STRING; + type2 = DBUS_TYPE_STRING; else - type = type_from_name (arg); + type2 = type_from_name (arg); if (container_type == DBUS_TYPE_DICT_ENTRY) { @@ -514,7 +514,7 @@ main (int argc, char *argv[]) *(c++) = 0; secondary_type = type_from_name (arg); sig[0] = DBUS_DICT_ENTRY_BEGIN_CHAR; - sig[1] = type; + sig[1] = type2; sig[2] = secondary_type; sig[3] = DBUS_DICT_ENTRY_END_CHAR; sig[4] = '\0'; @@ -527,7 +527,7 @@ main (int argc, char *argv[]) else if (container_type != DBUS_TYPE_INVALID) { char sig[2]; - sig[0] = type; + sig[0] = type2; sig[1] = '\0'; dbus_message_iter_open_container (&iter, container_type, @@ -540,11 +540,11 @@ main (int argc, char *argv[]) if (container_type == DBUS_TYPE_ARRAY) { - append_array (target_iter, type, c); + append_array (target_iter, type2, c); } else if (container_type == DBUS_TYPE_DICT_ENTRY) { - append_dict (target_iter, type, secondary_type, c); + append_dict (target_iter, type2, secondary_type, c); } else append_arg (target_iter, type, c); -- 2.7.4