@@ -54,38 +54,32 @@ Version GetCurrentMacVersionImpl()
5454 AUTORELEASE_POOL;
5555
5656#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
57-
5857 NSProcessInfo *processInfo = [NSProcessInfo processInfo ];
5958 if ([processInfo respondsToSelector: @selector (operatingSystemVersion )])
6059 {
6160 NSOperatingSystemVersion version = [processInfo operatingSystemVersion ];
6261 return CreateVersion (version.majorVersion , version.minorVersion , version.patchVersion );
6362 }
64-
6563#endif
6664
6765 SInt32 majorVersion = 0 , minorVersion = 0 , bugFixVersion = 0 ;
68- // / @note Gestalt is deprecated!
69- // Gestalt(gestaltSystemVersionMajor, &majorVersion);
70- // Gestalt(gestaltSystemVersionMinor, &minorVersion);
71- // Gestalt(gestaltSystemVersionBugFix, &bugFixVersion);
72-
66+ # if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
67+ Gestalt (gestaltSystemVersionMajor, &majorVersion);
68+ Gestalt (gestaltSystemVersionMinor, &minorVersion);
69+ Gestalt (gestaltSystemVersionBugFix, &bugFixVersion);
70+ # else
7371 typedef OSErr (*Gestalt_t)(OSType selector, SInt32 *response);
74- static Gestalt_t Gestalt_f = NULL ;
75- static bool hasInitializedGestalt = false ;
76- if (!hasInitializedGestalt)
77- {
78- CFBundleRef bundle = CFBundleGetBundleWithIdentifier (CFSTR (" com.apple.CoreServices" ));
79- if (bundle)
80- Gestalt_f = reinterpret_cast <Gestalt_t>(CFBundleGetFunctionPointerForName (bundle, CFSTR (" Gestalt" )));
81- hasInitializedGestalt = true ;
82- }
72+ Gestalt_t Gestalt_f = NULL ;
73+ CFBundleRef coreServicesBundle = CFBundleGetBundleWithIdentifier (CFSTR (" com.apple.CoreServices" ));
74+ if (coreServicesBundle)
75+ Gestalt_f = reinterpret_cast <Gestalt_t>(CFBundleGetFunctionPointerForName (coreServicesBundle, CFSTR (" Gestalt" )));
8376 if (Gestalt_f)
8477 {
8578 Gestalt_f (' sys1' , &majorVersion);
8679 Gestalt_f (' sys2' , &minorVersion);
8780 Gestalt_f (' sys3' , &bugFixVersion);
8881 }
82+ #endif
8983 return CreateVersion (majorVersion, minorVersion, bugFixVersion);
9084}
9185
0 commit comments