summaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/os')
-rw-r--r--src/os/macosx/macos.mm10
-rw-r--r--src/os/macosx/osx_stdafx.h22
2 files changed, 27 insertions, 5 deletions
diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm
index 090e5f4b3..a79626026 100644
--- a/src/os/macosx/macos.mm
+++ b/src/os/macosx/macos.mm
@@ -33,7 +33,7 @@ static char *GetOSString()
const char *CPU;
char OS[20];
char newgrf[125];
- long sysVersion;
+ SInt32 sysVersion;
// get the hardware info
host_basic_info_data_t hostInfo;
@@ -201,7 +201,7 @@ const char *GetCurrentLocale(const char *)
*/
static long GetMacOSVersion()
{
- static long sysVersion = -1;
+ static SInt32 sysVersion = -1;
if (sysVersion != -1) return sysVersion;
@@ -211,7 +211,7 @@ static long GetMacOSVersion()
long GetMacOSVersionMajor()
{
- static long sysVersion = -1;
+ static SInt32 sysVersion = -1;
if (sysVersion != -1) return sysVersion;
@@ -229,7 +229,7 @@ long GetMacOSVersionMajor()
long GetMacOSVersionMinor()
{
- static long sysVersion = -1;
+ static SInt32 sysVersion = -1;
if (sysVersion != -1) return sysVersion;
@@ -247,7 +247,7 @@ long GetMacOSVersionMinor()
long GetMacOSVersionBugfix()
{
- static long sysVersion = -1;
+ static SInt32 sysVersion = -1;
if (sysVersion != -1) return sysVersion;
diff --git a/src/os/macosx/osx_stdafx.h b/src/os/macosx/osx_stdafx.h
index e8589b61f..8faa26e5c 100644
--- a/src/os/macosx/osx_stdafx.h
+++ b/src/os/macosx/osx_stdafx.h
@@ -5,7 +5,18 @@
#ifndef MACOS_STDAFX_H
#define MACOS_STDAFX_H
+/* __LP64__ only exists in 10.5 and higher */
+#if defined(__APPLE__) && !defined(__LP64__)
+# define __LP64__ 0
+#endif
+
+/* Check for mismatching 'architectures' */
+#if (__LP64__ && !defined(_SQ64)) || (!__LP64__ && defined(_SQ64))
+# error "Compiling 64 bits without _SQ64 set! (or vice versa)"
+#endif
+
#include <CoreServices/CoreServices.h>
+
/* remove the variables that CoreServices defines, but we define ourselves too */
#undef bool
#undef false
@@ -16,4 +27,15 @@
#define SL_ERROR OSX_SL_ERROR
+/* NSInteger and NSUInteger are part of 10.5 and higher. */
+#ifndef NSInteger
+#if __LP64__
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+#else
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+#endif /* __LP64__ */
+#endif /* NSInteger */
+
#endif /* MACOS_STDAFX_H */