From dd40c46d50f9f22643b828e80783d3576b9c1d50 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 15 Oct 2018 23:04:04 -0400 Subject: 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 --- apps/menus/eq_menu.c | 12 ++++++------ apps/menus/eq_menu.h | 2 +- apps/menus/main_menu.c | 20 ++++++++++++-------- apps/menus/playlist_menu.c | 8 +++----- apps/menus/radio_menu.c | 2 +- apps/menus/recording_menu.c | 11 ++++++----- apps/menus/settings_menu.c | 6 ++++-- apps/menus/time_menu.c | 2 +- 8 files changed, 34 insertions(+), 29 deletions(-) (limited to 'apps/menus') diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index b9da3449a6..7cbf7b5d90 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c @@ -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 */ -bool eq_menu_graphical(void) +int eq_menu_graphical(void) { bool exit_request = false; bool result = true; @@ -753,10 +753,10 @@ bool eq_menu_graphical(void) screens[i].set_viewport(NULL); 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 */ bool enabled = global_settings.eq_enabled; @@ -766,16 +766,16 @@ static bool eq_save_preset(void) global_settings.eq_enabled = enabled; - return result; + return (result) ? 1 : 0; } /* Allows browsing of preset files */ static struct browse_folder_info eqs = { EQS_DIR, SHOW_CFG }; 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); 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), browse_folder, (void*)&eqs, lowlatency_callback, Icon_NOICON); diff --git a/apps/menus/eq_menu.h b/apps/menus/eq_menu.h index 8147088c2b..04e8be2ead 100644 --- a/apps/menus/eq_menu.h +++ b/apps/menus/eq_menu.h @@ -40,7 +40,7 @@ #define EQ_USER_DIVISOR 10 bool eq_browse_presets(void); -bool eq_menu_graphical(void); +int eq_menu_graphical(void); /* utility functions for settings_list.c */ const char* eq_q_format(char* buffer, size_t buffer_size, int value, diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 8764101f73..139667cef4 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -111,7 +111,7 @@ MAKE_MENU(manage_settings, ID2P(LANG_MANAGE_MENU), NULL, Icon_Config, /* INFO MENU */ -static bool show_credits(void) +static int show_credits(void) { char credits[MAX_PATH] = { '\0' }; 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))) ; } - return false; + return 0; } #ifdef HAVE_LCD_CHARCELLS @@ -357,7 +357,7 @@ static int info_action_callback(int action, struct gui_synclist *lists) } return action; } -static bool show_info(void) +static int show_info(void) { struct info_data data = {.new_data = true }; struct simplelist_info info; @@ -369,10 +369,12 @@ static bool show_info(void) if(global_settings.talk_menu) info.get_talk = info_speak_item; 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), - (menu_function)show_info, NULL, NULL, Icon_NOICON); + show_info, NULL, NULL, Icon_NOICON); #if CONFIG_RTC int time_screen(void* ignored); @@ -381,11 +383,13 @@ MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU), #endif 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), - (menu_function)view_runtime, NULL, NULL, Icon_NOICON); + view_runtime, NULL, NULL, Icon_NOICON); + 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, &show_info_item, &show_credits_item, diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c index f4fa6bc653..175ca19959 100644 --- a/apps/menus/playlist_menu.c +++ b/apps/menus/playlist_menu.c @@ -75,15 +75,13 @@ static int playlist_view_(void) playlist_viewer_ex(NULL); return 0; } - 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, 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), - (int(*)(void*))save_playlist_screen, - NULL, NULL, Icon_NOICON); + save_playlist_screen, NULL, NULL, Icon_NOICON); MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL); MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL); static int clear_catalog_directory(void) diff --git a/apps/menus/radio_menu.c b/apps/menus/radio_menu.c index 8ab7151c3e..fb3d2b7fee 100644 --- a/apps/menus/radio_menu.c +++ b/apps/menus/radio_menu.c @@ -59,7 +59,7 @@ MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING), #define FM_RECORDING_SETTINGS static int fm_recording_settings(void) { - bool ret = recording_menu(true); + int ret = recording_menu(true); #if CONFIG_CODEC != SWCODEC if (!ret) diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c index 5038b1abad..54dc415de7 100644 --- a/apps/menus/recording_menu.c +++ b/apps/menus/recording_menu.c @@ -307,7 +307,7 @@ MENUITEM_FUNCTION(recformat, 0, ID2P(LANG_RECORDING_FORMAT), recformat_func, NULL, NULL, Icon_Menu_setting); 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); #endif /* CONFIG_CODEC == SWCODEC */ @@ -651,14 +651,15 @@ MAKE_MENU(recording_settings_menu, ID2P(LANG_RECORDING_SETTINGS), &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; - 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 */ return retval; }; 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); diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 5c99cb4cd4..41734a9a63 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -152,11 +152,13 @@ MENUITEM_FUNCTION(tc_update, 0, ID2P(LANG_TAGCACHE_UPDATE), (int(*)(void))tagcache_update_with_splash, NULL, NULL, Icon_NOICON); MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL); + MENUITEM_FUNCTION(tc_export, 0, ID2P(LANG_TAGCACHE_EXPORT), - (int(*)(void))tagtree_export, NULL, + tagtree_export, NULL, NULL, Icon_NOICON); + MENUITEM_FUNCTION(tc_import, 0, ID2P(LANG_TAGCACHE_IMPORT), - (int(*)(void))tagtree_import, NULL, + tagtree_import, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(tc_paths, 0, ID2P(LANG_SELECT_DATABASE_DIRS), dirs_to_scan, NULL, NULL, Icon_NOICON); diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c index a6885a3dbc..93ca786cea 100644 --- a/apps/menus/time_menu.c +++ b/apps/menus/time_menu.c @@ -82,7 +82,7 @@ MENUITEM_FUNCTION(time_set, 0, ID2P(LANG_SET_TIME), MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL); #ifdef HAVE_RTC_ALARM 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) -- cgit v1.2.3