Fix menu warnings

change offending bool return to int

warning: cast between incompatible function types from
'_Bool (*)(void)' to 'int (*)(void)' [-Wcast-function-type]

forgot to remove -- typedef int (*menu_function)(void);

Change-Id: Ie4c8d3ddb0fb7843c4ec584203350d658d6bee3e
This commit is contained in:
William Wilgus 2018-10-15 23:04:04 -04:00
parent e6b23a8f04
commit dd40c46d50
23 changed files with 62 additions and 58 deletions

View File

@ -50,7 +50,7 @@ static void speak_time(int hours, int minutes, bool speak_hours, bool enqueue)
} }
} }
bool alarm_screen(void) int alarm_screen(void)
{ {
int h, m; int h, m;
bool done = false; bool done = false;
@ -188,10 +188,10 @@ bool alarm_screen(void)
if(default_event_handler(button) == SYS_USB_CONNECTED) if(default_event_handler(button) == SYS_USB_CONNECTED)
{ {
rtc_enable_alarm(false); rtc_enable_alarm(false);
return true; return 1;
} }
break; break;
} }
} }
return false; return 0;
} }

View File

@ -21,6 +21,6 @@
#ifndef _ALARM_MENU_H #ifndef _ALARM_MENU_H
#define _ALARM_MENU_H #define _ALARM_MENU_H
bool alarm_screen(void); int alarm_screen(void);
#endif #endif

View File

@ -2708,14 +2708,14 @@ static const char* menu_get_name(int item, void * data,
return menuitems[item].desc; return menuitems[item].desc;
} }
bool debug_menu(void) int debug_menu(void)
{ {
struct simplelist_info info; struct simplelist_info info;
simplelist_info_init(&info, "Debug Menu", ARRAYLEN(menuitems), NULL); simplelist_info_init(&info, "Debug Menu", ARRAYLEN(menuitems), NULL);
info.action_callback = menu_action_callback; info.action_callback = menu_action_callback;
info.get_name = menu_get_name; info.get_name = menu_get_name;
return simplelist_show_list(&info); return (simplelist_show_list(&info)) ? 1 : 0;
} }
bool run_debug_screen(char* screen) bool run_debug_screen(char* screen)

View File

@ -21,7 +21,7 @@
#ifndef _DEBUG_MENU_H #ifndef _DEBUG_MENU_H
#define _DEBUG_MENU_H #define _DEBUG_MENU_H
bool debug_menu(void); int debug_menu(void);
bool run_debug_screen(char* screen); bool run_debug_screen(char* screen);
#endif #endif

View File

@ -440,7 +440,7 @@ void enc_global_settings_apply(void)
/* Show an encoder's config menu based on the global_settings. /* Show an encoder's config menu based on the global_settings.
Modified settings are placed in global_settings.enc_config. */ Modified settings are placed in global_settings.enc_config. */
bool enc_global_config_menu(void) int enc_global_config_menu(void)
{ {
struct encoder_config cfg; struct encoder_config cfg;
@ -453,12 +453,12 @@ bool enc_global_config_menu(void)
{ {
menu_callback_data.cfg = &cfg; menu_callback_data.cfg = &cfg;
menu_callback_data.global = true; menu_callback_data.global = true;
return do_menu(enc_data[cfg.rec_format].menu, NULL, NULL, false) int retmenu = do_menu(enc_data[cfg.rec_format].menu, NULL, NULL, false);
== MENU_ATTACHED_USB; return (retmenu == MENU_ATTACHED_USB) ? 1 : 0;
} }
else else
{ {
splash(HZ, ID2P(LANG_NO_SETTINGS)); splash(HZ, ID2P(LANG_NO_SETTINGS));
return false; return 0;
} }
} /* enc_global_config_menu */ } /* enc_global_config_menu */

View File

@ -71,5 +71,5 @@ void enc_global_settings_apply(void);
/* Show an encoder's config menu based on the global_settings. /* Show an encoder's config menu based on the global_settings.
Modified settings are placed in global_settings.enc_config. */ Modified settings are placed in global_settings.enc_config. */
bool enc_global_config_menu(void); int enc_global_config_menu(void);
#endif /* ENC_CONFIG_H */ #endif /* ENC_CONFIG_H */

View File

