summaryrefslogtreecommitdiff
path: root/apps/gui/gwps-common.c
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-15 02:59:34 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-15 02:59:34 +0000
commit2e1169bddaa424ae5eef36e2ec12e2a3cb0adc68 (patch)
tree6967092524e64d2365034073efef820b41d31a2d /apps/gui/gwps-common.c
parentac946416060c19eb6cfe9da3d1885baee329df30 (diff)
downloadrockbox-2e1169bddaa424ae5eef36e2ec12e2a3cb0adc68.tar.gz
rockbox-2e1169bddaa424ae5eef36e2ec12e2a3cb0adc68.zip
* Make the WPS parser close open conditionals on new sublines and comments as well as new lines.
* Make the displaying code check for invalid conditional constructs in order to avoid some rare cases of infinite looping. * Make the WPS parser check that it doesn't read more strings than it can. * Increase the string buffer size (from 512 to 1024, to accomodate the TextBox WPS which uses a lot of unicode characters). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13162 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r--apps/gui/gwps-common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 6c58c1d666..b4a2cf9596 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1279,9 +1279,9 @@ static int find_conditional_end(struct wps_data *data, int index)
1279 } 1279 }
1280 1280
1281 int ret = index; 1281 int ret = index;
1282 do 1282 while (data->tokens[ret].value.i != 0
1283 && data->tokens[data->tokens[ret].value.i].type != WPS_TOKEN_CONDITIONAL_END)
1283 ret = data->tokens[ret].value.i; 1284 ret = data->tokens[ret].value.i;
1284 while (data->tokens[ret].type != WPS_TOKEN_CONDITIONAL_END);
1285 1285
1286 /* ret now is the index to the end token for the conditional. */ 1286 /* ret now is the index to the end token for the conditional. */
1287 return ret; 1287 return ret;
@@ -1307,6 +1307,10 @@ static int evaluate_conditional(struct gui_wps *gwps, int cond_index)
1307 && cond_start < data->num_tokens) 1307 && cond_start < data->num_tokens)
1308 cond_start++; 1308 cond_start++;
1309 1309
1310 /* if the number of options is 0, the conditional is invalid */
1311 if (num_options == 0)
1312 return cond_start;
1313
1310 /* treat ?xx<true> constructs as if they had 2 options. */ 1314 /* treat ?xx<true> constructs as if they had 2 options. */
1311 if (num_options < 2) 1315 if (num_options < 2)
1312 num_options = 2; 1316 num_options = 2;