summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-11-30 00:24:26 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-12-01 13:59:49 -0500
commit8aa3b2216002d9f5fd5ee3f677049b62cde264b0 (patch)
tree0c338808c9e46023d9f004c41ededee973bb8db5
parent6346be51a3666bd7a1c8860575da7ce4fbb92de8 (diff)
downloadrockbox-8aa3b22160.tar.gz
rockbox-8aa3b22160.zip
settings: Update int fallback check for settings with cfg_vals
This atoi() was added long ago in commit d490f441, and it looks like it's intended to allow arbitrary values in table settings. These table settings have some symbolic values (eg. off, on) but are otherwise int-valued. As far as I can see the only settings that can take this branch are all table settings with F_ALLOW_ARBITRARY_VALS. It doesn't make a lot of sense to accept random integers without that flag, so make the atoi() conversion dependent on it. Change-Id: I7bb1bc4997601b73ad8dcbf2f3ddf434d16adf23
-rw-r--r--apps/settings.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/apps/settings.c b/apps/settings.c
index c1664b625c..f166abd06f 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -361,13 +361,9 @@ bool settings_load_config(const char* file, bool apply)
else
*v = temp;
}
- else
- { /* atoi breaks choice settings because they
- * don't have int-like values, and would
- * fall back to the first value (i.e. 0)
- * due to atoi */
- if (setting->flags & F_CHOICE_SETTING)
- *v = atoi(value);
+ else if (setting->flags & F_ALLOW_ARBITRARY_VALS)
+ {
+ *v = atoi(value);
}
}
break;