@ -41,7 +41,6 @@ enum menu_item_type {
}; };
#define MENU_TYPE_MASK 0xF /* MT_* type */ #define MENU_TYPE_MASK 0xF /* MT_* type */
typedef int (*menu_function)(void);
struct menu_func { struct menu_func {
union { union {
int (*function_w_param)(void* param); /* intptr_t instead of void* int (*function_w_param)(void* param); /* intptr_t instead of void*

View File

@ -563,7 +563,7 @@ static void draw_eq_sliders(struct screen * screen, int x, int y,
} }
/* Provides a graphical means of editing the EQ settings */ /* Provides a graphical means of editing the EQ settings */
bool eq_menu_graphical(void) int eq_menu_graphical(void)
{ {
bool exit_request = false; bool exit_request = false;
bool result = true; bool result = true;
@ -753,10 +753,10 @@ bool eq_menu_graphical(void)
screens[i].set_viewport(NULL); screens[i].set_viewport(NULL);
viewportmanager_theme_undo(i, false); viewportmanager_theme_undo(i, false);
} }
return result; return (result) ? 1 : 0;
} }
static bool eq_save_preset(void) static int eq_save_preset(void)
{ {
/* make sure that the eq is enabled for setting saving */ /* make sure that the eq is enabled for setting saving */
bool enabled = global_settings.eq_enabled; bool enabled = global_settings.eq_enabled;
@ -766,16 +766,16 @@ static bool eq_save_preset(void)
global_settings.eq_enabled = enabled; global_settings.eq_enabled = enabled;
return result; return (result) ? 1 : 0;
} }
/* Allows browsing of preset files */ /* Allows browsing of preset files */
static struct browse_folder_info eqs = { EQS_DIR, SHOW_CFG }; static struct browse_folder_info eqs = { EQS_DIR, SHOW_CFG };
MENUITEM_FUNCTION(eq_graphical, 0, ID2P(LANG_EQUALIZER_GRAPHICAL), MENUITEM_FUNCTION(eq_graphical, 0, ID2P(LANG_EQUALIZER_GRAPHICAL),
(int(*)(void))eq_menu_graphical, NULL, lowlatency_callback, eq_menu_graphical, NULL, lowlatency_callback,
Icon_EQ); Icon_EQ);
MENUITEM_FUNCTION(eq_save, 0, ID2P(LANG_EQUALIZER_SAVE), MENUITEM_FUNCTION(eq_save, 0, ID2P(LANG_EQUALIZER_SAVE),
(int(*)(void))eq_save_preset, NULL, NULL, Icon_NOICON); eq_save_preset, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(eq_browse, MENU_FUNC_USEPARAM, ID2P(LANG_EQUALIZER_BROWSE), MENUITEM_FUNCTION(eq_browse, MENU_FUNC_USEPARAM, ID2P(LANG_EQUALIZER_BROWSE),
browse_folder, (void*)&eqs, lowlatency_callback, browse_folder, (void*)&eqs, lowlatency_callback,
Icon_NOICON); Icon_NOICON);

View File

@ -40,7 +40,7 @@
#define EQ_USER_DIVISOR 10 #define EQ_USER_DIVISOR 10
bool eq_browse_presets(void); bool eq_browse_presets(void);
bool eq_menu_graphical(void); int eq_menu_graphical(void);
/* utility functions for settings_list.c */ /* utility functions for settings_list.c */
const char* eq_q_format(char* buffer, size_t buffer_size, int value, const char* eq_q_format(char* buffer, size_t buffer_size, int value,

View File

@ -111,7 +111,7 @@ MAKE_MENU(manage_settings, ID2P(LANG_MANAGE_MENU), NULL, Icon_Config,
/* INFO MENU */ /* INFO MENU */
static bool show_credits(void) static int show_credits(void)
{ {
char credits[MAX_PATH] = { '\0' }; char credits[MAX_PATH] = { '\0' };
snprintf(credits, MAX_PATH, "%s/credits.rock", VIEWERS_DIR); snprintf(credits, MAX_PATH, "%s/credits.rock", VIEWERS_DIR);
@ -122,7 +122,7 @@ static bool show_credits(void)
while (IS_SYSEVENT(get_action(CONTEXT_STD, TIMEOUT_BLOCK))) while (IS_SYSEVENT(get_action(CONTEXT_STD, TIMEOUT_BLOCK)))
; ;
} }
return false; return 0;
} }
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
@ -357,7 +357,7 @@ static int info_action_callback(int action, struct gui_synclist *lists)
} }
return action; return action;
} }
static bool show_info(void) static int show_info(void)
{ {
struct info_data data = {.new_data = true }; struct info_data data = {.new_data = true };
struct simplelist_info info; struct simplelist_info info;
@ -369,10 +369,12 @@ static bool show_info(void)
if(global_settings.talk_menu) if(global_settings.talk_menu)
info.get_talk = info_speak_item; info.get_talk = info_speak_item;
info.action_callback = info_action_callback; info.action_callback = info_action_callback;
return simplelist_show_list(&info); return (simplelist_show_list(&info)) ? 1 : 0;
} }
MENUITEM_FUNCTION(show_info_item, 0, ID2P(LANG_ROCKBOX_INFO), MENUITEM_FUNCTION(show_info_item, 0, ID2P(LANG_ROCKBOX_INFO),
(menu_function)show_info, NULL, NULL, Icon_NOICON); show_info, NULL, NULL, Icon_NOICON);
#if CONFIG_RTC #if CONFIG_RTC
int time_screen(void* ignored); int time_screen(void* ignored);
@ -381,11 +383,13 @@ MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU),
#endif #endif
MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_CREDITS), MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_CREDITS),
(menu_function)show_credits, NULL, NULL, Icon_NOICON); show_credits, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(show_runtime_item, 0, ID2P(LANG_RUNNING_TIME), MENUITEM_FUNCTION(show_runtime_item, 0, ID2P(LANG_RUNNING_TIME),
(menu_function)view_runtime, NULL, NULL, Icon_NOICON); view_runtime, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(debug_menu_item, 0, ID2P(LANG_DEBUG), MENUITEM_FUNCTION(debug_menu_item, 0, ID2P(LANG_DEBUG),
(menu_function)debug_menu, NULL, NULL, Icon_NOICON); debug_menu, NULL, NULL, Icon_NOICON);
MAKE_MENU(info_menu, ID2P(LANG_SYSTEM), 0, Icon_System_menu, MAKE_MENU(info_menu, ID2P(LANG_SYSTEM), 0, Icon_System_menu,
&show_info_item, &show_credits_item, &show_info_item, &show_credits_item,

View File

@ -75,15 +75,13 @@ static int playlist_view_(void)
playlist_viewer_ex(NULL); playlist_viewer_ex(NULL);
return 0; return 0;
} }
MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST), MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST),
(int(*)(void))create_playlist, NULL, NULL, Icon_NOICON); create_playlist, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(view_cur_playlist, 0, MENUITEM_FUNCTION(view_cur_playlist, 0,
ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
(int(*)(void))playlist_view_, NULL, NULL, Icon_NOICON); playlist_view_, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
(int(*)(void*))save_playlist_screen, save_playlist_screen, NULL, NULL, Icon_NOICON);
NULL, NULL, Icon_NOICON);
MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL); MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL); MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
static int clear_catalog_directory(void) static int clear_catalog_directory(void)

