summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-06-05 14:22:03 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-06-05 14:22:03 +0000
commit9a82b23989347a6269d35789295c4694f7b010cd (patch)
tree16164e99d3582614f84c7a16341f865b71a260d6 /apps
parent26712d5104531a9ff56f3b7bf0750e061c2ca014 (diff)
downloadrockbox-9a82b23989347a6269d35789295c4694f7b010cd.zip
rockbox-9a82b23989347a6269d35789295c4694f7b010cd.tar.gz
rockbox-9a82b23989347a6269d35789295c4694f7b010cd.tar.bz2
rockbox-9a82b23989347a6269d35789295c4694f7b010cd.tar.xz
Bug fix: Never read an int from a bool pointer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3733 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/settings.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 6f1fe86..01aacbc 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1590,7 +1590,7 @@ bool set_int(char* string,
that 'variable' points to. not the value within. Only variables with
type 'bool' should use parameter BOOL.
- The type separation is nececssary since int and bool are fundamentally
+ The type separation is necessary since int and bool are fundamentally
different and bit-incompatible types and can not share the same access
code. */
@@ -1601,8 +1601,12 @@ bool set_option(char* string, void* variable, enum optiontype type,
int button;
int* intvar = (int*)variable;
bool* boolvar = (bool*)variable;
- int orgint=*intvar;
- bool orgbool=*boolvar;
+ int oldval = 0;
+
+ if (type==INT)
+ oldval=*intvar;
+ else
+ oldval=*boolvar;
#ifdef HAVE_LCD_BITMAP
if(global_settings.statusbar)
@@ -1672,12 +1676,12 @@ bool set_option(char* string, void* variable, enum optiontype type,
case BUTTON_STOP:
case BUTTON_MENU:
#endif
- if (((type==INT) && (*intvar != orgint)) ||
- ((type==BOOL) && (*boolvar != orgbool))) {
+ if (((type==INT) && (*intvar != oldval)) ||
+ ((type==BOOL) && (*boolvar != oldval))) {
if (type==INT)
- *intvar=orgint;
+ *intvar=oldval;
else
- *boolvar=orgbool;
+ *boolvar=oldval;
lcd_stop_scroll();
lcd_puts(0, 0, str(LANG_MENU_SETTING_CANCEL));
lcd_update();