summaryrefslogtreecommitdiffstats
path: root/apps/gui
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2011-10-15 19:35:02 +0000
committerBjörn Stenberg <bjorn@haxx.se>2011-10-15 19:35:02 +0000
commit0942e2a0f71d809c1d7f2606cbddfa1d4beacb87 (patch)
treece2fbdea468cb8223598c546fee765a10660a0b0 /apps/gui
parentf301ac05f9dd6ace2355fa822bd61d454c2c4f28 (diff)
downloadrockbox-0942e2a0f71d809c1d7f2606cbddfa1d4beacb87.tar.gz
rockbox-0942e2a0f71d809c1d7f2606cbddfa1d4beacb87.zip
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
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/bitmap/list.c1
-rw-r--r--apps/gui/charcell/list.c1
-rw-r--r--apps/gui/color_picker.c1
-rw-r--r--apps/gui/list.c18
-rw-r--r--apps/gui/pitchscreen.c2
-rw-r--r--apps/gui/quickscreen.c4
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c7
-rw-r--r--apps/gui/skin_engine/skin_display.c1
-rw-r--r--apps/gui/skin_engine/skin_engine.c7
-rw-r--r--apps/gui/splash.c1
-rw-r--r--apps/gui/statusbar-skinned.c1
-rw-r--r--apps/gui/statusbar.c2
-rw-r--r--apps/gui/usb_screen.c2
-rw-r--r--apps/gui/viewport.c4
-rw-r--r--apps/gui/wps.c6
-rw-r--r--apps/gui/yesno.c2
16 files changed, 12 insertions, 48 deletions
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; i<NB_BDROPS; i++)
+ for (int i=0; i<NB_BDROPS; i++)
{
if (backdrops[i].buffer == current)
{
@@ -65,9 +64,7 @@ static struct buflib_callbacks buflib_ops = {buflib_move_callback, NULL};
static bool first_go = true;
void skin_backdrop_init(void)
{
- int i;
-
- for (i=0; i<NB_BDROPS; i++)
+ for (int i=0; i<NB_BDROPS; i++)
{
if (first_go)
backdrops[i].buflib_handle = -1;
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index f7a0888afc..95e4310de9 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -692,7 +692,6 @@ int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout)
(void)skin; /* silence charcell warning */
int button = ACTION_NONE;
#ifdef HAVE_LCD_BITMAP
- int i;
/* when the peak meter is enabled we want to have a
few extra updates to make it look smooth. On the
other hand we don't want to waste energy if it
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c
index 03afbc5195..bd875fe9e4 100644
--- a/apps/gui/skin_engine/skin_engine.c
+++ b/apps/gui/skin_engine/skin_engine.c
@@ -84,7 +84,7 @@ static struct gui_skin {
void gui_sync_skin_init(void)
{
- int i, j;
+ int j;
for(j=0; j<SKINNABLE_SCREENS_COUNT; j++)
{
FOR_NB_SCREENS(i)
@@ -105,7 +105,7 @@ void gui_sync_skin_init(void)
void skin_unload_all(void)
{
- int i, j;
+ int j;
for(j=0; j<SKINNABLE_SCREENS_COUNT; j++)
{
@@ -123,7 +123,7 @@ void skin_unload_all(void)
void settings_apply_skins(void)
{
- int i, j;
+ int i;
skin_unload_all();
/* Make sure each skin is loaded */
@@ -267,7 +267,6 @@ bool skin_do_full_update(enum skinnable_screens skin,
/* tell a skin to do a full update next time */
void skin_request_full_update(enum skinnable_screens skin)
{
- int i;
FOR_NB_SCREENS(i)
skins[skin][i].needs_full_update = true;
}
diff --git a/apps/gui/splash.c b/apps/gui/splash.c
index 4ce751ca74..ad6625fec6 100644
--- a/apps/gui/splash.c
+++ b/apps/gui/splash.c
@@ -200,7 +200,6 @@ end:
void splashf(int ticks, const char *fmt, ...)
{
va_list ap;
- int i;
/* If fmt is a lang ID then get the corresponding string (which
still might contain % place holders). */
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index ad9a391e4c..7850e7cc27 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -268,7 +268,6 @@ char* sb_create_from_settings(enum screen_type screen)
void sb_skin_init(void)
{
- int i;
FOR_NB_SCREENS(i)
{
oldinfovp_label[i] = NULL;
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index d2b7f500b1..84de16987f 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -805,7 +805,6 @@ static void gui_statusbar_icon_recording_info(struct screen * display)
void gui_syncstatusbar_init(struct gui_syncstatusbar * bars)
{
- int i;
FOR_NB_SCREENS(i) {
gui_statusbar_init( &(bars->statusbars[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);