forked from len0rd/rockbox
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
This commit is contained in:
parent
7a095a8f81
commit
9c8e2c8e1e
1 changed files with 7 additions and 0 deletions
|
|
@ -733,10 +733,14 @@ static const char* NOINLINE get_lif_token_value(struct gui_wps *gwps,
|
||||||
{
|
{
|
||||||
int a = lif->num_options;
|
int a = lif->num_options;
|
||||||
int b;
|
int b;
|
||||||
|
bool number_set = true;
|
||||||
struct wps_token *liftoken = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), lif->token);
|
struct wps_token *liftoken = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), lif->token);
|
||||||
const char* out_text = get_token_value(gwps, liftoken, offset, buf, buf_size, &a);
|
const char* out_text = get_token_value(gwps, liftoken, offset, buf, buf_size, &a);
|
||||||
if (a == -1 && liftoken->type != SKIN_TOKEN_VOLUME)
|
if (a == -1 && liftoken->type != SKIN_TOKEN_VOLUME)
|
||||||
|
{
|
||||||
a = (out_text && *out_text) ? 1 : 0;
|
a = (out_text && *out_text) ? 1 : 0;
|
||||||
|
number_set = false;
|
||||||
|
}
|
||||||
switch (lif->operand.type)
|
switch (lif->operand.type)
|
||||||
{
|
{
|
||||||
case STRING:
|
case STRING:
|
||||||
|
|
@ -749,6 +753,9 @@ static const char* NOINLINE get_lif_token_value(struct gui_wps *gwps,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
|
if (!number_set && out_text && *out_text >= '0' && *out_text <= '9')
|
||||||
|
a = atoi(out_text);
|
||||||
|
/* fall through */
|
||||||
case DECIMAL:
|
case DECIMAL:
|
||||||
b = lif->operand.data.number;
|
b = lif->operand.data.number;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue