mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-01-22 01:30:35 -05:00
fix yellow 2e9c2da
Eliminate static pointer Change-Id: Id26363771439dbd1f08c661ae2ff4277e0e8f288
This commit is contained in:
parent
2e9c2dafb2
commit
d395520cd0
1 changed files with 19 additions and 19 deletions
38
apps/menu.c
38
apps/menu.c
|
|
@ -67,8 +67,6 @@ static struct menu_item_ex *current_submenus_menu;
|
|||
static int current_subitems[MAX_MENU_SUBITEMS];
|
||||
static int current_subitems_count = 0;
|
||||
static int talk_menu_item(int selected_item, void *data);
|
||||
static char *title_buf;
|
||||
static size_t title_buf_sz;
|
||||
|
||||
struct menu_data_t
|
||||
{
|
||||
|
|
@ -200,7 +198,8 @@ static enum themable_icons menu_get_icon(int selected_item, void * data)
|
|||
return menu_icon;
|
||||
}
|
||||
|
||||
static char* init_title(const struct menu_item_ex *menu, int *icon)
|
||||
static char* init_title(const struct menu_item_ex *menu, int *icon,
|
||||
char* buf, size_t buf_sz)
|
||||
{
|
||||
char *title;
|
||||
|
||||
|
|
@ -214,7 +213,7 @@ static char* init_title(const struct menu_item_ex *menu, int *icon)
|
|||
*icon = menu->menu_get_name_and_icon->icon_id;
|
||||
title = menu->menu_get_name_and_icon->
|
||||
list_get_name(-1, menu->menu_get_name_and_icon->
|
||||
list_get_name_data, title_buf, title_buf_sz);
|
||||
list_get_name_data, buf, buf_sz);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -230,7 +229,7 @@ static char* init_title(const struct menu_item_ex *menu, int *icon)
|
|||
|
||||
static int init_menu_lists(const struct menu_item_ex *menu,
|
||||
struct gui_synclist *lists, int selected, bool callback,
|
||||
struct viewport parent[NB_SCREENS])
|
||||
struct viewport parent[NB_SCREENS], char* buf, size_t buf_sz)
|
||||
{
|
||||
if (!menu || !lists)
|
||||
{
|
||||
|
|
@ -267,7 +266,7 @@ static int init_menu_lists(const struct menu_item_ex *menu,
|
|||
current_submenus_menu = (struct menu_item_ex *)menu;
|
||||
|
||||
gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1, parent);
|
||||
title = init_title(menu, &icon);
|
||||
title = init_title(menu, &icon, buf, buf_sz);
|
||||
gui_synclist_set_title(lists, title, icon);
|
||||
gui_synclist_set_icon_callback(lists, global_settings.show_icons?menu_get_icon:NULL);
|
||||
if(global_settings.talk_menu)
|
||||
|
|
@ -410,9 +409,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
touchscreen_set_mode(global_settings.touch_mode);
|
||||
#endif
|
||||
|
||||
title_buf = buf;
|
||||
title_buf_sz = sizeof buf;
|
||||
title = init_title(menu, &icon);
|
||||
title = init_title(menu, &icon, buf, sizeof buf);
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
sb_set_persistent_title(title, icon, i);
|
||||
|
|
@ -428,7 +425,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
* this function, e.g. with viewport_set_defaults(parent, screen)
|
||||
* start_action allows an action to be processed
|
||||
* by menu logic by bypassing get_action on the initial run */
|
||||
start_action = init_menu_lists(menu, &lists, selected, true, parent);
|
||||
start_action = init_menu_lists(menu, &lists, selected, true, parent,
|
||||
buf, sizeof buf);
|
||||
vps = *(lists.parent);
|
||||
in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID);
|
||||
/* load the callback, and only reload it if menu changes */
|
||||
|
|
@ -489,7 +487,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
}
|
||||
}
|
||||
if (!done)
|
||||
init_menu_lists(menu, &lists, lists.selected_item, false, vps);
|
||||
init_menu_lists(menu, &lists, lists.selected_item, false, vps,
|
||||
buf, sizeof buf);
|
||||
redraw_lists = true;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -562,7 +561,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
}
|
||||
#endif
|
||||
int msel = do_menu(context_menu, NULL, NULL, false);
|
||||
title_buf = buf;
|
||||
|
||||
switch (msel)
|
||||
{
|
||||
|
|
@ -634,7 +632,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
if (!exiting_menu && (menu->flags&MENU_EXITAFTERTHISMENU))
|
||||
done = true;
|
||||
else
|
||||
init_menu_lists(menu, &lists, msel, false, vps);
|
||||
init_menu_lists(menu, &lists, msel, false, vps, buf, sizeof buf);
|
||||
redraw_lists = true;
|
||||
/* new menu, so reload the callback */
|
||||
get_menu_callback(menu, &menu_callback);
|
||||
|
|
@ -675,7 +673,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
mstack[stack_top].selected = selected;
|
||||
stack_top++;
|
||||
menu = temp;
|
||||
init_menu_lists(menu, &lists, 0, true, vps);
|
||||
init_menu_lists(menu, &lists, 0, true, vps, buf, sizeof buf);
|
||||
}
|
||||
break;
|
||||
case MT_FUNCTION_CALL_W_PARAM:
|
||||
|
|
@ -695,7 +693,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
(temp->flags&MENU_EXITAFTERTHISMENU))
|
||||
{
|
||||
/* Reload menu but don't run the calback again FS#8117 */
|
||||
init_menu_lists(menu, &lists, selected, false, vps);
|
||||
init_menu_lists(menu, &lists, selected, false, vps,
|
||||
buf, sizeof buf);
|
||||
}
|
||||
if (temp->flags&MENU_FUNC_CHECK_RETVAL)
|
||||
{
|
||||
|
|
@ -711,7 +710,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
case MT_SETTING_W_TEXT:
|
||||
{
|
||||
do_setting_from_menu(temp, vps);
|
||||
init_menu_lists(menu, &lists, selected, false, vps);
|
||||
init_menu_lists(menu, &lists, selected, false, vps, buf, sizeof buf);
|
||||
redraw_lists = true;
|
||||
|
||||
break;
|
||||
|
|
@ -728,7 +727,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
mstack[stack_top].selected = selected;
|
||||
stack_top++;
|
||||
menu = temp;
|
||||
init_menu_lists(menu,&lists,0,false, vps);
|
||||
init_menu_lists(menu, &lists, 0, false, vps, buf, sizeof buf);
|
||||
in_stringlist = true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -747,7 +746,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
menu_callback(ACTION_EXIT_MENUITEM, temp, &lists);
|
||||
}
|
||||
if (current_submenus_menu != menu)
|
||||
init_menu_lists(menu,&lists,selected,true,vps);
|
||||
init_menu_lists(menu, &lists,selected, true, vps, buf, sizeof buf);
|
||||
/* callback was changed, so reload the menu's callback */
|
||||
get_menu_callback(menu, &menu_callback);
|
||||
if ((menu->flags&MENU_EXITAFTERTHISMENU) &&
|
||||
|
|
@ -795,7 +794,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
if (stack_top > 0)
|
||||
{
|
||||
menu = mstack[0].menu;
|
||||
init_menu_lists(menu,&lists,mstack[0].selected,true, vps);
|
||||
init_menu_lists(menu, &lists, mstack[0].selected, true, vps,
|
||||
buf, sizeof buf);
|
||||
}
|
||||
*start_selected = get_menu_selection(
|
||||
gui_synclist_get_sel_pos(&lists), menu);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue