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
This commit is contained in:
parent
52112a05f1
commit
3954a51311
3 changed files with 23 additions and 5 deletions
|
@ -1763,14 +1763,9 @@ bool gui_wps_refresh(struct gui_wps *gwps,
|
|||
/* reset to first subline if refresh all flag is set */
|
||||
if (refresh_mode == WPS_REFRESH_ALL)
|
||||
{
|
||||
int j;
|
||||
for (i = 0; i < data->num_lines; i++)
|
||||
{
|
||||
data->curr_subline[i] = SUBLINE_RESET;
|
||||
for (j = 0; j < data->num_sublines[i]; j++)
|
||||
{
|
||||
data->time_mult[i][j] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -362,6 +362,17 @@ void print_line_info(struct wps_data *data)
|
|||
DEBUGF("\n");
|
||||
}
|
||||
|
||||
DEBUGF("subline time multipliers :\n");
|
||||
for (line = 0; line < data->num_lines; line++)
|
||||
{
|
||||
DEBUGF("%2d. ", line);
|
||||
for (subline = 0; subline < data->num_sublines[line]; subline++)
|
||||
{
|
||||
DEBUGF("%3d ", data->time_mult[line][subline]);
|
||||
}
|
||||
DEBUGF("\n");
|
||||
}
|
||||
|
||||
DEBUGF("\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue