summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine/skin_display.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-09-02 11:43:33 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-09-02 11:43:33 +0000
commit216ed29e4dc709ac696f256e851accb8f093d1ea (patch)
treeaa640f6e493d21e70d1ede51e01e3e971445aa88 /apps/gui/skin_engine/skin_display.c
parent5cc11a1914fec6d41517ab182bfe7541559e797b (diff)
downloadrockbox-216ed29e4dc709ac696f256e851accb8f093d1ea.tar.gz
rockbox-216ed29e4dc709ac696f256e851accb8f093d1ea.zip
fix FS#11588 - %t(0) inside conditionals wasnt making that subline skip
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27983 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/skin_display.c')
-rw-r--r--apps/gui/skin_engine/skin_display.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 8e08343d82..d76b57976d 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -503,12 +503,7 @@ int evaluate_conditional(struct gui_wps *gwps, int offset,
char result[128];
const char *value;
- /* treat ?xx<true> constructs as if they had 2 options.
- * (i.e ?xx<true|false>) */
- if (num_options < 2)
- num_options = 2;
-
- int intval = num_options;
+ int intval = num_options < 2 ? 2 : num_options;
/* get_token_value needs to know the number of options in the enum */
value = get_token_value(gwps, conditional->token, offset,
result, sizeof(result), &intval);
@@ -516,11 +511,15 @@ int evaluate_conditional(struct gui_wps *gwps, int offset,
/* intval is now the number of the enum option we want to read,
starting from 1. If intval is -1, we check if value is empty. */
if (intval == -1)
- intval = (value && *value) ? 1 : num_options;
+ {
+ if (num_options == 1) /* so %?AA<true> */
+ intval = (value && *value) ? 1 : 0; /* returned as 0 for true, -1 for false */
+ else
+ intval = (value && *value) ? 1 : num_options;
+ }
else if (intval > num_options || intval < 1)
intval = num_options;
-
- conditional->last_value = intval -1;
+
return intval -1;
}