summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine/skin_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r--apps/gui/skin_engine/skin_parser.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 82083e8922..b7f2ec3091 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -482,19 +482,17 @@ static int parse_image_display(const char *wps_bufptr,
482 struct wps_token *token, 482 struct wps_token *token,
483 struct wps_data *wps_data) 483 struct wps_data *wps_data)
484{ 484{
485 int n = get_image_id(wps_bufptr[0]); 485 char label = wps_bufptr[0];
486 int subimage; 486 int subimage;
487 struct gui_img *img;; 487 struct gui_img *img;;
488 488
489 if (n == -1)
490 {
491 /* invalid picture display tag */
492 return WPS_ERROR_INVALID_PARAM;
493 }
494 /* sanity check */ 489 /* sanity check */
495 img = find_image(n, wps_data); 490 img = find_image(label, wps_data);
496 if (!img) 491 if (!img)
492 {
493 token->value.i = label; /* do debug works */
497 return WPS_ERROR_INVALID_PARAM; 494 return WPS_ERROR_INVALID_PARAM;
495 }
498 496
499 if ((subimage = get_image_id(wps_bufptr[1])) != -1) 497 if ((subimage = get_image_id(wps_bufptr[1])) != -1)
500 { 498 {
@@ -502,10 +500,10 @@ static int parse_image_display(const char *wps_bufptr,
502 return WPS_ERROR_INVALID_PARAM; 500 return WPS_ERROR_INVALID_PARAM;
503 501
504 /* Store sub-image number to display in high bits */ 502 /* Store sub-image number to display in high bits */
505 token->value.i = n | (subimage << 8); 503 token->value.i = label | (subimage << 8);
506 return 2; /* We have consumed 2 bytes */ 504 return 2; /* We have consumed 2 bytes */
507 } else { 505 } else {
508 token->value.i = n; 506 token->value.i = label;
509 return 1; /* We have consumed 1 byte */ 507 return 1; /* We have consumed 1 byte */
510 } 508 }
511} 509}
@@ -514,7 +512,6 @@ static int parse_image_load(const char *wps_bufptr,
514 struct wps_token *token, 512 struct wps_token *token,
515 struct wps_data *wps_data) 513 struct wps_data *wps_data)
516{ 514{
517 int n;
518 const char *ptr = wps_bufptr; 515 const char *ptr = wps_bufptr;
519 const char *pos; 516 const char *pos;
520 const char* filename; 517 const char* filename;
@@ -540,11 +537,8 @@ static int parse_image_load(const char *wps_bufptr,
540 if (*ptr != '|') 537 if (*ptr != '|')
541 return WPS_ERROR_INVALID_PARAM; 538 return WPS_ERROR_INVALID_PARAM;
542 539
543 /* get the image ID */
544 n = get_image_id(*id);
545
546 /* check the image number and load state */ 540 /* check the image number and load state */
547 if(n < 0 || find_image(n, wps_data)) 541 if(find_image(*id, wps_data))
548 { 542 {
549 /* Invalid image ID */ 543 /* Invalid image ID */
550 return WPS_ERROR_INVALID_PARAM; 544 return WPS_ERROR_INVALID_PARAM;
@@ -554,7 +548,7 @@ static int parse_image_load(const char *wps_bufptr,
554 return WPS_ERROR_INVALID_PARAM; 548 return WPS_ERROR_INVALID_PARAM;
555 /* save a pointer to the filename */ 549 /* save a pointer to the filename */
556 img->bm.data = (char*)filename; 550 img->bm.data = (char*)filename;
557 img->id = n; 551 img->label = *id;
558 img->x = x; 552 img->x = x;
559 img->y = y; 553 img->y = y;
560 img->num_subimages = 1; 554 img->num_subimages = 1;