-Wshadow: lxdialog warning fixes
RFC PATCH 3/9 -Wshadow: lxdialog warning fixes
(please see the mail titled
"[RFC][PATCH 0/9] -Wshadow: Making the kernel build clean with -Wshadow" for an explanation of why I'm doing this)
Remove a bunch of -Wshadow warnings from scripts/kconfig/lxdialog/
This makes make menuconfig -Wshadow clean.
Signed-off-by Jesper Juhl <[email protected]>
---
scripts/kconfig/lxdialog/checklist.c | 70 ++++++++++----------- scripts/kconfig/lxdialog/dialog.h | 6 - scripts/kconfig/lxdialog/inputbox.c | 38 +++++------ scripts/kconfig/lxdialog/menubox.c | 82 ++++++++++++------------- scripts/kconfig/lxdialog/msgbox.c | 4 - scripts/kconfig/lxdialog/util.c | 20 +++--- 6 files changed, 110 insertions(+), 110 deletions(-)
scripts/kconfig/lxdialog/checklist.c +35 -35
@@ -56,12 +56,12 @@ static void print_item(WINDOW * win, con/* * Print the scroll indicators. */ -static void print_arrows (WINDOW * win,int choice,int item_no,int scroll, +static void print_arrows (WINDOW * win,int choice,int item_no,int scrolling,int y,int x,int height) {wmove (win, y, x); -if (scroll >0 ) { +if (scrolling >0 ) {wattrset (win, uarrow_attr);waddch (win,ACS_UARROW );waddstr (win,"(-)" );
@@ -76,7 +76,7 @@ static void print_arrows(WINDOW * win, i y = y + height +1 ;wmove (win, y, x); -if ((height < item_no) && (scroll + choice < item_no -1 )) { +if ((height < item_no) && (scrolling + choice < item_no -1 )) {wattrset (win, darrow_attr);waddch (win,ACS_DARROW );waddstr (win,"(+)" );
@@ -113,7 +113,7 @@ int dialog_checklist(const char *title, const char *const *items) {int i, x, y, box_x, box_y; -int key =0 , button =0 , choice =0 , scroll =0 , max_choice, *status; +int key =0 , button =0 , choice =0 , scrolling =0 , max_choice, *status;WINDOW *dialog, *list;/* Allocate space for storing item on/off status */
@@ -181,20 +181,20 @@ int dialog_checklist(const char *title, item_x = check_x +4 ;if (choice >= list_height) { - scroll = choice - list_height +1 ; - choice -= scroll; + scrolling = choice - list_height +1 ; + choice -= scrolling; }/* Print the list */ for (i =0 ; i < max_choice; i++) {if (i != choice) -print_item (list, items[(scroll + i) *3 +1 ], - status[i + scroll], i,0 ); +print_item (list, items[(scrolling + i) *3 +1 ], + status[i + scrolling], i,0 ); } -print_item (list, items[(scroll + choice) *3 +1 ], - status[choice + scroll], choice,1 ); +print_item (list, items[(scrolling + choice) *3 +1 ], + status[choice + scrolling], choice,1 ); -print_arrows (dialog, choice, item_no, scroll, +print_arrows (dialog, choice, item_no, scrolling, box_y, box_x + check_x +5 , list_height);print_buttons (dialog, height, width,0 );
@@ -208,28 +208,28 @@ int dialog_checklist(const char *title,for (i =0 ; i < max_choice; i++)if (toupper (key) == -toupper (items[(scroll + i) *3 +1 ][0 ])) +toupper (items[(scrolling + i) *3 +1 ][0 ]))break ;if (i < max_choice || key ==KEY_UP || key ==KEY_DOWN || key =='+' || key =='-' ) {if (key ==KEY_UP || key =='-' ) {if (!choice) { -if (!scroll) +if (!scrolling)continue ;/* Scroll list down */ if (list_height >1 ) {/* De-highlight current first item */ -print_item (list, items[scroll *3 +1 ], - status[scroll],0 , FALSE); +print_item (list, items[scrolling *3 +1 ], + status[scrolling],0 , FALSE);scrollok (list, TRUE);wscrl (list,-1 );scrollok (list, FALSE); } - scroll--; -print_item (list, items[scroll *3 +1 ], status[scroll],0 , TRUE); + scrolling--; +print_item (list, items[scrolling *3 +1 ], status[scrolling],0 , TRUE);print_arrows (dialog, choice, item_no, - scroll, box_y, box_x + check_x +5 , list_height); + scrolling, box_y, box_x + check_x +5 , list_height);wnoutrefresh (dialog);wrefresh (list);
@@ -239,24 +239,24 @@ int dialog_checklist(const char *title, i = choice -1 ; }else if (key ==KEY_DOWN || key =='+' ) {if (choice == max_choice -1 ) { -if (scroll + choice >= item_no -1 ) +if (scrolling + choice >= item_no -1 )continue ;/* Scroll list up */ if (list_height >1 ) {/* De-highlight current last item before scrolling up */ -print_item (list, items[(scroll + max_choice -1 ) *3 +1 ], - status[scroll + max_choice -1 ], +print_item (list, items[(scrolling + max_choice -1 ) *3 +1 ], + status[scrolling + max_choice -1 ], max_choice -1 , FALSE);scrollok (list, TRUE);wscrl (list,1 );scrollok (list, FALSE); } - scroll++; -print_item (list, items[(scroll + max_choice -1 ) *3 +1 ], - status[scroll + max_choice -1 ], max_choice -1 , TRUE); + scrolling++; +print_item (list, items[(scrolling + max_choice -1 ) *3 +1 ], + status[scrolling + max_choice -1 ], max_choice -1 , TRUE);print_arrows (dialog, choice, item_no, - scroll, box_y, box_x + check_x +5 , list_height); + scrolling, box_y, box_x + check_x +5 , list_height);wnoutrefresh (dialog);wrefresh (list);
@@ -267,12 +267,12 @@ int dialog_checklist(const char *title, }if (i != choice) {/* De-highlight current item */ -print_item (list, items[(scroll + choice) *3 +1 ], - status[scroll + choice], choice, FALSE); +print_item (list, items[(scrolling + choice) *3 +1 ], + status[scrolling + choice], choice, FALSE);/* Highlight new item */ choice = i; -print_item (list, items[(scroll + choice) *3 +1 ], - status[scroll + choice], choice, TRUE); +print_item (list, items[(scrolling + choice) *3 +1 ], + status[scrolling + choice], choice, TRUE);wnoutrefresh (dialog);wrefresh (list); }
@@ -282,7 +282,7 @@ int dialog_checklist(const char *title,case 'H' :case 'h' :case '?' : -fprintf (stderr,"%s" , items[(scroll + choice) *3 ]); +fprintf (stderr,"%s" , items[(scrolling + choice) *3 ]);delwin (dialog);free (status);return 1 ;
@@ -300,13 +300,13 @@ int dialog_checklist(const char *title,case ' ' :case '\n' :if (!button) { -if (!status[scroll + choice]) { +if (!status[scrolling + choice]) {for (i =0 ; i < item_no; i++) status[i] =0 ; - status[scroll + choice] =1 ; + status[scrolling + choice] =1 ;for (i =0 ; i < max_choice; i++) -print_item (list, items[(scroll + i) *3 +1 ], - status[scroll + i], i, i == choice); +print_item (list, items[(scrolling + i) *3 +1 ], + status[scrolling + i], i, i == choice); }wnoutrefresh (dialog);wrefresh (list);
@@ -315,7 +315,7 @@ int dialog_checklist(const char *title,if (status[i])fprintf (stderr,"%s" , items[i *3 ]); }else -fprintf (stderr,"%s" , items[(scroll + choice) *3 ]); +fprintf (stderr,"%s" , items[(scrolling + choice) *3 ]);delwin (dialog);free (status);return button;
scripts/kconfig/lxdialog/dialog.h +3 -3
@@ -146,14 +146,14 @@ void color_setup(void);void print_autowrap (WINDOW * win,const char *prompt,int width,int y,int x);void print_button (WINDOW * win,const char *label,int y,int x,int selected);void print_title (WINDOW *dialog,const char *title,int width); -void draw_box (WINDOW * win,int y,int x,int height,int width,chtype box, -chtype border); +void draw_box (WINDOW * win,int y,int x,int height,int width,chtype the_box, +chtype the_border);void draw_shadow (WINDOW * win,int y,int x,int height,int width);int first_alpha (const char *string,const char *exempt);int dialog_yesno (const char *title,const char *prompt,int height,int width);int dialog_msgbox (const char *title,const char *prompt,int height, -int width,int pause); +int width,int delay);int dialog_textbox (const char *title,const char *file,int height,int width); int dialog_menu(const char *title, const char *prompt, int height, int width, int menu_height, const char *choice, int item_no,
scripts/kconfig/lxdialog/inputbox.c +19 -19
@@ -45,8 +45,8 @@ int dialog_inputbox(const char *title, c const char *init) {int i, x, y, box_y, box_x, box_width; -int input_x =0 , scroll =0 , key =0 , button =-1 ; -char *instr = dialog_input_result; +int input_x =0 , scrolling =0 , key =0 , button =-1 ; +char *in_str = dialog_input_result;WINDOW *dialog;/* center dialog box on screen */
@@ -85,19 +85,19 @@ int dialog_inputbox(const char *title, cwattrset (dialog, inputbox_attr);if (!init) - instr[0 ] ='\0' ; + in_str[0 ] ='\0' ;else -strcpy (instr, init); +strcpy (in_str, init); - input_x =strlen (instr); + input_x =strlen (in_str);if (input_x >= box_width) { - scroll = input_x - box_width +1 ; + scrolling = input_x - box_width +1 ; input_x = box_width -1 ;for (i =0 ; i < box_width -1 ; i++) -waddch (dialog, instr[scroll + i]); +waddch (dialog, in_str[scrolling + i]); }else { -waddstr (dialog, instr); +waddstr (dialog, in_str); }wmove (dialog, box_y, box_x + input_x);
@@ -119,19 +119,19 @@ int dialog_inputbox(const char *title, ccontinue ;case KEY_BACKSPACE :case 127 : -if (input_x || scroll) { +if (input_x || scrolling) {wattrset (dialog, inputbox_attr);if (!input_x) { - scroll = scroll < box_width -1 ?0 : scroll - (box_width -1 ); + scrolling = scrolling < box_width -1 ?0 : scrolling - (box_width -1 );wmove (dialog, box_y, box_x);for (i =0 ; i < box_width; i++)waddch (dialog, - instr[scroll + input_x + i] ? - instr[scroll + input_x + i] :' ' ); - input_x =strlen (instr) - scroll; + in_str[scrolling + input_x + i] ? + in_str[scrolling + input_x + i] :' ' ); + input_x =strlen (in_str) - scrolling; }else input_x--; - instr[scroll + input_x] ='\0' ; + in_str[scrolling + input_x] ='\0' ;mvwaddch (dialog, box_y, input_x + box_x,' ' );wmove (dialog, box_y, input_x + box_x);wrefresh (dialog);
@@ -139,15 +139,15 @@ int dialog_inputbox(const char *title, ccontinue ;default :if (key <0x100 &&isprint (key)) { -if (scroll + input_x <MAX_LEN ) { +if (scrolling + input_x <MAX_LEN ) {wattrset (dialog, inputbox_attr); - instr[scroll + input_x] = key; - instr[scroll + input_x +1 ] ='\0' ; + in_str[scrolling + input_x] = key; + in_str[scrolling + input_x +1 ] ='\0' ;if (input_x == box_width -1 ) { - scroll++; + scrolling++;wmove (dialog, box_y, box_x);for (i =0 ; i < box_width -1 ; i++) -waddch (dialog, instr [scroll + i]); +waddch (dialog, in_str[scrolling + i]); }else {wmove (dialog, box_y, input_x++ + box_x);waddch (dialog, key);
scripts/kconfig/lxdialog/menubox.c +41 -41
196 lines not on this page · raw message
scripts/kconfig/lxdialog/msgbox.c +2 -2
@@ -26,7 +26,7 @@* if the parameter 'pause' is non-zero. */ int dialog_msgbox (const char *title,const char *prompt,int height,int width, -int pause) +int delay) {int i, x, y, key =0 ;WINDOW *dialog;
@@ -47,7 +47,7 @@ int dialog_msgbox(const char *title, conwattrset (dialog, dialog_attr);print_autowrap (dialog, prompt, width -2 ,1 ,2 ); -if (pause) { +if (delay) {wattrset (dialog, border_attr);mvwaddch (dialog, height -3 ,0 ,ACS_LTEE );for (i =0 ; i < width -2 ; i++)
scripts/kconfig/lxdialog/util.c +10 -10
@@ -288,7 +288,7 @@ void print_button(WINDOW * win, const ch*/ void draw_box (WINDOW * win,int y,int x,int height,int width, -chtype box,chtype border) +chtype the_box,chtype the_border) {int i, j;
@@ -297,23 +297,23 @@ draw_box(WINDOW * win, int y, int x, intwmove (win, y + i, x);for (j =0 ; j < width; j++)if (!i && !j) -waddch (win, border |ACS_ULCORNER ); +waddch (win, the_border |ACS_ULCORNER );else if (i == height -1 && !j) -waddch (win, border |ACS_LLCORNER ); +waddch (win, the_border |ACS_LLCORNER );else if (!i && j == width -1 ) -waddch (win, box |ACS_URCORNER ); +waddch (win, the_box |ACS_URCORNER );else if (i == height -1 && j == width -1 ) -waddch (win, box |ACS_LRCORNER ); +waddch (win, the_box |ACS_LRCORNER );else if (!i) -waddch (win, border |ACS_HLINE ); +waddch (win, the_border |ACS_HLINE );else if (i == height -1 ) -waddch (win, box |ACS_HLINE ); +waddch (win, the_box |ACS_HLINE );else if (!j) -waddch (win, border |ACS_VLINE ); +waddch (win, the_border |ACS_VLINE );else if (j == width -1 ) -waddch (win, box |ACS_VLINE ); +waddch (win, the_box |ACS_VLINE );else -waddch (win, box |' ' ); +waddch (win, the_box |' ' ); } }