From 0942e2a0f71d809c1d7f2606cbddfa1d4beacb87 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Sat, 15 Oct 2011 19:35:02 +0000 Subject: Changed the FOR_NB_SCREENS macro to always be a for loop that declares its own loop variable. This removes the need to declare this variable in the outer scope. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30756 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/bitmap/list.c | 1 - apps/gui/charcell/list.c | 1 - apps/gui/color_picker.c | 1 - apps/gui/list.c | 18 ++++-------------- apps/gui/pitchscreen.c | 2 +- apps/gui/quickscreen.c | 4 ++-- apps/gui/skin_engine/skin_backdrops.c | 7 ++----- apps/gui/skin_engine/skin_display.c | 1 - apps/gui/skin_engine/skin_engine.c | 7 +++---- apps/gui/splash.c | 1 - apps/gui/statusbar-skinned.c | 1 - apps/gui/statusbar.c | 2 -- apps/gui/usb_screen.c | 2 -- apps/gui/viewport.c | 4 ---- apps/gui/wps.c | 6 ------ apps/gui/yesno.c | 2 -- 16 files changed, 12 insertions(+), 48 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index b4ecd79c40..69cda9fa85 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c @@ -68,7 +68,6 @@ bool list_display_title(struct gui_synclist *list, enum screen_type screen); void gui_synclist_scroll_stop(struct gui_synclist *lists) { - int i; FOR_NB_SCREENS(i) { screens[i].scroll_stop(&list_text[i]); diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c index 15112adb51..3d7f876adc 100644 --- a/apps/gui/charcell/list.c +++ b/apps/gui/charcell/list.c @@ -40,7 +40,6 @@ void gui_synclist_scroll_stop(struct gui_synclist *lists) { - int i; (void)lists; FOR_NB_SCREENS(i) { diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index 044edd7789..907b1744c5 100644 --- a/apps/gui/color_picker.c +++ b/apps/gui/color_picker.c @@ -420,7 +420,6 @@ bool set_color(struct screen *display, char *title, } else { - int i; FOR_NB_SCREENS(i) draw_screen(&screens[i], title, &rgb, slider); } diff --git a/apps/gui/list.c b/apps/gui/list.c index e42cbb8e64..1a90ff9e40 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -80,7 +80,7 @@ void list_init(void) static void list_init_viewports(struct gui_synclist *list) { - int i, parent_used; + int parent_used; parent_used = (*list->parent != &parent[SCREEN_MAIN]); @@ -156,7 +156,6 @@ void gui_synclist_init(struct gui_synclist * gui_list, int selected_size, struct viewport list_parent[NB_SCREENS] ) { - int i; gui_list->callback_get_item_icon = NULL; gui_list->callback_get_item_name = callback_get_item_name; gui_list->callback_speak_item = NULL; @@ -237,7 +236,6 @@ int gui_list_get_item_offset(struct gui_synclist * gui_list, */ void gui_synclist_draw(struct gui_synclist *gui_list) { - int i; if (list_is_dirty(gui_list)) { list_init_viewports(gui_list); @@ -345,7 +343,6 @@ void gui_synclist_speak_item(struct gui_synclist *lists) */ void gui_synclist_select_item(struct gui_synclist * gui_list, int item_number) { - int i; if (item_number >= gui_list->nb_items || item_number < 0) return; if (item_number != gui_list->selected_item) @@ -380,13 +377,12 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list, } else if (gui_list->show_selection_marker == false) { - int i, nb_lines, screen_top; FOR_NB_SCREENS(i) { - nb_lines = list_get_nb_lines(gui_list, i); + int nb_lines = list_get_nb_lines(gui_list, i); if (offset > 0) { - screen_top = MAX(0, gui_list->nb_items - nb_lines); + int screen_top = MAX(0, gui_list->nb_items - nb_lines); gui_list->start_item[i] = MIN(screen_top, gui_list->start_item[i] + gui_list->selected_size); gui_list->selected_item = gui_list->start_item[i]; @@ -452,7 +448,6 @@ void gui_synclist_set_title(struct gui_synclist * gui_list, gui_list->title = title; gui_list->title_icon = icon; #ifdef HAVE_LCD_BITMAP - int i; FOR_NB_SCREENS(i) sb_set_title_text(title, icon, i); #endif @@ -461,9 +456,6 @@ void gui_synclist_set_title(struct gui_synclist * gui_list, void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items) { -#ifdef HAVE_LCD_BITMAP - int i; -#endif lists->nb_items = nb_items; #ifdef HAVE_LCD_BITMAP FOR_NB_SCREENS(i) @@ -531,7 +523,6 @@ void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll) */ static void gui_synclist_scroll_right(struct gui_synclist * lists) { - int i; FOR_NB_SCREENS(i) { /* FIXME: This is a fake right boundry limiter. there should be some @@ -549,7 +540,6 @@ static void gui_synclist_scroll_right(struct gui_synclist * lists) */ static void gui_synclist_scroll_left(struct gui_synclist * lists) { - int i; FOR_NB_SCREENS(i) { lists->offset_position[i] -= offset_step; @@ -817,7 +807,7 @@ static const char* simplelist_static_getname(int item, bool simplelist_show_list(struct simplelist_info *info) { struct gui_synclist lists; - int action, old_line_count = simplelist_line_count, i; + int action, old_line_count = simplelist_line_count; list_get_name *getname; int wrap = LIST_WRAP_UNLESS_HELD; if (info->get_name) diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index 421ec04676..13da415505 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c @@ -733,7 +733,7 @@ static int pitchscreen_do_touchscreen(struct viewport vps[]) int gui_syncpitchscreen_run(void) { - int button, i; + int button; int32_t pitch = sound_get_pitch(); int32_t semitone; diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index e97d82196d..acef2c32a0 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -307,7 +307,7 @@ static int quickscreen_touchscreen_button(const struct viewport static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) { - int button, i, j; + int button; struct viewport parent[NB_SCREENS]; struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT]; struct viewport vp_icons[NB_SCREENS]; @@ -367,7 +367,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente cond_talk_ids_fq(VOICE_OK); FOR_NB_SCREENS(i) { /* stop scrolling before exiting */ - for (j = 0; j < QUICKSCREEN_ITEM_COUNT; j++) + for (int j = 0; j < QUICKSCREEN_ITEM_COUNT; j++) screens[i].scroll_stop(&vps[i][j]); viewportmanager_theme_undo(i, true); } diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c index 4701f51b19..5d98e29128 100644 --- a/apps/gui/skin_engine/skin_backdrops.c +++ b/apps/gui/skin_engine/skin_backdrops.c @@ -46,10 +46,9 @@ static int current_lcd_backdrop[NB_SCREENS]; static int buflib_move_callback(int handle, void* current, void* new) { - int i; if (handle == handle_being_loaded) return BUFLIB_CB_CANNOT_MOVE; - for (i=0; istatusbars[i]) ); gui_statusbar_set_screen( &(bars->statusbars[i]), &(screens[i]) ); @@ -818,7 +817,6 @@ void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, #ifdef HAVE_LCD_BITMAP if(!global_settings.statusbar) return; - int i; struct viewport viewport; FOR_NB_SCREENS(i) { GET_RECT(viewport,statusbar_position(i),&screens[i]); diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c index 1d9fcec6e4..06770b1b94 100644 --- a/apps/gui/usb_screen.c +++ b/apps/gui/usb_screen.c @@ -184,7 +184,6 @@ static void usb_screen_fix_viewports(struct screen *screen, static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar) { - int i; FOR_NB_SCREENS(i) { struct screen *screen = &screens[i]; @@ -242,7 +241,6 @@ static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar) void gui_usb_screen_run(bool early_usb) { - int i; struct usb_screen_vps_t usb_screen_vps_ar[NB_SCREENS]; #if defined HAVE_TOUCHSCREEN enum touchscreen_mode old_mode = touchscreen_get_mode(); diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index df8093d581..2ab6c343ef 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -104,7 +104,6 @@ static void toggle_theme(enum screen_type screen, bool force) bool enable_event = false; static bool was_enabled[NB_SCREENS] = {false}; static bool after_boot[NB_SCREENS] = {false}; - int i; FOR_NB_SCREENS(i) { @@ -233,7 +232,6 @@ int viewport_get_nb_lines(const struct viewport *vp) static void viewportmanager_redraw(void* data) { - int i; FOR_NB_SCREENS(i) { #ifdef HAVE_LCD_BITMAP @@ -249,7 +247,6 @@ static void viewportmanager_redraw(void* data) void viewportmanager_init() { #ifdef HAVE_LCD_BITMAP - int i; FOR_NB_SCREENS(i) { theme_stack_top[i] = -1; /* the next call fixes this to 0 */ @@ -264,7 +261,6 @@ void viewportmanager_init() #ifdef HAVE_LCD_BITMAP void viewportmanager_theme_changed(const int which) { - int i; #ifdef HAVE_BUTTONBAR if (which & THEME_BUTTONBAR) { /* don't handle further, the custom ui viewport ignores the buttonbar, diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 4d56062c8d..6486e42fbb 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -120,7 +120,6 @@ char* wps_default_skin(enum screen_type screen) static void update_non_static(void) { - int i; FOR_NB_SCREENS(i) skin_update(WPS, i, SKIN_REFRESH_NON_STATIC); } @@ -306,7 +305,6 @@ bool ffwd_rew(int button) int direction = -1; /* forward=1 or backward=-1 */ bool exit = false; bool usb = false; - int i = 0; const long ff_rw_accel = (global_settings.ff_rewind_accel + 3); if (button == ACTION_NONE) @@ -630,8 +628,6 @@ static void wps_lcd_activation_hook(void *param) static void gwps_leave_wps(void) { - int i; - FOR_NB_SCREENS(i) { skin_get_gwps(WPS, i)->display->stop_scroll(); @@ -657,7 +653,6 @@ static void gwps_leave_wps(void) * display the wps on entering or restoring */ static void gwps_enter_wps(void) { - int i; struct gui_wps *gwps; struct screen *display; FOR_NB_SCREENS(i) @@ -738,7 +733,6 @@ long gui_wps_show(void) bool bookmark = false; bool update = false; bool vol_changed = false; - int i; long last_left = 0, last_right = 0; struct wps_state *state = skin_get_global_state(); diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 5354aa526b..e89e45ae95 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c @@ -147,7 +147,6 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, const struct text_message * yes_message, const struct text_message * no_message) { - int i; int button; int result=-1; bool result_displayed; @@ -239,7 +238,6 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, This function needs the output text as an argument. */ bool yesno_pop(const char* text) { - int i; const char *lines[]={text}; const struct text_message message={lines, 1}; bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES); -- cgit v1.2.3