summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-12 16:15:34 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-12 16:15:34 +0000
commit27cbf6bcea0d0280a2f5d46ccf460edb08187b17 (patch)
treee81ec5f1276174d394e1fd877272f428c1e9016d /apps/gui/wps_parser.c
parentf9fb49284ef3c9ba03d33f3555f61ab5a1be9143 (diff)
downloadrockbox-27cbf6bcea0d0280a2f5d46ccf460edb08187b17.zip
rockbox-27cbf6bcea0d0280a2f5d46ccf460edb08187b17.tar.gz
rockbox-27cbf6bcea0d0280a2f5d46ccf460edb08187b17.tar.bz2
rockbox-27cbf6bcea0d0280a2f5d46ccf460edb08187b17.tar.xz
* Add the crossfade (%xf) WPS tag
* Avoid eating the whole line when unsuccessfully parsing a %x or %xl tag. This will prevent unknown tags starting with %x from making the line disappear. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13127 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r--apps/gui/wps_parser.c74
1 files changed, 38 insertions, 36 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index b25fe24..8e726f1 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -234,6 +234,7 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_DATABASE_RATING, "rr", WPS_REFRESH_DYNAMIC, NULL },
#if CONFIG_CODEC == SWCODEC
{ WPS_TOKEN_REPLAYGAIN, "rg", WPS_REFRESH_STATIC, NULL },
+ { WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL },
#endif
{ WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL },
@@ -378,51 +379,52 @@ static int parse_image_load(const char *wps_bufptr,
ptr = strchr(ptr, '|') + 1;
pos = strchr(ptr, '|');
- if (pos)
- {
- /* get the image ID */
- n = get_image_id(*ptr);
- /* check the image number and load state */
- if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded)
- {
- /* Skip the rest of the line */
- return skip_end_of_line(wps_bufptr);
- }
+ if (!pos)
+ return 0;
- ptr = pos + 1;
+ /* get the image ID */
+ n = get_image_id(*ptr);
- /* get image name */
- bmp_names[n] = ptr;
+ /* check the image number and load state */
+ if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded)
+ {
+ /* Skip the rest of the line */
+ return 0;
+ }
- pos = strchr(ptr, '|');
- ptr = pos + 1;
+ ptr = pos + 1;
- /* get x-position */
- pos = strchr(ptr, '|');
- if (pos)
- wps_data->img[n].x = atoi(ptr);
- else
- {
- /* weird syntax, bail out */
- return skip_end_of_line(wps_bufptr);
- }
+ /* get image name */
+ bmp_names[n] = ptr;
- /* get y-position */
- ptr = pos + 1;
- pos = strchr(ptr, '|');
- if (pos)
- wps_data->img[n].y = atoi(ptr);
- else
- {
- /* weird syntax, bail out */
- return skip_end_of_line(wps_bufptr);
- }
+ pos = strchr(ptr, '|');
+ ptr = pos + 1;
+
+ /* get x-position */
+ pos = strchr(ptr, '|');
+ if (pos)
+ wps_data->img[n].x = atoi(ptr);
+ else
+ {
+ /* weird syntax, bail out */
+ return 0;
+ }
- if (token->type == WPS_TOKEN_IMAGE_DISPLAY)
- wps_data->img[n].always_display = true;
+ /* get y-position */
+ ptr = pos + 1;
+ pos = strchr(ptr, '|');
+ if (pos)
+ wps_data->img[n].y = atoi(ptr);
+ else
+ {
+ /* weird syntax, bail out */
+ return 0;
}
+ if (token->type == WPS_TOKEN_IMAGE_DISPLAY)
+ wps_data->img[n].always_display = true;
+
/* Skip the rest of the line */
return skip_end_of_line(wps_bufptr);
}