summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
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 b25fe24ba2..8e726f1b9d 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -234,6 +234,7 @@ static const struct wps_tag all_tags[] = {
234 { WPS_TOKEN_DATABASE_RATING, "rr", WPS_REFRESH_DYNAMIC, NULL }, 234 { WPS_TOKEN_DATABASE_RATING, "rr", WPS_REFRESH_DYNAMIC, NULL },
235#if CONFIG_CODEC == SWCODEC 235#if CONFIG_CODEC == SWCODEC
236 { WPS_TOKEN_REPLAYGAIN, "rg", WPS_REFRESH_STATIC, NULL }, 236 { WPS_TOKEN_REPLAYGAIN, "rg", WPS_REFRESH_STATIC, NULL },
237 { WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL },
237#endif 238#endif
238 239
239 { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL }, 240 { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL },
@@ -378,51 +379,52 @@ static int parse_image_load(const char *wps_bufptr,
378 379
379 ptr = strchr(ptr, '|') + 1; 380 ptr = strchr(ptr, '|') + 1;
380 pos = strchr(ptr, '|'); 381 pos = strchr(ptr, '|');
381 if (pos)
382 {
383 /* get the image ID */
384 n = get_image_id(*ptr);
385 382
386 /* check the image number and load state */ 383 if (!pos)
387 if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded) 384 return 0;
388 {
389 /* Skip the rest of the line */
390 return skip_end_of_line(wps_bufptr);
391 }
392 385
393 ptr = pos + 1; 386 /* get the image ID */
387 n = get_image_id(*ptr);
394 388
395 /* get image name */ 389 /* check the image number and load state */
396 bmp_names[n] = ptr; 390 if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded)
391 {
392 /* Skip the rest of the line */
393 return 0;
394 }
397 395
398 pos = strchr(ptr, '|'); 396 ptr = pos + 1;
399 ptr = pos + 1;
400 397
401 /* get x-position */ 398 /* get image name */
402 pos = strchr(ptr, '|'); 399 bmp_names[n] = ptr;
403 if (pos)
404 wps_data->img[n].x = atoi(ptr);
405 else
406 {
407 /* weird syntax, bail out */
408 return skip_end_of_line(wps_bufptr);
409 }
410 400
411 /* get y-position */ 401 pos = strchr(ptr, '|');
412 ptr = pos + 1; 402 ptr = pos + 1;
413 pos = strchr(ptr, '|'); 403
414 if (pos) 404 /* get x-position */
415 wps_data->img[n].y = atoi(ptr); 405 pos = strchr(ptr, '|');
416 else 406 if (pos)
417 { 407 wps_data->img[n].x = atoi(ptr);
418 /* weird syntax, bail out */ 408 else
419 return skip_end_of_line(wps_bufptr); 409 {
420 } 410 /* weird syntax, bail out */
411 return 0;
412 }
421 413
422 if (token->type == WPS_TOKEN_IMAGE_DISPLAY) 414 /* get y-position */
423 wps_data->img[n].always_display = true; 415 ptr = pos + 1;
416 pos = strchr(ptr, '|');
417 if (pos)
418 wps_data->img[n].y = atoi(ptr);
419 else
420 {
421 /* weird syntax, bail out */
422 return 0;
424 } 423 }
425 424
425 if (token->type == WPS_TOKEN_IMAGE_DISPLAY)
426 wps_data->img[n].always_display = true;
427
426 /* Skip the rest of the line */ 428 /* Skip the rest of the line */
427 return skip_end_of_line(wps_bufptr); 429 return skip_end_of_line(wps_bufptr);
428} 430}