From b4caecae3ecd821345cc96e14f57afee5f83604c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 11 May 2022 11:35:12 +0200 Subject: [PATCH] Ios: Fix compiler warnings - avoid deprecated API - remove unused variable Change-Id: I33850ea2dda523900ead191542eadf65338d5210 Reviewed-by: Qt CI Bot Reviewed-by: Christian Stenger --- src/plugins/ios/iosdevice.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/plugins/ios/iosdevice.cpp b/src/plugins/ios/iosdevice.cpp index fcc09f3a8bf..7fe7e99e7f0 100644 --- a/src/plugins/ios/iosdevice.cpp +++ b/src/plugins/ios/iosdevice.cpp @@ -486,7 +486,12 @@ void IosDeviceManager::monitorAvailableDevices() CFRelease( cfProductIdMaskValue ); } - IONotificationPortRef notificationPort = IONotificationPortCreate(kIOMasterPortDefault); +#if QT_MACOS_DEPLOYMENT_TARGET_BELOW(120000) + const mach_port_t port = kIOMasterPortDefault; // deprecated in macOS 12 +#else + const mach_port_t port = kIOMainPortDefault; // available since macOS 12 +#endif + IONotificationPortRef notificationPort = IONotificationPortCreate(port); CFRunLoopSourceRef runLoopSource = IONotificationPortGetRunLoopSource(notificationPort); CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode); @@ -495,21 +500,19 @@ void IosDeviceManager::monitorAvailableDevices() CFRetain(matchingDictionary); // Now set up a notification to be called when a device is first matched by I/O Kit. - kern_return_t kr; - kr = IOServiceAddMatchingNotification(notificationPort, - kIOMatchedNotification, - matchingDictionary, - deviceConnectedCallback, - NULL, - &gAddedIter); + IOServiceAddMatchingNotification(notificationPort, + kIOMatchedNotification, + matchingDictionary, + deviceConnectedCallback, + NULL, + &gAddedIter); - - kr = IOServiceAddMatchingNotification(notificationPort, - kIOTerminatedNotification, - matchingDictionary, - deviceDisconnectedCallback, - NULL, - &gRemovedIter); + IOServiceAddMatchingNotification(notificationPort, + kIOTerminatedNotification, + matchingDictionary, + deviceDisconnectedCallback, + NULL, + &gRemovedIter); // Iterate once to get already-present devices and arm the notification deviceConnectedCallback(NULL, gAddedIter);