diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-11-17 12:00:58 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-11-17 12:00:58 +0000 |
commit | 9c8e2c8e1e9f3d35239ec46f1cbbb95455fffccb (patch) | |
tree | a8c89439a6cef9337210fbe5a8e0755a34cf5649 | |
parent | 7a095a8f81058fad8e87aab28cd650e6cbe591ff (diff) | |
download | rockbox-9c8e2c8e1e9f3d35239ec46f1cbbb95455fffccb.tar.gz rockbox-9c8e2c8e1e9f3d35239ec46f1cbbb95455fffccb.zip |
skin engine: Fix %if() when comparing against a number.
If the tag being checked returns a number as a string (i.e %pv) but doesnt set the intval try to convert the string to a number so the comparisson operators work
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31003 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index bb9466c134..48d79600d2 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -733,10 +733,14 @@ static const char* NOINLINE get_lif_token_value(struct gui_wps *gwps, | |||
733 | { | 733 | { |
734 | int a = lif->num_options; | 734 | int a = lif->num_options; |
735 | int b; | 735 | int b; |
736 | bool number_set = true; | ||
736 | struct wps_token *liftoken = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), lif->token); | 737 | struct wps_token *liftoken = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), lif->token); |
737 | const char* out_text = get_token_value(gwps, liftoken, offset, buf, buf_size, &a); | 738 | const char* out_text = get_token_value(gwps, liftoken, offset, buf, buf_size, &a); |
738 | if (a == -1 && liftoken->type != SKIN_TOKEN_VOLUME) | 739 | if (a == -1 && liftoken->type != SKIN_TOKEN_VOLUME) |
740 | { | ||
739 | a = (out_text && *out_text) ? 1 : 0; | 741 | a = (out_text && *out_text) ? 1 : 0; |
742 | number_set = false; | ||
743 | } | ||
740 | switch (lif->operand.type) | 744 | switch (lif->operand.type) |
741 | { | 745 | { |
742 | case STRING: | 746 | case STRING: |
@@ -749,6 +753,9 @@ static const char* NOINLINE get_lif_token_value(struct gui_wps *gwps, | |||
749 | break; | 753 | break; |
750 | } | 754 | } |
751 | case INTEGER: | 755 | case INTEGER: |
756 | if (!number_set && out_text && *out_text >= '0' && *out_text <= '9') | ||
757 | a = atoi(out_text); | ||
758 | /* fall through */ | ||
752 | case DECIMAL: | 759 | case DECIMAL: |
753 | b = lif->operand.data.number; | 760 | b = lif->operand.data.number; |
754 | break; | 761 | break; |