From e2ef24919e8f9dbefa06161d5b6fe5cbc6eb7bd5 Mon Sep 17 00:00:00 2001 From: michi_cc Date: Sun, 4 Oct 2009 20:53:30 +0000 Subject: (svn r17704) -Codechange: [OSX] Improve detection of OS X version. (planetmaker) --- src/os/macosx/macos.h | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'src/os/macosx/macos.h') diff --git a/src/os/macosx/macos.h b/src/os/macosx/macos.h index 247f4427d..7783257bc 100644 --- a/src/os/macosx/macos.h +++ b/src/os/macosx/macos.h @@ -54,25 +54,7 @@ void ShowMacErrorDialog(const char *error); (__builtin_expect(!(e), 0) ? ShowMacAssertDialog ( __func__, __FILE__, __LINE__, #e ): (void)0 ) #endif - - -/** - * Get the major version of Mac OS we are running under. Useful for things like the cocoa driver. - * @return major version of the os. This would be 10 in the case of 10.4.11. - */ -long GetMacOSVersionMajor(); - -/** - * Get the minor version of Mac OS we are running under. Useful for things like the cocoa driver. - * @return minor version of the os. This would be 4 in the case of 10.4.11. - */ -long GetMacOSVersionMinor(); - -/** - * Get the bugfix version of Mac OS we are running under. Useful for things like the cocoa driver. - * @return bugfix version of the os. This would be 11 in the case of 10.4.11. - */ -long GetMacOSVersionBugfix(); +void GetMacOSVersion(int *return_major, int *return_minor, int *return_bugfix); /** * Check if we are at least running on the specified version of Mac OS. @@ -83,13 +65,12 @@ long GetMacOSVersionBugfix(); */ static inline bool MacOSVersionIsAtLeast(long major, long minor, long bugfix) { - long maj = GetMacOSVersionMajor(); - long min = GetMacOSVersionMinor(); - long bf = GetMacOSVersionBugfix(); + int version_major, version_minor, version_bugfix; + GetMacOSVersion(&version_major, &version_minor, &version_bugfix); - if (maj < major) return false; - if (maj == major && min < minor) return false; - if (maj == major && min == minor && bf < bugfix) return false; + if (version_major < major) return false; + if (version_major == major && version_minor < minor) return false; + if (version_major == major && version_minor == minor && version_bugfix < bugfix) return false; return true; } -- cgit v1.2.3-54-g00ecf