summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-11-18 19:43:30 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-11-18 19:43:30 +0000
commita5fae9816d980dbf4ba52668108df692d637839f (patch)
tree70eb64363f5eedeca997b33a81806468d93e76b3
parent10f2f89d0fd491df9294867eb5689c65d002ce15 (diff)
downloadrockbox-a5fae9816d980dbf4ba52668108df692d637839f.zip
rockbox-a5fae9816d980dbf4ba52668108df692d637839f.tar.gz
rockbox-a5fae9816d980dbf4ba52668108df692d637839f.tar.bz2
rockbox-a5fae9816d980dbf4ba52668108df692d637839f.tar.xz
Fixed a WPS parsing bug where it would interpret stray x chars as %x tags
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7967 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index cef3745..34c3c78 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -916,6 +916,7 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
char* start_of_line = data->format_buffer;
int line = 0;
int subline;
+ char c, lastc;
#ifndef HAVE_LCD_BITMAP
/* no bitmap lcd == no bitmap loading */
(void)bmpdir;
@@ -945,7 +946,9 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
while ((*buf) && (line < WPS_MAX_LINES))
{
- switch (*buf)
+ c = *buf;
+
+ switch (c)
{
/*
* skip % sequences so "%;" doesn't start a new subline
@@ -1006,6 +1009,10 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
char *pos = NULL;
char imgname[MAX_PATH];
char qual = *ptr;
+
+ if(lastc != '%')
+ break;
+
if (qual == 'l' || qual == '|') /* format:
%x|n|filename.bmp|x|y|
or
@@ -1033,7 +1040,14 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
ptr = pos+1;
/* check the image number and load state */
- if (!data->img[n].loaded)
+ if (data->img[n].loaded)
+ {
+ /* Skip the rest of the line */
+ while(*buf != '\n')
+ buf++;
+ break;
+ }
+ else
{
/* get filename */
pos = strchr(ptr, '|');
@@ -1100,10 +1114,11 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
}
}
}
- }
+ }
#endif
- break;
+ break;
}
+ lastc = c;
buf++;
}
}