Removed log message length limitation for Apple platforms
This works in conjunction with https://github.com/libsdl-org/SDL/pull/5584main
parent
1aa9754d96
commit
7e636b03cc
|
@ -430,17 +430,10 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
|
||||||
#elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))
|
#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.
|
/* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now.
|
||||||
*/
|
*/
|
||||||
extern void SDL_NSLog(const char *text);
|
extern void SDL_NSLog(const char *prefix, const char *text);
|
||||||
{
|
{
|
||||||
char *text;
|
SDL_NSLog(SDL_priority_prefixes[priority], message);
|
||||||
/* !!! FIXME: why not just "char text[SDL_MAX_LOG_MESSAGE];" ? */
|
return;
|
||||||
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);
|
|
||||||
SDL_NSLog(text);
|
|
||||||
SDL_stack_free(text);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#elif defined(__PSP__)
|
#elif defined(__PSP__)
|
||||||
{
|
{
|
||||||
|
|
|
@ -270,11 +270,16 @@ Cocoa_CreateImage(SDL_Surface * surface)
|
||||||
* versions remain identical!
|
* versions remain identical!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void SDL_NSLog(const char *text)
|
void SDL_NSLog(const char *prefix, const char *text)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSString *str = [NSString stringWithUTF8String:text];
|
NSString *nsText = [NSString stringWithUTF8String:text];
|
||||||
NSLog(@"%@", str);
|
if (prefix) {
|
||||||
|
NSString *nsPrefix = [NSString stringWithUTF8String:prefix];
|
||||||
|
NSLog(@"%@: %@", nsPrefix, nsText);
|
||||||
|
} else {
|
||||||
|
NSLog(@"%@", nsText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,11 +278,16 @@ UIKit_ForceUpdateHomeIndicator()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(SDL_VIDEO_DRIVER_COCOA)
|
#if !defined(SDL_VIDEO_DRIVER_COCOA)
|
||||||
void SDL_NSLog(const char *text)
|
void SDL_NSLog(const char *prefix, const char *text)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSString *str = [NSString stringWithUTF8String:text];
|
NSString *nsText = [NSString stringWithUTF8String:text];
|
||||||
NSLog(@"%@", str);
|
if (prefix) {
|
||||||
|
NSString *nsPrefix = [NSString stringWithUTF8String:prefix];
|
||||||
|
NSLog(@"%@: %@", nsPrefix, nsText);
|
||||||
|
} else {
|
||||||
|
NSLog(@"%@", nsText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* SDL_VIDEO_DRIVER_COCOA */
|
#endif /* SDL_VIDEO_DRIVER_COCOA */
|
||||||
|
|
Loading…
Reference in New Issue