From 034b6d5bfb5bdedaf843079a02ff6df31488f394 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 12 Nov 2022 16:34:02 -0500 Subject: [PATCH] Remove some shadowed variables identified by -Wshadow there are plenty more but these are the low hanging fruit Change-Id: I86d9f4f56e8cd9b381d1bf6a6679cd58c6a4004d --- apps/cuesheet.c | 2 +- apps/filetree.c | 2 +- apps/gui/folder_select.c | 2 +- apps/menu.c | 1 - apps/recorder/keyboard.c | 2 +- apps/tagcache.c | 2 +- apps/tagtree.c | 8 ++++---- apps/talk.c | 2 +- firmware/drivers/lcd-color-common.c | 6 ++---- 9 files changed, 12 insertions(+), 15 deletions(-) diff --git a/apps/cuesheet.c b/apps/cuesheet.c index 7823e599e5..da14147262 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c @@ -65,7 +65,7 @@ static bool search_for_cuesheet(const char *path, struct cuesheet_file *cue_file strcpy(cuepath, CUE_DIR); if (strlcat(cuepath, slash, MAX_PATH) >= MAX_PATH) goto skip; /* overflow */ - char *dot = strrchr(cuepath, '.'); + dot = strrchr(cuepath, '.'); strcpy(dot, ".cue"); if (!file_exists(cuepath)) { diff --git a/apps/filetree.c b/apps/filetree.c index 136a3f2ff2..06d92bc944 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -667,7 +667,7 @@ int ft_enter(struct tree_context* c) break; } - struct entry* file = tree_get_entry_at(c, c->selected_item); + file = tree_get_entry_at(c, c->selected_item); if (!file) { splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN)); diff --git a/apps/gui/folder_select.c b/apps/gui/folder_select.c index cef95e179e..50d25e7305 100644 --- a/apps/gui/folder_select.c +++ b/apps/gui/folder_select.c @@ -208,7 +208,7 @@ static struct folder* load_folder(struct folder* parent, char *folder) if ((dn[0] == '.') && (dn[1] == '\0' || (dn[1] == '.' && dn[2] == '\0'))) continue; /* copy entry name to end of buffer, save pointer */ - int len = strlen((char *)entry->d_name); + len = strlen((char *)entry->d_name); char *name = folder_alloc_from_end(len+1); /*for NULL*/ if (name == NULL) { diff --git a/apps/menu.c b/apps/menu.c index d8d1b6b081..cfc1dce7bd 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -522,7 +522,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, MENUITEM_STRINGLIST(notquickscreen_able_option, ID2P(LANG_ONPLAY_MENU_TITLE), NULL, ID2P(LANG_RESET_SETTING)); - const struct menu_item_ex *menu; const struct settings_list *setting = find_setting(temp->variable, NULL); #ifdef HAVE_QUICKSCREEN diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index b6b5affb6a..45cccdcf8b 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -549,8 +549,8 @@ int kbd_input(char* text, int buflen, unsigned short *kbd) { /* declare scoped pointers inside screen loops - hide the declarations from previous block level */ - struct keyboard_parameters *pm = ¶m[l]; struct screen *sc = &screens[l]; + pm = ¶m[l]; sc->clear_display(); kbd_draw_picker(pm, sc, &state); kbd_draw_edit_line(pm, sc, &state); diff --git a/apps/tagcache.c b/apps/tagcache.c index 253e48a6dd..c5c40b9d50 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -4333,7 +4333,7 @@ static bool load_tagcache(void) unsigned int searchflag = auto_update ? DCS_STORAGE_PATH : DCS_CACHED_PATH; - int rc = dircache_search(searchflag | DCS_UPDATE_FILEREF, + rc = dircache_search(searchflag | DCS_UPDATE_FILEREF, &tcrc_dcfrefs[idx_id], filename); if (rc > 0) /* in cache and we have fileref */ idx->flag |= FLAG_DIRCACHE; diff --git a/apps/tagtree.c b/apps/tagtree.c index cad12e2a79..abb6cf5cb0 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -215,11 +215,11 @@ static int move_callback(int handle, void* current, void* new) /* loop over menus */ for(int i = 0; i < menu_count; i++) { - struct menu_root* menu = menus[i]; + struct menu_root* menuroot = menus[i]; /* then over the menu_entries of a menu */ - for(int j = 0; j < menu->itemcount; j++) + for(int j = 0; j < menuroot->itemcount; j++) { - struct menu_entry* mentry = menu->items[j]; + struct menu_entry* mentry = menuroot->items[j]; /* then over the search_instructions of each menu_entry */ for(int k = 0; k < mentry->si.tagorder_count; k++) { @@ -230,7 +230,7 @@ static int move_callback(int handle, void* current, void* new) UPDATE(mentry->si.clause[k][l], diff); } } - UPDATE(menu->items[j], diff); + UPDATE(menuroot->items[j], diff); } UPDATE(menus[i], diff); } diff --git a/apps/talk.c b/apps/talk.c index a7af58c273..65933c6895 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -987,7 +987,7 @@ static int _talk_file(const char* filename, return -1; if (talk_handle <= 0 || index_handle <= 0) { - int fd = open_voicefile(); + fd = open_voicefile(); if (fd < 0 || !load_voicefile_index(fd)) return load_voicefile_failure(fd); load_voicefile_data(fd); diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c index ae0fe519bc..44f62e4481 100644 --- a/firmware/drivers/lcd-color-common.c +++ b/firmware/drivers/lcd-color-common.c @@ -242,6 +242,8 @@ void lcd_blit_yuv(unsigned char * const src[3], int x, int y, int width, int height) { const unsigned char *ysrc, *usrc, *vsrc; + int cb, cr, rv, guv, bu, r, g, b; + int linecounter; fb_data *dst, *row_end; long z; @@ -272,8 +274,6 @@ void lcd_blit_yuv(unsigned char * const src[3], { do { - int y, cb, cr, rv, guv, bu, r, g, b; - y = YFAC*(*ysrc++ - 16); cb = *usrc++ - 128; cr = *vsrc++ - 128; @@ -337,8 +337,6 @@ void lcd_blit_yuv(unsigned char * const src[3], do { - int y, cb, cr, rv, guv, bu, r, g, b; - y = YFAC*(*ysrc++ - 16); cb = *usrc++ - 128; cr = *vsrc++ - 128;