summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-06 14:18:07 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-06 14:18:07 +0000
commit3954a51311f872abcce9b96ebe436b869939767a (patch)
tree40a829c808a4297d7b3d73cb8c9bca463407b143 /apps/gui/wps_parser.c
parent52112a05f11c2ab7e308e8bf2a64ae787e191369 (diff)
downloadrockbox-3954a51311f872abcce9b96ebe436b869939767a.tar.gz
rockbox-3954a51311f872abcce9b96ebe436b869939767a.zip
Better handling of subline timeout values : All values are set to the default before another value is found by the parser. No more
resetting to the default value at displaying time (this caused problems especially noticeable on the DancePuffDuo WPS). Changing the values with conditionals is still possible but only strictly positive tiemout values are accepted now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13045 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r--apps/gui/wps_parser.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index b51a76a594..8a226e1963 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -490,7 +490,15 @@ static int parse_subline_timeout(const char *wps_bufptr, struct wps_data *wps_da
490 if (have_tenth == false) 490 if (have_tenth == false)
491 val *= 10; 491 val *= 10;
492 492
493 /* We only want to allow strictly positive timeout values */
494 if (val <= 0)
495 val = DEFAULT_SUBLINE_TIME_MULTIPLIER;
496
497 int line = wps_data->num_lines;
498 int subline = wps_data->num_sublines[line];
499 wps_data->time_mult[line][subline] = val;
493 wps_data->tokens[wps_data->num_tokens].value.i = val; 500 wps_data->tokens[wps_data->num_tokens].value.i = val;
501
494 return skip; 502 return skip;
495} 503}
496 504
@@ -616,6 +624,8 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
616 data->num_tokens = 0; 624 data->num_tokens = 0;
617 char *current_string = data->string_buffer; 625 char *current_string = data->string_buffer;
618 626
627 data->time_mult[0][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
628
619 while(wps_bufptr && *wps_bufptr && data->num_tokens < WPS_MAX_TOKENS 629 while(wps_bufptr && *wps_bufptr && data->num_tokens < WPS_MAX_TOKENS
620 && data->num_lines < WPS_MAX_LINES) 630 && data->num_lines < WPS_MAX_LINES)
621 { 631 {
@@ -634,6 +644,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
634 data->tokens[data->num_tokens++].type = WPS_TOKEN_SUBLINE_SEPARATOR; 644 data->tokens[data->num_tokens++].type = WPS_TOKEN_SUBLINE_SEPARATOR;
635 subline = ++(data->num_sublines[data->num_lines]); 645 subline = ++(data->num_sublines[data->num_lines]);
636 data->format_lines[data->num_lines][subline] = data->num_tokens; 646 data->format_lines[data->num_lines][subline] = data->num_tokens;
647 data->time_mult[data->num_lines][subline] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
637 } 648 }
638 else 649 else
639 wps_bufptr += skip_end_of_line(wps_bufptr); 650 wps_bufptr += skip_end_of_line(wps_bufptr);
@@ -700,6 +711,7 @@ condlistend: /* close a conditional. sometimes we want to close them even when
700 if (data->num_lines < WPS_MAX_LINES) 711 if (data->num_lines < WPS_MAX_LINES)
701 { 712 {
702 data->format_lines[data->num_lines][0] = data->num_tokens; 713 data->format_lines[data->num_lines][0] = data->num_tokens;
714 data->time_mult[data->num_lines][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
703 } 715 }
704 716
705 break; 717 break;