diff options
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 90c5938e23..8bc7edf9c3 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -116,13 +116,13 @@ static void add_to_ll_chain(struct skin_token_list **list, struct skin_token_lis | |||
116 | } | 116 | } |
117 | 117 | ||
118 | /* traverse the image linked-list for an image */ | 118 | /* traverse the image linked-list for an image */ |
119 | struct gui_img* find_image(char label, struct wps_data *data) | 119 | struct gui_img* find_image(const char *label, struct wps_data *data) |
120 | { | 120 | { |
121 | struct skin_token_list *list = data->images; | 121 | struct skin_token_list *list = data->images; |
122 | while (list) | 122 | while (list) |
123 | { | 123 | { |
124 | struct gui_img *img = (struct gui_img *)list->token->value.data; | 124 | struct gui_img *img = (struct gui_img *)list->token->value.data; |
125 | if (img->label == label) | 125 | if (!strcmp(img->label,label)) |
126 | return img; | 126 | return img; |
127 | list = list->next; | 127 | list = list->next; |
128 | } | 128 | } |
@@ -132,7 +132,7 @@ struct gui_img* find_image(char label, struct wps_data *data) | |||
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | /* traverse the viewport linked list for a viewport */ | 134 | /* traverse the viewport linked list for a viewport */ |
135 | struct skin_viewport* find_viewport(char *label, bool uivp, struct wps_data *data) | 135 | struct skin_viewport* find_viewport(const char *label, bool uivp, struct wps_data *data) |
136 | { | 136 | { |
137 | struct skin_element *list = data->tree; | 137 | struct skin_element *list = data->tree; |
138 | while (list) | 138 | while (list) |
@@ -227,18 +227,21 @@ static int parse_image_display(struct skin_element *element, | |||
227 | struct wps_token *token, | 227 | struct wps_token *token, |
228 | struct wps_data *wps_data) | 228 | struct wps_data *wps_data) |
229 | { | 229 | { |
230 | char *text = element->params[0].data.text; | 230 | char *label = element->params[0].data.text; |
231 | char label = text[0]; | 231 | char sublabel = label[1]; |
232 | char sublabel = text[1]; | ||
233 | int subimage; | 232 | int subimage; |
234 | struct gui_img *img; | 233 | struct gui_img *img; |
235 | struct image_display *id = skin_buffer_alloc(sizeof(struct image_display)); | 234 | struct image_display *id = skin_buffer_alloc(sizeof(struct image_display)); |
236 | 235 | ||
236 | if (element->params_count == 1) | ||
237 | { | ||
238 | /* backwards compatability. Allow %xd(Aa) to still work */ | ||
239 | label[1] = '\0'; | ||
240 | } | ||
237 | /* sanity check */ | 241 | /* sanity check */ |
238 | img = find_image(label, wps_data); | 242 | img = find_image(label, wps_data); |
239 | if (!img || !id) | 243 | if (!img || !id) |
240 | { | 244 | { |
241 | token->value.i = label; /* so debug works */ | ||
242 | return WPS_ERROR_INVALID_PARAM; | 245 | return WPS_ERROR_INVALID_PARAM; |
243 | } | 246 | } |
244 | id->label = label; | 247 | id->label = label; |
@@ -297,7 +300,7 @@ static int parse_image_load(struct skin_element *element, | |||
297 | y = element->params[3].data.number; | 300 | y = element->params[3].data.number; |
298 | 301 | ||
299 | /* check the image number and load state */ | 302 | /* check the image number and load state */ |
300 | if(find_image(*id, wps_data)) | 303 | if(find_image(id, wps_data)) |
301 | { | 304 | { |
302 | /* Invalid image ID */ | 305 | /* Invalid image ID */ |
303 | return WPS_ERROR_INVALID_PARAM; | 306 | return WPS_ERROR_INVALID_PARAM; |
@@ -307,7 +310,7 @@ static int parse_image_load(struct skin_element *element, | |||
307 | return WPS_ERROR_INVALID_PARAM; | 310 | return WPS_ERROR_INVALID_PARAM; |
308 | /* save a pointer to the filename */ | 311 | /* save a pointer to the filename */ |
309 | img->bm.data = (char*)filename; | 312 | img->bm.data = (char*)filename; |
310 | img->label = *id; | 313 | img->label = id; |
311 | img->x = x; | 314 | img->x = x; |
312 | img->y = y; | 315 | img->y = y; |
313 | img->num_subimages = 1; | 316 | img->num_subimages = 1; |