diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-08-07 13:32:49 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-08-08 21:42:09 +0000 |
commit | 874837b4cc76b79a9b0f54f5c221c95d2a309c9d (patch) | |
tree | 77b2a92c3af80dfd531e32509f0634f4214d6b39 /src/corelib/kernel/qcore_mac_objc.mm | |
parent | 38bfe7a2793f74fc1d42a83016c1aeda4dbd7d78 (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qcore_mac_objc.mm')
-rw-r--r-- | src/corelib/kernel/qcore_mac_objc.mm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index ce4f01625e..db7e55f4b1 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<const NSString *>( + 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(); } } |