diff options
| author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-04-06 14:18:07 +0000 |
|---|---|---|
| committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-04-06 14:18:07 +0000 |
| commit | 3954a51311f872abcce9b96ebe436b869939767a (patch) | |
| tree | 40a829c808a4297d7b3d73cb8c9bca463407b143 /apps/gui/wps_parser.c | |
| parent | 52112a05f11c2ab7e308e8bf2a64ae787e191369 (diff) | |
| download | rockbox-3954a51311f872abcce9b96ebe436b869939767a.zip rockbox-3954a51311f872abcce9b96ebe436b869939767a.tar.gz rockbox-3954a51311f872abcce9b96ebe436b869939767a.tar.bz2 rockbox-3954a51311f872abcce9b96ebe436b869939767a.tar.xz | |
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index b51a76a..8a226e1 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 if (have_tenth == false) val *= 10; + /* We only want to allow strictly positive timeout values */ + if (val <= 0) + val = DEFAULT_SUBLINE_TIME_MULTIPLIER; + + int line = wps_data->num_lines; + int subline = wps_data->num_sublines[line]; + wps_data->time_mult[line][subline] = val; wps_data->tokens[wps_data->num_tokens].value.i = val; + return skip; } @@ -616,6 +624,8 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr) data->num_tokens = 0; char *current_string = data->string_buffer; + data->time_mult[0][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER; + while(wps_bufptr && *wps_bufptr && data->num_tokens < WPS_MAX_TOKENS && data->num_lines < WPS_MAX_LINES) { @@ -634,6 +644,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr) data->tokens[data->num_tokens++].type = WPS_TOKEN_SUBLINE_SEPARATOR; subline = ++(data->num_sublines[data->num_lines]); data->format_lines[data->num_lines][subline] = data->num_tokens; + data->time_mult[data->num_lines][subline] = DEFAULT_SUBLINE_TIME_MULTIPLIER; } else wps_bufptr += skip_end_of_line(wps_bufptr); @@ -700,6 +711,7 @@ condlistend: /* close a conditional. sometimes we want to close them even when if (data->num_lines < WPS_MAX_LINES) { data->format_lines[data->num_lines][0] = data->num_tokens; + data->time_mult[data->num_lines][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER; } break; |