summaryrefslogtreecommitdiff
path: root/apps/menus
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2019-09-20 03:07:29 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2019-09-20 03:07:29 -0500
commit10e5e56f3c62383afba30b553fac1ee624a8428d (patch)
tree4431aa03b77fb7724933c8ac21c53a26d545f869 /apps/menus
parentd0883d747ab7eb7a26364f01d2ab2f5445fbc204 (diff)
downloadrockbox-10e5e56f3c62383afba30b553fac1ee624a8428d.tar.gz
rockbox-10e5e56f3c62383afba30b553fac1ee624a8428d.zip
Bug fix dynamic menus
Dynamic menus had a buffer_len variable in the parent function but it was discarded before passing to the callbacks Why!!?? No clue but everything that used it was assuming MAXPATH Wouldn't be surprised to see some bugs pop out from this one.. init_menu_lists() was assuming MENU_HAS_DESC and setting the menu title + icon based on such even though it could be invalid didn't see anywhere in the code that was currently using MENU_DYNAMIC_DESC in relation to a top level menu but considering it caused all kinds of corruption to the menu when I tried its probably been tried and abandoned before... Change-Id: I8d961d748918bfa8ea6adb5ad60491af4d739d6e
Diffstat (limited to 'apps/menus')
-rw-r--r--apps/menus/audiohw_eq_menu.c5
-rw-r--r--apps/menus/radio_menu.c5
-rw-r--r--apps/menus/settings_menu.c7
3 files changed, 10 insertions, 7 deletions
diff --git a/apps/menus/audiohw_eq_menu.c b/apps/menus/audiohw_eq_menu.c
index 1027d6a0b8..8dfb6e8450 100644
--- a/apps/menus/audiohw_eq_menu.c
+++ b/apps/menus/audiohw_eq_menu.c
@@ -41,9 +41,10 @@ static unsigned short hw_eq_setting_lang_ids[AUDIOHW_EQ_SETTING_NUM] =
41#endif 41#endif
42}; 42};
43 43
44static char * hw_eq_get_name(int selected_item, void * data, char *buffer) 44static char * hw_eq_get_name(int selected_item, void * data,
45 char *buffer, size_t buffer_len)
45{ 46{
46 snprintf(buffer, MAX_PATH, 47 snprintf(buffer, buffer_len,
47 str(hw_eq_setting_lang_ids[HW_EQ_IDX_SETTING(data)]), 48 str(hw_eq_setting_lang_ids[HW_EQ_IDX_SETTING(data)]),
48 HW_EQ_IDX_BAND(data) + 1); 49 HW_EQ_IDX_BAND(data) + 1);
49 return buffer; 50 return buffer;
diff --git a/apps/menus/radio_menu.c b/apps/menus/radio_menu.c
index fb3d2b7fee..8871421c11 100644
--- a/apps/menus/radio_menu.c
+++ b/apps/menus/radio_menu.c
@@ -100,11 +100,12 @@ MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL);
100 100
101#ifndef FM_MODE 101#ifndef FM_MODE
102extern int radio_mode; 102extern int radio_mode;
103static char* get_mode_text(int selected_item, void * data, char *buffer) 103static char* get_mode_text(int selected_item, void * data,
104 char *buffer, size_t buffer_len)
104{ 105{
105 (void)selected_item; 106 (void)selected_item;
106 (void)data; 107 (void)data;
107 snprintf(buffer, MAX_PATH, "%s %s", str(LANG_MODE), 108 snprintf(buffer, buffer_len, "%s %s", str(LANG_MODE),
108 radio_mode ? str(LANG_PRESET) : 109 radio_mode ? str(LANG_PRESET) :
109 str(LANG_RADIO_SCAN_MODE)); 110 str(LANG_RADIO_SCAN_MODE));
110 return buffer; 111 return buffer;
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index ca0ec91967..67595498ad 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -500,14 +500,15 @@ static int seconds_to_min(int secs)
500 500
501/* A string representation of either whether a sleep timer will be started or 501/* A string representation of either whether a sleep timer will be started or
502 canceled, and how long it will be or how long is remaining in brackets */ 502 canceled, and how long it will be or how long is remaining in brackets */
503static char* sleep_timer_getname(int selected_item, void * data, char *buffer) 503static char* sleep_timer_getname(int selected_item, void * data,
504 char *buffer, size_t buffer_len)
504{ 505{
505 (void)selected_item; 506 (void)selected_item;
506 (void)data; 507 (void)data;
507 int sec = get_sleep_timer(); 508 int sec = get_sleep_timer();
508 char timer_buf[10]; 509 char timer_buf[10];
509 /* we have no sprintf, so MAX_PATH is a guess */ 510
510 snprintf(buffer, MAX_PATH, "%s (%s)", 511 snprintf(buffer, buffer_len, "%s (%s)",
511 str(sec ? LANG_SLEEP_TIMER_CANCEL_CURRENT 512 str(sec ? LANG_SLEEP_TIMER_CANCEL_CURRENT
512 : LANG_SLEEP_TIMER_START_CURRENT), 513 : LANG_SLEEP_TIMER_START_CURRENT),
513 sleep_timer_formatter(timer_buf, sizeof(timer_buf), 514 sleep_timer_formatter(timer_buf, sizeof(timer_buf),