From 874837b4cc76b79a9b0f54f5c221c95d2a309c9d Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Mon, 7 Aug 2017 13:32:49 -0700 Subject: [PATCH] Fix the safety check preventing apps from running on old OSes This fixes an issue where iOS, watchOS, and tvOS versions would be mis-detected as 100 times their version (i.e. iOS 8.0 as iOS 800.0). Instead of protecting the branch in (version >= 100000) with a macOS ifdef, we can simply remove it entirely since Qt cannot be run on OSes where the old encoding was used (macOS < 10.10). Amends 8418a6335b3f8a029f48ee9b0a18500ddc760852 Change-Id: I32b307163c815799cb46c008b93f3b53d27c48b9 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcore_mac_objc.mm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index ce4f01625e2..db7e55f4b1f 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -295,17 +295,17 @@ void qt_apple_check_os_version() const char *os = "macOS"; const int version = __MAC_OS_X_VERSION_MIN_REQUIRED; #endif - const NSOperatingSystemVersion required = version >= 100000 - ? (NSOperatingSystemVersion){version / 10000, version / 100 % 100, version % 100} - : (NSOperatingSystemVersion){version / 100, version / 10 % 10, version % 10}; + const NSOperatingSystemVersion required = (NSOperatingSystemVersion){ + version / 10000, version / 100 % 100, version % 100}; const NSOperatingSystemVersion current = NSProcessInfo.processInfo.operatingSystemVersion; if (![NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:required]) { fprintf(stderr, "You can't use this version of %s with this version of %s. " "You have %s %ld.%ld.%ld. Qt requires %s %ld.%ld.%ld or later.\n", - ((NSString *)NSBundle.mainBundle.infoDictionary[@"CFBundleName"]).UTF8String, + (reinterpret_cast( + NSBundle.mainBundle.infoDictionary[@"CFBundleName"]).UTF8String), os, - os, current.majorVersion, current.minorVersion, current.patchVersion, - os, required.majorVersion, required.minorVersion, required.patchVersion); + os, long(current.majorVersion), long(current.minorVersion), long(current.patchVersion), + os, long(required.majorVersion), long(required.minorVersion), long(required.patchVersion)); abort(); } }