diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-06 19:12:20 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-06 18:23:57 +0000 |
commit | d541a72a0e23af74b0d7fd4df604f78f4d91f417 (patch) | |
tree | be6c08013b739c9b17c669a1139e261b17bcc56c | |
parent | 1a9a5fc279aba2006ba415a31ef780026ea5d305 (diff) |
Bugfixes in eq_menu.c
Change-Id: Ibf754554f685d13ac00a49694fcecee459ff838f
-rw-r--r-- | apps/menus/eq_menu.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index 49d35c133b..40adaca711 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c @@ -239,14 +239,12 @@ static void selection_to_banditem(int selection, int expanded_band, int *band, i static char *advancedmenu_item_get_name(int selected_item, void *data, char *buffer, size_t len) { - (void)len; int band; int item; - char *lang = NULL; + int lang = -1; selection_to_banditem(selected_item, *(intptr_t*)data, &band, &item); - strcpy(buffer, "\t"); switch (item) { case 0: /* Band title */ @@ -256,27 +254,34 @@ static char *advancedmenu_item_get_name(int selected_item, void *data, char *buf return str(LANG_EQUALIZER_BAND_HIGH_SHELF); else { - snprintf(buffer, MAX_PATH, str(LANG_EQUALIZER_BAND_PEAK), band); + snprintf(buffer, len, str(LANG_EQUALIZER_BAND_PEAK), band); return buffer; } break; case 1: /* cutoff */ if (band == 0) - lang = str(LANG_EQUALIZER_BAND_CUTOFF); + lang = LANG_EQUALIZER_BAND_CUTOFF; else if (band == EQ_NUM_BANDS - 1) - lang = str(LANG_EQUALIZER_BAND_CUTOFF); + lang = LANG_EQUALIZER_BAND_CUTOFF; else - lang = str(LANG_EQUALIZER_BAND_CENTER); + lang = LANG_EQUALIZER_BAND_CENTER; break; case 2: /* Q */ - lang = str(LANG_EQUALIZER_BAND_Q); + lang = LANG_EQUALIZER_BAND_Q; break; case 3: /* Gain */ - lang = str(LANG_GAIN); + lang = LANG_GAIN; break; } - return strcat(buffer, lang);; + if(lang < 0) + buffer[0] = 0; + else { + buffer[0] = '\t'; + strlcpy(&buffer[1], str(lang), len - 1); + } + + return buffer; } static int advancedmenu_speak_item(int selected_item, void *data) |