From c6f21984c94035f06a973d6299fd9574917d857f Mon Sep 17 00:00:00 2001 From: barbieri Date: Tue, 22 Dec 2009 18:06:15 +0000 Subject: [PATCH] stringify load errors. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@44660 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Evas.h | 3 +++ src/lib/canvas/evas_main.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/lib/Evas.h b/src/lib/Evas.h index 03eceac..438bb3e 100644 --- a/src/lib/Evas.h +++ b/src/lib/Evas.h @@ -216,6 +216,7 @@ typedef struct _Evas_Event_Key_Down Evas_Event_Key_Down; /**< Event structure typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up; /**< Event structure for #EVAS_CALLBACK_KEY_UP event callbacks */ typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure for #EVAS_CALLBACK_HOLD event callbacks */ +/* load error identifiers, see evas_load_error_str() */ #define EVAS_LOAD_ERROR_NONE 0 /**< No error on load */ #define EVAS_LOAD_ERROR_GENERIC 1 /**< A non-specific error occured */ #define EVAS_LOAD_ERROR_DOES_NOT_EXIST 2 /**< File (or file path) does not exist */ @@ -1117,6 +1118,8 @@ extern "C" { /** * Utilities: */ + EAPI const char *evas_load_error_str(int error); + /** * Every subclass should provide this at the beginning of their own diff --git a/src/lib/canvas/evas_main.c b/src/lib/canvas/evas_main.c index 3f869d8..1507349 100644 --- a/src/lib/canvas/evas_main.c +++ b/src/lib/canvas/evas_main.c @@ -1065,3 +1065,27 @@ _evas_unwalk(Evas *e) e->walking_list--; if ((e->walking_list == 0) && (e->delete_me)) evas_free(e); } + +EAPI const char * +evas_load_error_str(int error) +{ + switch (error) + { + case EVAS_LOAD_ERROR_NONE: + return "No error on load"; + case EVAS_LOAD_ERROR_GENERIC: + return "A non-specific error occured"; + case EVAS_LOAD_ERROR_DOES_NOT_EXIST: + return "File (or file path) does not exist"; + case EVAS_LOAD_ERROR_PERMISSION_DENIED: + return "Permission deinied to an existing file (or path)"; + case EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: + return "Allocation of resources failure prevented load"; + case EVAS_LOAD_ERROR_CORRUPT_FILE: + return "File corrupt (but was detected as a known format)"; + case EVAS_LOAD_ERROR_UNKNOWN_FORMAT: + return "File is not a known format"; + default: + return "Unknown error"; + } +} -- 2.7.4