View File

@ -59,7 +59,7 @@ MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING),
#define FM_RECORDING_SETTINGS #define FM_RECORDING_SETTINGS
static int fm_recording_settings(void) static int fm_recording_settings(void)
{ {
bool ret = recording_menu(true); int ret = recording_menu(true);
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
if (!ret) if (!ret)

View File

@ -307,7 +307,7 @@ MENUITEM_FUNCTION(recformat, 0, ID2P(LANG_RECORDING_FORMAT),
recformat_func, NULL, NULL, Icon_Menu_setting); recformat_func, NULL, NULL, Icon_Menu_setting);
MENUITEM_FUNCTION(enc_global_config_menu_item, 0, ID2P(LANG_ENCODER_SETTINGS), MENUITEM_FUNCTION(enc_global_config_menu_item, 0, ID2P(LANG_ENCODER_SETTINGS),
(int(*)(void))enc_global_config_menu, enc_global_config_menu,
NULL, NULL, Icon_Submenu); NULL, NULL, Icon_Submenu);
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
@ -651,14 +651,15 @@ MAKE_MENU(recording_settings_menu, ID2P(LANG_RECORDING_SETTINGS),
&browse_recconfigs, &save_recpresets_item &browse_recconfigs, &save_recpresets_item
); );
bool recording_menu(bool no_source) int recording_menu(bool no_source)
{ {
bool retval; int retval;
no_source_in_menu = no_source; no_source_in_menu = no_source;
retval = do_menu(&recording_settings_menu, NULL, NULL, false) == MENU_ATTACHED_USB; int retmenu = do_menu(&recording_settings_menu, NULL, NULL, false);
retval = (retmenu == MENU_ATTACHED_USB) ? 1 : 0;
no_source_in_menu = false; /* always fall back to the default */ no_source_in_menu = false; /* always fall back to the default */
return retval; return retval;
}; };
MENUITEM_FUNCTION(recording_settings, MENU_FUNC_USEPARAM, ID2P(LANG_RECORDING_SETTINGS), MENUITEM_FUNCTION(recording_settings, MENU_FUNC_USEPARAM, ID2P(LANG_RECORDING_SETTINGS),
(int (*)(void*))recording_menu, 0, NULL, Icon_Recording); recording_menu, 0, NULL, Icon_Recording);

