equal
deleted
inserted
replaced
46 /* FIXME: Add code to lookup key in language string hash-table */ |
46 /* FIXME: Add code to lookup key in language string hash-table */ |
47 return key; |
47 return key; |
48 } |
48 } |
49 |
49 |
50 /* Public functions */ |
50 /* Public functions */ |
|
51 |
|
52 static char *SDL_GetErrorMsg(char *errstr, int maxlen); |
51 |
53 |
52 int |
54 int |
53 SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) |
55 SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) |
54 { |
56 { |
55 va_list ap; |
57 va_list ap; |
108 } |
110 } |
109 } |
111 } |
110 } |
112 } |
111 va_end(ap); |
113 va_end(ap); |
112 |
114 |
113 /* If we are in debug mode, print out an error message */ |
115 if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) { |
114 SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError()); |
116 /* If we are in debug mode, print out an error message |
115 |
117 * Avoid stomping on the static buffer in GetError, just |
|
118 * in case this is called while processing a ShowMessageBox to |
|
119 * show an error already in that static buffer. |
|
120 */ |
|
121 char errmsg[SDL_ERRBUFIZE]; |
|
122 SDL_GetErrorMsg(errmsg, sizeof(errmsg)); |
|
123 SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", errmsg); |
|
124 } |
116 return -1; |
125 return -1; |
117 } |
126 } |
118 |
|
119 static char *SDL_GetErrorMsg(char *errstr, int maxlen); |
|
120 |
127 |
121 /* Available for backwards compatibility */ |
128 /* Available for backwards compatibility */ |
122 const char * |
129 const char * |
123 SDL_GetError(void) |
130 SDL_GetError(void) |
124 { |
131 { |