add base code
[framework/api/face.git] / src / face_priv.c
1 #include "face.h"
2 #include "face_priv.h"
3
4 const char *_face_convert_error(int err)
5 {
6 #define STRINGFY(xx) #xx
7
8         struct _Error{
9                 face_error_e nError;
10                 const char *szError;
11         } ;
12
13         static struct _Error Error[] = {
14                         { FACE_ERROR_INVALID_PARAMTER, STRINGFY(FACE_ERROR_INVALID_PARAMTER) },
15                         { FACE_ERROR_OUT_OF_MEMORY, STRINGFY(FACE_ERROR_OUT_OF_MEMORY) },
16                         { FACE_ERROR_ENGINE_NOT_FOUND, STRINGFY(FACE_ERROR_ENGINE_NOT_FOUND) },
17                         { FACE_ERROR_OPERATION_FAILED, STRINGFY(FACE_ERROR_OPERATION_FAILED) },
18                         { FACE_ERROR_COMPONENT_NOT_FOUND, STRINGFY(FACE_ERROR_COMPONENT_NOT_FOUND) },
19                         { FACE_ERROR_NONE, NULL },      // End
20         };
21
22         int i = 0;
23         while(Error[i].szError != NULL)
24         {
25                 if ( Error[i].nError == (face_error_e)err )
26                 {
27                         return Error[i].szError;
28                 }
29
30                 i++;
31         }
32
33         static char error[128];
34         snprintf(error, sizeof(error)-1, "Unknow Error : %d(0x%08x)", err, err);
35         return error;
36
37 }
38
39
40