View File

@ -152,11 +152,13 @@ MENUITEM_FUNCTION(tc_update, 0, ID2P(LANG_TAGCACHE_UPDATE),
(int(*)(void))tagcache_update_with_splash, (int(*)(void))tagcache_update_with_splash,
NULL, NULL, Icon_NOICON); NULL, NULL, Icon_NOICON);
MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL); MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL);
MENUITEM_FUNCTION(tc_export, 0, ID2P(LANG_TAGCACHE_EXPORT), MENUITEM_FUNCTION(tc_export, 0, ID2P(LANG_TAGCACHE_EXPORT),
(int(*)(void))tagtree_export, NULL, tagtree_export, NULL,
NULL, Icon_NOICON); NULL, Icon_NOICON);
MENUITEM_FUNCTION(tc_import, 0, ID2P(LANG_TAGCACHE_IMPORT), MENUITEM_FUNCTION(tc_import, 0, ID2P(LANG_TAGCACHE_IMPORT),
(int(*)(void))tagtree_import, NULL, tagtree_import, NULL,
NULL, Icon_NOICON); NULL, Icon_NOICON);
MENUITEM_FUNCTION(tc_paths, 0, ID2P(LANG_SELECT_DATABASE_DIRS), MENUITEM_FUNCTION(tc_paths, 0, ID2P(LANG_SELECT_DATABASE_DIRS),
dirs_to_scan, NULL, NULL, Icon_NOICON); dirs_to_scan, NULL, NULL, Icon_NOICON);

View File

@ -82,7 +82,7 @@ MENUITEM_FUNCTION(time_set, 0, ID2P(LANG_SET_TIME),
MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL); MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL);
#ifdef HAVE_RTC_ALARM #ifdef HAVE_RTC_ALARM
MENUITEM_FUNCTION(alarm_screen_call, 0, ID2P(LANG_ALARM_MOD_ALARM_MENU), MENUITEM_FUNCTION(alarm_screen_call, 0, ID2P(LANG_ALARM_MOD_ALARM_MENU),
(menu_function)alarm_screen, NULL, NULL, Icon_NOICON); alarm_screen, NULL, NULL, Icon_NOICON);
#if CONFIG_TUNER || defined(HAVE_RECORDING) #if CONFIG_TUNER || defined(HAVE_RECORDING)
#if CONFIG_TUNER && !defined(HAVE_RECORDING) #if CONFIG_TUNER && !defined(HAVE_RECORDING)

View File

@ -830,7 +830,7 @@ static int runtime_speak_data(int selected_item, void* data)
} }
bool view_runtime(void) int view_runtime(void)
{ {
static const char *lines[]={ID2P(LANG_CLEAR_TIME)}; static const char *lines[]={ID2P(LANG_CLEAR_TIME)};
static const struct text_message message={lines, 1}; static const struct text_message message={lines, 1};
@ -869,9 +869,9 @@ bool view_runtime(void)
} }
} }
if(default_event_handler(action) == SYS_USB_CONNECTED) if(default_event_handler(action) == SYS_USB_CONNECTED)
return true; return 1;
} }
return false; return 0;
} }
#ifdef HAVE_TOUCHSCREEN #ifdef HAVE_TOUCHSCREEN

View File

