summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2016-03-20 11:13:48 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2016-03-27 12:38:17 +0200
commit32aaa52ed4f9d34339d09bc9f83a762151c0702d (patch)
tree051434b9f107f72667e9008a025b778b85051f51
parent8624392f7ecb6c3126d1bd84c6857a2986a0fa08 (diff)
downloadrockbox-32aaa52ed4f9d34339d09bc9f83a762151c0702d.tar.gz
rockbox-32aaa52ed4f9d34339d09bc9f83a762151c0702d.zip
Use Gestalt to get number of CPUs on OS X.
MPProcessors has been deprecated with 10.7. When targeting 10.7 (required when building with Qt 5.6 on OS X) this causes a warning. Use Gestalt instead (Gestalt has been deprecated with 10.8, but when targeting 10.7 this doesn't cause a warning, and Gestalt is used for other values as well). Change-Id: Iaf82147ad47115e228f5c08f8198a6a7e92102a3
-rw-r--r--rbutil/rbutilqt/base/system.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/rbutil/rbutilqt/base/system.cpp b/rbutil/rbutilqt/base/system.cpp
index 3e3f18fd81..55e92908ab 100644
--- a/rbutil/rbutilqt/base/system.cpp
+++ b/rbutil/rbutilqt/base/system.cpp
@@ -186,7 +186,8 @@ QString System::osVersionString(void)
186 ret = uname(&u); 186 ret = uname(&u);
187 187
188#if defined(Q_OS_MACX) 188#if defined(Q_OS_MACX)
189 ItemCount cores = MPProcessors(); 189 SInt32 cores;
190 Gestalt(gestaltCountOfCPUs, &cores);
190#else 191#else
191 long cores = sysconf(_SC_NPROCESSORS_ONLN); 192 long cores = sysconf(_SC_NPROCESSORS_ONLN);
192#endif 193#endif
@@ -202,28 +203,27 @@ QString System::osVersionString(void)
202 SInt32 major; 203 SInt32 major;
203 SInt32 minor; 204 SInt32 minor;
204 SInt32 bugfix; 205 SInt32 bugfix;
205 OSErr error; 206 Gestalt(gestaltSystemVersionMajor, &major);
206 error = Gestalt(gestaltSystemVersionMajor, &major); 207 Gestalt(gestaltSystemVersionMinor, &minor);
207 error = Gestalt(gestaltSystemVersionMinor, &minor); 208 Gestalt(gestaltSystemVersionBugFix, &bugfix);
208 error = Gestalt(gestaltSystemVersionBugFix, &bugfix);
209 209
210 result += QString("<br/>OS X %1.%2.%3 ").arg(major).arg(minor).arg(bugfix); 210 result += QString("<br/>OS X %1.%2.%3 ").arg(major).arg(minor).arg(bugfix);
211 // 1: 86k, 2: ppc, 10: i386 211 // 1: 86k, 2: ppc, 10: i386
212 SInt32 arch; 212 SInt32 arch;
213 error = Gestalt(gestaltSysArchitecture, &arch); 213 Gestalt(gestaltSysArchitecture, &arch);
214 switch(arch) { 214 switch(arch) {
215 case 1: 215 case 1:
216 result.append("(86k)"); 216 result.append("(86k)");
217 break; 217 break;
218 case 2: 218 case 2:
219 result.append("(ppc)"); 219 result.append("(ppc)");
220 break; 220 break;
221 case 10: 221 case 10:
222 result.append("(x86)"); 222 result.append("(x86)");
223 break; 223 break;
224 default: 224 default:
225 result.append("(unknown)"); 225 result.append("(unknown)");
226 break; 226 break;
227 } 227 }
228#endif 228#endif
229#endif 229#endif