Fixed Xcode warnings on macOS

This commit is contained in:
Sam Lantinga 2022-09-16 09:44:39 -07:00
parent 910d499c54
commit 5892ed4373
2 changed files with 6 additions and 10 deletions

View File

@ -486,7 +486,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
fclose (pFile); fclose (pFile);
} }
#endif #endif
#if HAVE_STDIO_H #if HAVE_STDIO_H && \
!(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)))
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
#if __NACL__ #if __NACL__
fflush(stderr); fflush(stderr);

View File

@ -632,18 +632,13 @@ SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *
} }
#endif /* TARGET_OS_TV */ #endif /* TARGET_OS_TV */
#if defined(__MACOSX__)
static int is_macos11(void)
{
return (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_15);
}
#endif
static int static int
IOS_JoystickInit(void) IOS_JoystickInit(void)
{ {
#if defined(__MACOSX__) #if defined(__MACOSX__)
if (!is_macos11()) { if (@available(macOS 10.16, *)) {
/* Continue with initialization on macOS 11+ */
} else {
return 0; return 0;
} }
#endif #endif
@ -1654,7 +1649,7 @@ IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
#if defined(SDL_JOYSTICK_MFI) && defined(__MACOSX__) #if defined(SDL_JOYSTICK_MFI) && defined(__MACOSX__)
SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device) SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
{ {
if (is_macos11()) { if (@available(macOS 10.16, *)) {
if ([GCController supportsHIDDevice:device]) { if ([GCController supportsHIDDevice:device]) {
return SDL_TRUE; return SDL_TRUE;
} }