mirror of https://github.com/encounter/SDL.git
Merge commit 'd4e6047e3cc73698a0d6b3b4a2ce7b9b5e025b2f' into main
This commit is contained in:
commit
d3b2e62e80
|
@ -38,16 +38,20 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
result = SDL_vsnprintf(error->str, error->len, fmt, ap);
|
result = SDL_vsnprintf(error->str, error->len, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
if (result >= 0 && (size_t)result >= error->len && error->realloc_func) {
|
if (result >= 0 && (size_t)result >= error->len && error->realloc_func) {
|
||||||
size_t len = (size_t)result + 1;
|
size_t len = (size_t)result + 1;
|
||||||
char *str = (char *)error->realloc_func(error->str, len);
|
char *str = (char *)error->realloc_func(error->str, len);
|
||||||
if (str) {
|
if (str) {
|
||||||
error->str = str;
|
error->str = str;
|
||||||
error->len = len;
|
error->len = len;
|
||||||
|
va_start(ap, fmt);
|
||||||
SDL_vsnprintf(error->str, error->len, fmt, ap);
|
SDL_vsnprintf(error->str, error->len, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) {
|
if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) {
|
||||||
/* If we are in debug mode, print out the error message */
|
/* If we are in debug mode, print out the error message */
|
||||||
|
|
Loading…
Reference in New Issue