summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2014-05-30 17:56:03 -0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-31 01:27:44 +0200
commit42f9a61608fe662e797dc6541f4e82c19b878d56 (patch)
tree0d64a2aade224a469d1de12689d1d41cccc0787a
parent2d75c21923d3a74a6eafa11945e14a2cb7533059 (diff)
Fix QSysInfo::macVersion for OS X minor versions greater than 9.
gestaltSystemVersion's encoding only has room for a single version digit. Thus, OS X 10.10 would previously have been detected as OS X 10.9 (Apple's comments in the header even warn against this). Change-Id: I41c35b1507d39e2958a9aaffaa8c48ac380f61d9 Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/global/qglobal.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 66664f0f2a..d7c166721e 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1770,8 +1770,9 @@ QSysInfo::MacVersion QSysInfo::macVersion()
{
#if defined(Q_OS_OSX)
SInt32 gestalt_version;
- if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
- return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2);
+ if (Gestalt(gestaltSystemVersionMinor, &gestalt_version) == noErr) {
+ // add 2 because OS X 10.0 is 0x02 in the enum
+ return QSysInfo::MacVersion(gestalt_version + 2);
}
#elif defined(Q_OS_IOS)
return qt_ios_version(); // qtcore_mac_objc.mm