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
This commit is contained in:
parent
10f2f89d0f
commit
a5fae9816d
1 changed files with 19 additions and 4 deletions
|
@ -916,6 +916,7 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
|
||||||
char* start_of_line = data->format_buffer;
|
char* start_of_line = data->format_buffer;
|
||||||
int line = 0;
|
int line = 0;
|
||||||
int subline;
|
int subline;
|
||||||
|
char c, lastc;
|
||||||
#ifndef HAVE_LCD_BITMAP
|
#ifndef HAVE_LCD_BITMAP
|
||||||
/* no bitmap lcd == no bitmap loading */
|
/* no bitmap lcd == no bitmap loading */
|
||||||
(void)bmpdir;
|
(void)bmpdir;
|
||||||
|
@ -945,7 +946,9 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
|
||||||
|
|
||||||
while ((*buf) && (line < WPS_MAX_LINES))
|
while ((*buf) && (line < WPS_MAX_LINES))
|
||||||
{
|
{
|
||||||
switch (*buf)
|
c = *buf;
|
||||||
|
|
||||||
|
switch (c)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* skip % sequences so "%;" doesn't start a new subline
|
* 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 *pos = NULL;
|
||||||
char imgname[MAX_PATH];
|
char imgname[MAX_PATH];
|
||||||
char qual = *ptr;
|
char qual = *ptr;
|
||||||
|
|
||||||
|
if(lastc != '%')
|
||||||
|
break;
|
||||||
|
|
||||||
if (qual == 'l' || qual == '|') /* format:
|
if (qual == 'l' || qual == '|') /* format:
|
||||||
%x|n|filename.bmp|x|y|
|
%x|n|filename.bmp|x|y|
|
||||||
or
|
or
|
||||||
|
@ -1033,7 +1040,14 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
|
||||||
ptr = pos+1;
|
ptr = pos+1;
|
||||||
|
|
||||||
/* check the image number and load state */
|
/* 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 */
|
/* get filename */
|
||||||
pos = strchr(ptr, '|');
|
pos = strchr(ptr, '|');
|
||||||
|
@ -1104,6 +1118,7 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
lastc = c;
|
||||||
buf++;
|
buf++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue