mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 20:55:17 -05:00
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
This commit is contained in:
parent
f301ac05f9
commit
0942e2a0f7
59 changed files with 47 additions and 143 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
void gui_synclist_scroll_stop(struct gui_synclist *lists)
|
||||
{
|
||||
int i;
|
||||
(void)lists;
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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). */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue