From 0d6b249dbc33c2c53b260bb95955bc91bf208be0 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Sun, 8 Sep 2024 10:59:19 -0400 Subject: [PATCH] iOS 9 build fix (#16980) --- playlist.c | 7 ++++--- ui/drivers/cocoa/cocoa_common.m | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/playlist.c b/playlist.c index 23e5b0e42b..4e2c2e1975 100644 --- a/playlist.c +++ b/playlist.c @@ -1144,6 +1144,7 @@ void playlist_resolve_path(enum playlist_file_mode mode, { #ifdef HAVE_COCOATOUCH char tmp[PATH_MAX_LENGTH]; + int _len = 0; if (mode == PLAYLIST_LOAD) { @@ -1159,8 +1160,8 @@ void playlist_resolve_path(enum playlist_file_mode mode, path[string_index_last_occurance(path, '.')] = '\0'; if (string_ends_with(path, "_ios")) path[string_index_last_occurance(path, '_')] = '\0'; - strlcpy(tmp, ":/Frameworks/", STRLEN_CONST(":/Frameworks/") + 1); - strlcpy(tmp + STRLEN_CONST(":/Frameworks/"), path + STRLEN_CONST(":/modules/"), sizeof(tmp) - STRLEN_CONST(":/Frameworks/")); + _len += strlcpy(tmp + _len, ":/Frameworks/", STRLEN_CONST(":/Frameworks/") + 1); + _len += strlcpy(tmp + _len, path + STRLEN_CONST(":/modules/"), sizeof(tmp) - _len); /* iOS framework names, to quote Apple: * "must contain only alphanumerics, dots, hyphens and must not end with a dot." * @@ -1168,7 +1169,7 @@ void playlist_resolve_path(enum playlist_file_mode mode, * which is, we change underscore to dot. */ string_replace_all_chars(tmp, '_', '.'); - strlcat(tmp, ".framework", sizeof(tmp)); + strlcpy(tmp + _len, ".framework", sizeof(tmp)); fill_pathname_expand_special(path, tmp, len); } else diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 3d1be2ff4a..1c391bc03c 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -652,7 +652,7 @@ void cocoa_file_load_with_detect_core(const char *filename); hideKeyboardSwipe.delegate = self; [self.view addGestureRecognizer:hideKeyboardSwipe]; #endif -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 +#if defined(HAVE_IOS_TOUCHMOUSE) || defined(HAVE_IOS_CUSTOMKEYBOARDS) if (@available(iOS 13, *)) [self setupHelperBar]; #endif