summaryrefslogtreecommitdiff
path: root/apps/settings.c
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/settings.c
parent26712d5104531a9ff56f3b7bf0750e061c2ca014 (diff)
downloadrockbox-9a82b23989347a6269d35789295c4694f7b010cd.tar.gz
rockbox-9a82b23989347a6269d35789295c4694f7b010cd.zip
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/settings.c')
-rw-r--r--apps/settings.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 6f1fe86f8e..01aacbcf6c 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1590,7 +1590,7 @@ bool set_int(char* string,
1590 that 'variable' points to. not the value within. Only variables with 1590 that 'variable' points to. not the value within. Only variables with
1591 type 'bool' should use parameter BOOL. 1591 type 'bool' should use parameter BOOL.
1592 1592
1593 The type separation is nececssary since int and bool are fundamentally 1593 The type separation is necessary since int and bool are fundamentally
1594 different and bit-incompatible types and can not share the same access 1594 different and bit-incompatible types and can not share the same access
1595 code. */ 1595 code. */
1596 1596
@@ -1601,8 +1601,12 @@ bool set_option(char* string, void* variable, enum optiontype type,
1601 int button; 1601 int button;
1602 int* intvar = (int*)variable; 1602 int* intvar = (int*)variable;
1603 bool* boolvar = (bool*)variable; 1603 bool* boolvar = (bool*)variable;
1604 int orgint=*intvar; 1604 int oldval = 0;
1605 bool orgbool=*boolvar; 1605
1606 if (type==INT)
1607 oldval=*intvar;
1608 else
1609 oldval=*boolvar;
1606 1610
1607#ifdef HAVE_LCD_BITMAP 1611#ifdef HAVE_LCD_BITMAP
1608 if(global_settings.statusbar) 1612 if(global_settings.statusbar)
@@ -1672,12 +1676,12 @@ bool set_option(char* string, void* variable, enum optiontype type,
1672 case BUTTON_STOP: 1676 case BUTTON_STOP:
1673 case BUTTON_MENU: 1677 case BUTTON_MENU:
1674#endif 1678#endif
1675 if (((type==INT) && (*intvar != orgint)) || 1679 if (((type==INT) && (*intvar != oldval)) ||
1676 ((type==BOOL) && (*boolvar != orgbool))) { 1680 ((type==BOOL) && (*boolvar != oldval))) {
1677 if (type==INT) 1681 if (type==INT)
1678 *intvar=orgint; 1682 *intvar=oldval;
1679 else 1683 else
1680 *boolvar=orgbool; 1684 *boolvar=oldval;
1681 lcd_stop_scroll(); 1685 lcd_stop_scroll();
1682 lcd_puts(0, 0, str(LANG_MENU_SETTING_CANCEL)); 1686 lcd_puts(0, 0, str(LANG_MENU_SETTING_CANCEL));
1683 lcd_update(); 1687 lcd_update();