From 6b7e6332484df1d16ad539631685687f76f86159 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Fri, 23 Sep 2016 16:15:36 -0700 Subject: Remove compatibility code paths for macOS < 10.10 and iOS < 8.0 Change-Id: I11bec0efc2b4d86adf64a58990260fee70f050ac Reviewed-by: Richard Moe Gustavsen --- .../global/qoperatingsystemversion_darwin.mm | 53 ++-------------------- 1 file changed, 4 insertions(+), 49 deletions(-) (limited to 'src/corelib/global/qoperatingsystemversion_darwin.mm') diff --git a/src/corelib/global/qoperatingsystemversion_darwin.mm b/src/corelib/global/qoperatingsystemversion_darwin.mm index 3dd007cbb3..d8b927ff5d 100644 --- a/src/corelib/global/qoperatingsystemversion_darwin.mm +++ b/src/corelib/global/qoperatingsystemversion_darwin.mm @@ -40,61 +40,16 @@ #include "qoperatingsystemversion_p.h" #import -#ifdef Q_OS_IOS -#import -#endif - QT_BEGIN_NAMESPACE -typedef qint16 (*GestaltFunction)(quint32 selector, qint32 *response); - QOperatingSystemVersion QOperatingSystemVersion::current() { + NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; QOperatingSystemVersion v; v.m_os = currentType(); - v.m_major = -1; - v.m_minor = -1; - v.m_micro = -1; -#if QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS) || defined(Q_OS_WATCHOS) - if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) { - NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; - v.m_major = osv.majorVersion; - v.m_minor = osv.minorVersion; - v.m_micro = osv.patchVersion; - return v; - } -#endif - // Use temporary variables so we can return 0.0.0 (unknown version) - // in case of an error partway through determining the OS version - qint32 major = 0, minor = 0, patch = 0; -#if QT_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_10, __IPHONE_8_0) -#if defined(Q_OS_IOS) - @autoreleasepool { - NSArray *parts = [UIDevice.currentDevice.systemVersion componentsSeparatedByString:@"."]; - major = parts.count > 0 ? [[parts objectAtIndex:0] intValue] : 0; - minor = parts.count > 1 ? [[parts objectAtIndex:1] intValue] : 0; - patch = parts.count > 2 ? [[parts objectAtIndex:2] intValue] : 0; - } -#elif defined(Q_OS_MACOS) - static GestaltFunction pGestalt = 0; - if (!pGestalt) { - CFBundleRef b = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.CoreServices")); - pGestalt = reinterpret_cast(CFBundleGetFunctionPointerForName(b, - CFSTR("Gestalt"))); - } - if (!pGestalt) - return v; - if (pGestalt('sys1', &major) != 0) - return v; - if (pGestalt('sys2', &minor) != 0) - return v; - if (pGestalt('sys3', &patch) != 0) - return v; -#endif -#endif - v.m_major = major; - v.m_minor = minor; - v.m_micro = patch; + v.m_major = osv.majorVersion; + v.m_minor = osv.minorVersion; + v.m_micro = osv.patchVersion; return v; } -- cgit v1.2.3