From dab7e161767f951a55d6fbc0988fae5f3d9df474 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 18 Aug 2009 07:17:51 +0000 Subject: store the image label instead of a number so debug output is actually useful when %xd is used witout a coresponding %xl git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22404 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_parser.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'apps/gui/skin_engine/skin_parser.c') 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, struct wps_token *token, struct wps_data *wps_data) { - int n = get_image_id(wps_bufptr[0]); + char label = wps_bufptr[0]; int subimage; struct gui_img *img;; - if (n == -1) - { - /* invalid picture display tag */ - return WPS_ERROR_INVALID_PARAM; - } /* sanity check */ - img = find_image(n, wps_data); + img = find_image(label, wps_data); if (!img) + { + token->value.i = label; /* do debug works */ return WPS_ERROR_INVALID_PARAM; + } if ((subimage = get_image_id(wps_bufptr[1])) != -1) { @@ -502,10 +500,10 @@ static int parse_image_display(const char *wps_bufptr, return WPS_ERROR_INVALID_PARAM; /* Store sub-image number to display in high bits */ - token->value.i = n | (subimage << 8); + token->value.i = label | (subimage << 8); return 2; /* We have consumed 2 bytes */ } else { - token->value.i = n; + token->value.i = label; return 1; /* We have consumed 1 byte */ } } @@ -514,7 +512,6 @@ static int parse_image_load(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data) { - int n; const char *ptr = wps_bufptr; const char *pos; const char* filename; @@ -540,11 +537,8 @@ static int parse_image_load(const char *wps_bufptr, if (*ptr != '|') return WPS_ERROR_INVALID_PARAM; - /* get the image ID */ - n = get_image_id(*id); - /* check the image number and load state */ - if(n < 0 || find_image(n, wps_data)) + if(find_image(*id, wps_data)) { /* Invalid image ID */ return WPS_ERROR_INVALID_PARAM; @@ -554,7 +548,7 @@ static int parse_image_load(const char *wps_bufptr, return WPS_ERROR_INVALID_PARAM; /* save a pointer to the filename */ img->bm.data = (char*)filename; - img->id = n; + img->label = *id; img->x = x; img->y = y; img->num_subimages = 1; -- cgit v1.2.3