diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-12-13 17:12:40 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-12-16 08:30:54 -0500 |
commit | 5903cd4bc83a842d6ee78dc89425eed23aabd999 (patch) | |
tree | 50078f20b91f150f969a9bc4b062188e7fd0da13 | |
parent | 222ff0cb14912d75993f00420382929dc7c7d33b (diff) | |
download | rockbox-5903cd4bc83a842d6ee78dc89425eed23aabd999.tar.gz rockbox-5903cd4bc83a842d6ee78dc89425eed23aabd999.zip |
[Bug Fix] setting.c fail to check F_TABLE_SETTING w/o arbitrary values
table settings have a list of valid values when
they do not have F_ALLOW_ARBITRARY_VALS flag
they were not being treated as such
Change-Id: Ib02643a65ee4fc2abb1be8563a1849076de2f708
-rw-r--r-- | apps/settings.c | 22 | ||||
-rw-r--r-- | apps/settings_list.c | 4 |
2 files changed, 23 insertions, 3 deletions
diff --git a/apps/settings.c b/apps/settings.c index bc6f066e22..e60b1b5f1a 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -394,8 +394,28 @@ bool settings_load_config(const char* file, bool apply) | |||
394 | else if (setting->flags & F_ALLOW_ARBITRARY_VALS) | 394 | else if (setting->flags & F_ALLOW_ARBITRARY_VALS) |
395 | { | 395 | { |
396 | *v = atoi(value); | 396 | *v = atoi(value); |
397 | logf("Val: %s\r\n",value); | 397 | logf("Val: %s = %d\r\n", value, *v); |
398 | } | 398 | } |
399 | else if (setting->flags & F_TABLE_SETTING) | ||
400 | { | ||
401 | const struct table_setting *info = setting->table_setting; | ||
402 | temp = atoi(value); | ||
403 | *v = setting->default_val.int_; | ||
404 | if (info->values) | ||
405 | { | ||
406 | for(int i = 0; i < info->count; i++) | ||
407 | { | ||
408 | if (info->values[i] == temp) | ||
409 | { | ||
410 | *v = temp; | ||
411 | break; | ||
412 | } | ||
413 | } | ||
414 | } | ||
415 | logf("Val: %s", *v == temp ? "Found":"Error Not Found"); | ||
416 | logf("Val: %s = %d\r\n", value, *v); | ||
417 | } | ||
418 | |||
399 | else | 419 | else |
400 | { | 420 | { |
401 | logf("Error: %s: Not Found! [%s]\r\n", | 421 | logf("Error: %s: Not Found! [%s]\r\n", |
diff --git a/apps/settings_list.c b/apps/settings_list.c index ae98ae0187..ab02683d94 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -1644,8 +1644,8 @@ const struct settings_list settings[] = { | |||
1644 | OFFON_SETTING(F_SOUNDSETTING, dithering_enabled, LANG_DITHERING, false, | 1644 | OFFON_SETTING(F_SOUNDSETTING, dithering_enabled, LANG_DITHERING, false, |
1645 | "dithering enabled", dsp_dither_enable), | 1645 | "dithering enabled", dsp_dither_enable), |
1646 | /* surround */ | 1646 | /* surround */ |
1647 | TABLE_SETTING(F_TIME_SETTING | F_SOUNDSETTING | F_ALLOW_ARBITRARY_VALS, | 1647 | TABLE_SETTING(F_TIME_SETTING | F_SOUNDSETTING, surround_enabled, |
1648 | surround_enabled, LANG_SURROUND, 0, "surround enabled", off, | 1648 | LANG_SURROUND, 0, "surround enabled", off, |
1649 | UNIT_MS, formatter_time_unit_0_is_off, | 1649 | UNIT_MS, formatter_time_unit_0_is_off, |
1650 | getlang_time_unit_0_is_off, | 1650 | getlang_time_unit_0_is_off, |
1651 | dsp_surround_enable, 6, | 1651 | dsp_surround_enable, 6, |