From cef1514b01bc32f6a2778344d69e13011856576a Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 17 Jul 2022 09:07:04 -0700
Subject: [PATCH] Fixed some Xcode warnings
---
src/filesystem/cocoa/SDL_sysfilesystem.m | 10 ++++++----
src/joystick/iphoneos/SDL_mfijoystick.m | 8 ++++++--
src/video/cocoa/SDL_cocoamouse.m | 2 +-
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/filesystem/cocoa/SDL_sysfilesystem.m b/src/filesystem/cocoa/SDL_sysfilesystem.m
index ba2e332799c..a1506d3b8af 100644
--- a/src/filesystem/cocoa/SDL_sysfilesystem.m
+++ b/src/filesystem/cocoa/SDL_sysfilesystem.m
@@ -72,7 +72,6 @@
{ @autoreleasepool
{
char *retval = NULL;
- static SDL_bool shown = SDL_FALSE;
NSArray *array;
if (!app) {
@@ -94,10 +93,13 @@
* between sessions. If you want your app's save data to
* actually stick around, you'll need to use iCloud storage.
*/
- if (!shown)
{
- shown = SDL_TRUE;
- SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n");
+ static SDL_bool shown = SDL_FALSE;
+ if (!shown)
+ {
+ shown = SDL_TRUE;
+ SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n");
+ }
}
array = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m
index 7c701319335..53491dfbf46 100644
--- a/src/joystick/iphoneos/SDL_mfijoystick.m
+++ b/src/joystick/iphoneos/SDL_mfijoystick.m
@@ -186,8 +186,10 @@ @interface GCMicroGamepad (SDL)
Uint8 subtype = 0;
const char *name = NULL;
- if ((@available(macOS 11.3, *)) && !GCController.shouldMonitorBackgroundEvents) {
- GCController.shouldMonitorBackgroundEvents = YES;
+ if (@available(macOS 11.3, iOS 14.5, tvOS 14.5, *)) {
+ if (!GCController.shouldMonitorBackgroundEvents) {
+ GCController.shouldMonitorBackgroundEvents = YES;
+ }
}
/* Explicitly retain the controller because SDL_JoystickDeviceItem is a
@@ -576,7 +578,9 @@ static int is_macos11(void)
#endif
@autoreleasepool {
+#ifdef SDL_JOYSTICK_MFI
NSNotificationCenter *center;
+#endif
#ifdef SDL_JOYSTICK_iOS_ACCELEROMETER
if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) {
/* Default behavior, accelerometer as joystick */
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index b41cec13971..0239972ba8c 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -114,7 +114,7 @@ + (NSCursor *)invisibleCursor
NSString *cursorPath = [@"/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/Resources/cursors" stringByAppendingPathComponent:cursorName];
NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[cursorPath stringByAppendingPathComponent:@"info.plist"]];
/* we can't do animation atm. :/ */
- const int frames = [[info valueForKey:@"frames"] integerValue];
+ const int frames = (int)[[info valueForKey:@"frames"] integerValue];
NSCursor *cursor;
NSImage *image = [[NSImage alloc] initWithContentsOfFile:[cursorPath stringByAppendingPathComponent:@"cursor.pdf"]];
if ((image == nil) || (image.valid == NO)) {