diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog index 3fc1cc92c6..cc139d63bc 100644 --- a/legacy/edje/ChangeLog +++ b/legacy/edje/ChangeLog @@ -243,3 +243,7 @@ * Fix wrong call to free() in edje_load. * Reduce parts walk to the strict minimum. + +2011-12-19 Cedric Bail + + * Check existence of group at compile time also. diff --git a/legacy/edje/NEWS b/legacy/edje/NEWS index e238922437..b2abed9fb5 100644 --- a/legacy/edje/NEWS +++ b/legacy/edje/NEWS @@ -1,9 +1,11 @@ Edje 1.1.0 Changes since Edje 1.1.0: +------------------------- Improvements: * speedup load time of Edje file. + * check existence of group at compile time also. Changes since Edje 1.0.0: ------------------------- diff --git a/legacy/edje/src/bin/edje_cc.h b/legacy/edje/src/bin/edje_cc.h index bcd31a133e..d0c6d22242 100644 --- a/legacy/edje/src/bin/edje_cc.h +++ b/legacy/edje/src/bin/edje_cc.h @@ -138,6 +138,7 @@ struct _Edje_Part_Parser /* global fn calls */ void data_setup(void); void data_write(void); +void data_queue_group_lookup(const char *name, Edje_Part *part); void data_queue_part_lookup(Edje_Part_Collection *pc, const char *name, int *dest); void data_queue_copied_part_lookup(Edje_Part_Collection *pc, int *src, int *dest); void data_queue_program_lookup(Edje_Part_Collection *pc, const char *name, int *dest); diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c index e0ab9358f5..6a3e58c41f 100644 --- a/legacy/edje/src/bin/edje_cc_handlers.c +++ b/legacy/edje/src/bin/edje_cc_handlers.c @@ -3212,6 +3212,7 @@ st_collections_group_parts_part_source(void) //FIXME: validate this somehow (need to decide on the format also) current_part->source = parse_str(0); + data_queue_group_lookup(current_part->source, current_part); } /** @@ -3233,6 +3234,7 @@ st_collections_group_parts_part_source2(void) //FIXME: validate this somehow (need to decide on the format also) current_part->source2 = parse_str(0); + data_queue_group_lookup(current_part->source2, current_part); } /** @@ -3254,6 +3256,7 @@ st_collections_group_parts_part_source3(void) //FIXME: validate this somehow (need to decide on the format also) current_part->source3 = parse_str(0); + data_queue_group_lookup(current_part->source3, current_part); } /** @@ -3275,6 +3278,7 @@ st_collections_group_parts_part_source4(void) //FIXME: validate this somehow (need to decide on the format also) current_part->source4 = parse_str(0); + data_queue_group_lookup(current_part->source4, current_part); } /** @@ -3296,6 +3300,7 @@ st_collections_group_parts_part_source5(void) //FIXME: validate this somehow (need to decide on the format also) current_part->source5 = parse_str(0); + data_queue_group_lookup(current_part->source5, current_part); } /** @@ -3317,6 +3322,7 @@ st_collections_group_parts_part_source6(void) //FIXME: validate this somehow (need to decide on the format also) current_part->source6 = parse_str(0); + data_queue_group_lookup(current_part->source6, current_part); } /** @@ -3804,6 +3810,7 @@ static void st_collections_group_parts_part_box_items_item_source(void) check_arg_count(1); current_item->source = parse_str(0); + data_queue_group_lookup(current_item->source, current_part); } /** diff --git a/legacy/edje/src/bin/edje_cc_out.c b/legacy/edje/src/bin/edje_cc_out.c index 443a702c44..fc77d9d288 100644 --- a/legacy/edje/src/bin/edje_cc_out.c +++ b/legacy/edje/src/bin/edje_cc_out.c @@ -72,6 +72,7 @@ struct _Program_Lookup struct _Group_Lookup { char *name; + Edje_Part *part; }; struct _String_Lookup @@ -1371,13 +1372,16 @@ reorder_parts(void) } void -data_queue_group_lookup(char *name) +data_queue_group_lookup(const char *name, Edje_Part *part) { Group_Lookup *gl; + if (!name || strlen(name) == 0) return ; + gl = mem_alloc(SZ(Group_Lookup)); group_lookups = eina_list_append(group_lookups, gl); gl->name = mem_strdup(name); + gl->part = part; } void @@ -1698,8 +1702,28 @@ data_process_lookups(void) { Edje_Part_Collection_Directory_Entry *de; + if (!group->part + || (group->part->type != EDJE_PART_TYPE_GROUP + && group->part->type != EDJE_PART_TYPE_TEXTBLOCK + && group->part->type != EDJE_PART_TYPE_BOX + && group->part->type != EDJE_PART_TYPE_TABLE)) + goto free_group; + de = eina_hash_find(edje_file->collection, group->name); + if (!de) + { + Eina_Bool found = EINA_FALSE; + + EINA_LIST_FOREACH(aliases, l, de) + if (strcmp(de->entry, group->name) == 0) + { + found = EINA_TRUE; + break; + } + if (!found) de = NULL; + } + if (!de) { ERR("%s: Error. Unable to find group name \"%s\".", @@ -1707,6 +1731,7 @@ data_process_lookups(void) exit(-1); } + free_group: free(group->name); free(group); } @@ -1914,7 +1939,7 @@ _data_queue_program_lookup(Edje_Part_Collection *pc, char *name, char *ptr, int static void _data_queue_group_lookup(Edje_Part_Collection *pc __UNUSED__, char *name, char *ptr __UNUSED__, int len __UNUSED__) { - data_queue_group_lookup(name); + data_queue_group_lookup(name, NULL); } static void _data_queue_image_pc_lookup(Edje_Part_Collection *pc __UNUSED__, char *name, char *ptr, int len)