| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | return; |
| | | } |
| | | |
| | | /* !!! FIXME: why not just "char message[SDL_MAX_LOG_MESSAGE];" ? */ |
| | | message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); |
| | | if (!message) { |
| | | return; |
| | |
| | | char *output; |
| | | size_t length; |
| | | LPTSTR tstr; |
| | | SDL_bool isstack; |
| | | |
| | | #if !defined(HAVE_STDIO_H) && !defined(__WINRT__) |
| | | BOOL attachResult; |
| | |
| | | #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ |
| | | |
| | | length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1; |
| | | output = SDL_stack_alloc(char, length); |
| | | output = SDL_small_alloc(char, length, &isstack); |
| | | SDL_snprintf(output, length, "%s: %s\r\n", SDL_priority_prefixes[priority], message); |
| | | tstr = WIN_UTF8ToString(output); |
| | | |
| | |
| | | #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ |
| | | |
| | | SDL_free(tstr); |
| | | SDL_stack_free(output); |
| | | SDL_small_free(output, isstack); |
| | | } |
| | | #elif defined(__ANDROID__) |
| | | { |
| | |
| | | SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category)); |
| | | __android_log_write(SDL_android_priority[priority], tag, message); |
| | | } |
| | | #elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA) |
| | | /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now. |
| | | #elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)) |
| | | /* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now. |
| | | */ |
| | | extern void SDL_NSLog(const char *text); |
| | | { |
| | | char *text; |
| | | |
| | | /* !!! FIXME: why not just "char text[SDL_MAX_LOG_MESSAGE];" ? */ |
| | | text = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); |
| | | if (text) { |
| | | SDL_snprintf(text, SDL_MAX_LOG_MESSAGE, "%s: %s", SDL_priority_prefixes[priority], message); |