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>
This commit is contained in:
Jake Petroules 2017-08-07 13:32:49 -07:00
parent 38bfe7a279
commit 874837b4cc

View File

@ -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();
}
}