@ -43,7 +43,7 @@ bool set_time_screen(const char* title, struct tm *tm);
bool shutdown_screen(void); bool shutdown_screen(void);
bool browse_id3(void); bool browse_id3(void);
bool view_runtime(void); int view_runtime(void);
#ifdef HAVE_TOUCHSCREEN #ifdef HAVE_TOUCHSCREEN
int calibrate(void); int calibrate(void);

View File

@ -1183,7 +1183,7 @@ bool set_bool_options(const char* string, const bool* variable,
bool result; bool result;
result = set_option(string, variable, BOOL, names, 2, result = set_option(string, variable, BOOL, names, 2,
(void (*)(int))function); (void (*)(int))(void (*)(void))function);
return result; return result;
} }

View File

@ -21,7 +21,7 @@
#ifndef _SOUND_MENU_H #ifndef _SOUND_MENU_H
#define _SOUND_MENU_H #define _SOUND_MENU_H
bool recording_menu(bool no_source); int recording_menu(bool no_source);
int rectrigger(void); int rectrigger(void);
#endif #endif

View File

@ -967,7 +967,7 @@ static void tagtree_track_finish_event(unsigned short id, void *ev_data)
#endif #endif
} }
bool tagtree_export(void) int tagtree_export(void)
{ {
struct tagcache_search tcs; struct tagcache_search tcs;
@ -977,10 +977,10 @@ bool tagtree_export(void)
splash(HZ*2, ID2P(LANG_FAILED)); splash(HZ*2, ID2P(LANG_FAILED));
} }
return false; return 0;
} }
bool tagtree_import(void) int tagtree_import(void)
{ {
splash(0, ID2P(LANG_WAIT)); splash(0, ID2P(LANG_WAIT));
if (!tagcache_import_changelog()) if (!tagcache_import_changelog())
@ -988,7 +988,7 @@ bool tagtree_import(void)
splash(HZ*2, ID2P(LANG_FAILED)); splash(HZ*2, ID2P(LANG_FAILED));
} }
return false; return 0;
} }
static bool parse_menu(const char *filename); static bool parse_menu(const char *filename);

View File

@ -31,8 +31,8 @@
#define TAGMENU_MAX_MENUS 32 #define TAGMENU_MAX_MENUS 32
#define TAGMENU_MAX_FMTS 32 #define TAGMENU_MAX_FMTS 32
bool tagtree_export(void); int tagtree_export(void);
bool tagtree_import(void); int tagtree_import(void);
void tagtree_init(void) INIT_ATTR; void tagtree_init(void) INIT_ATTR;
int tagtree_enter(struct tree_context* c); int tagtree_enter(struct tree_context* c);
void tagtree_exit(struct tree_context* c); void tagtree_exit(struct tree_context* c);

View File

@ -912,7 +912,7 @@ static int dirbrowse(void)
return true; return true;
} }
bool create_playlist(void) int create_playlist(void)
{ {
char filename[MAX_PATH + 16]; /* add enough space for extension */ char filename[MAX_PATH + 16]; /* add enough space for extension */
@ -924,14 +924,14 @@ bool create_playlist(void)
if (kbd_input(filename, MAX_PATH)) if (kbd_input(filename, MAX_PATH))
return false; return 0;
splashf(0, "%s %s", str(LANG_CREATING), filename); splashf(0, "%s %s", str(LANG_CREATING), filename);
trigger_cpu_boost(); trigger_cpu_boost();
catalog_add_to_a_playlist(tc.currdir, ATTR_DIRECTORY, true, filename); catalog_add_to_a_playlist(tc.currdir, ATTR_DIRECTORY, true, filename);
cancel_cpu_boost(); cancel_cpu_boost();
return true; return 1;
} }
void browse_context_init(struct browse_context *browse, void browse_context_init(struct browse_context *browse,

View File

@ -116,7 +116,7 @@ void browse_context_init(struct browse_context *browse,
char *title, enum themable_icons icon, char *title, enum themable_icons icon,
const char *root, const char *selected); const char *root, const char *selected);
int rockbox_browse(struct browse_context *browse); int rockbox_browse(struct browse_context *browse);
bool create_playlist(void); int create_playlist(void);
void resume_directory(const char *dir); void resume_directory(const char *dir);
static inline void tree_lock_cache(struct tree_context *t) static inline void tree_lock_cache(struct tree_context *t)
{ {