From 42b3ccd05a866c5536e66ae905a73ef2fe9bd72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Tue, 24 Aug 2010 14:35:37 +0000 Subject: [PATCH] Fixing {font,image}_del's ret when file not exist When a file not exist, now, we're returning EINA_FALSE. It's according with eina_hash_del()'s behavior. By Fabiano Fidencio SVN revision: 51614 --- legacy/edje/src/lib/Edje_Edit.h | 6 ++++-- legacy/edje/src/lib/edje_edit.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/legacy/edje/src/lib/Edje_Edit.h b/legacy/edje/src/lib/Edje_Edit.h index 7b6f6a07ef..0c2a961fb4 100644 --- a/legacy/edje/src/lib/Edje_Edit.h +++ b/legacy/edje/src/lib/Edje_Edit.h @@ -2288,7 +2288,8 @@ EAPI Eina_Bool edje_edit_font_add(Evas_Object *obj, const char *path, const char * @param obj Object being edited. * @param alias The font alias * - * @return EINA_TRUE if font deleted, EINA_FALSE otherwise. + * @return EINA_TRUE if succesful, EINA_FALSE otherwise (including the + * case when the alias is not valid). */ EAPI Eina_Bool edje_edit_font_del(Evas_Object *obj, const char* alias); @@ -2358,7 +2359,8 @@ EAPI Eina_Bool edje_edit_image_add(Evas_Object *obj, const char *path); * @param obj Object being edited. * @param name The name of the image file to include in the edje. * - * @return EINA_TRUE if succesful, EINA_FALSE otherwise. + * @return EINA_TRUE if succesful, EINA_FALSE otherwise (including the + * case when the name is not valid). */ EAPI Eina_Bool edje_edit_image_del(Evas_Object *obj, const char *name); diff --git a/legacy/edje/src/lib/edje_edit.c b/legacy/edje/src/lib/edje_edit.c index b7dea3de9f..0aaedb94af 100644 --- a/legacy/edje/src/lib/edje_edit.c +++ b/legacy/edje/src/lib/edje_edit.c @@ -4024,7 +4024,7 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) if (!fnt) { WRN("Unable to find font entry part \"%s\"", alias); - return EINA_TRUE; + return EINA_FALSE; } /* Erase font to edje file */ @@ -4226,6 +4226,8 @@ edje_edit_image_del(Evas_Object *obj, const char* name) /* Create Image_Directory if not exist */ if (!ed->file->image_dir) + goto invalid_image; + return EINA_TRUE; for (i = 0; i < ed->file->image_dir->entries_count; ++i) @@ -4238,10 +4240,7 @@ edje_edit_image_del(Evas_Object *obj, const char* name) } if (i == ed->file->image_dir->entries_count) - { - WRN("Unable to find image entry part \"%s\"", name); - return EINA_TRUE; - } + goto invalid_image; { char entry[PATH_MAX]; @@ -4278,6 +4277,10 @@ edje_edit_image_del(Evas_Object *obj, const char* name) de->entry = NULL; return EINA_TRUE; + +invalid_image: + WRN("Unable to find image entry part \"%s\"", name); + return EINA_FALSE; } EAPI Eina_Bool