changeset 11531:23734bd05e51 draft

(svn r15892) -Codechange: [OSX] some type fixes so OpenTTD likes more of the 3.1.x Xcodes.
author rubidium <rubidium@openttd.org>
date Sun, 29 Mar 2009 19:55:08 +0000
parents bb3f530f9495
children 3e68dda0f8af
files src/os/macosx/macos.mm src/os/macosx/osx_stdafx.h src/stdafx.h src/video/cocoa/fullscreen.mm src/video/cocoa/wnd_quartz.mm
diffstat 5 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/macosx/macos.mm
+++ b/src/os/macosx/macos.mm
@@ -33,7 +33,7 @@
 	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 @@
  */
 static long GetMacOSVersion()
 {
-	static long sysVersion = -1;
+	static SInt32 sysVersion = -1;
 
 	if (sysVersion != -1) return sysVersion;
 
@@ -211,7 +211,7 @@
 
 long GetMacOSVersionMajor()
 {
-	static long sysVersion = -1;
+	static SInt32 sysVersion = -1;
 
 	if (sysVersion != -1) return sysVersion;
 
@@ -229,7 +229,7 @@
 
 long GetMacOSVersionMinor()
 {
-	static long sysVersion = -1;
+	static SInt32 sysVersion = -1;
 
 	if (sysVersion != -1) return sysVersion;
 
@@ -247,7 +247,7 @@
 
 long GetMacOSVersionBugfix()
 {
-	static long sysVersion = -1;
+	static SInt32 sysVersion = -1;
 
 	if (sysVersion != -1) return sysVersion;
 
--- 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 */
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -5,6 +5,10 @@
 #ifndef STDAFX_H
 #define STDAFX_H
 
+#if defined(__APPLE__)
+	#include "os/macosx/osx_stdafx.h"
+#endif /* __APPLE__ */
+
 #if defined(__NDS__)
 	#include <nds/jtypes.h>
 	/* NDS' types for uint32/int32 are based on longs, which causes
@@ -104,10 +108,6 @@
 	#define CLIB_USERGROUP_PROTOS_H
 #endif /* __MORPHOS__ */
 
-#if defined(__APPLE__)
-	#include "os/macosx/osx_stdafx.h"
-#endif /* __APPLE__ */
-
 #if defined(PSP)
 	/* PSP can only have 10 file-descriptors open at any given time, but this
 	 *  switch only limits reads via the Fio system. So keep 2 fds free for things
--- a/src/video/cocoa/fullscreen.mm
+++ b/src/video/cocoa/fullscreen.mm
@@ -299,7 +299,7 @@
 
 	bool SetVideoMode(int w, int h)
 	{
-		int exact_match;
+		boolean_t exact_match;
 		CFNumberRef number;
 		int bpp;
 		int gamma_error;
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -65,7 +65,7 @@
 - (void)appDidHide:(NSNotification*)note;
 - (void)appWillUnhide:(NSNotification*)note;
 - (void)appDidUnhide:(NSNotification*)note;
-- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag;
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag;
 @end
 
 /* Delegate for our NSWindow to send ask for quit on close */
@@ -264,7 +264,7 @@
 }
 
 
-- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
 {
 	/* Make our window subclass receive these application notifications */
 	[ [ NSNotificationCenter defaultCenter ] addObserver:self
@@ -336,7 +336,7 @@
 	CGImageRef    clippedImage;
 	NSRect        rect;
 	const NSRect *dirtyRects;
-	int           dirtyRectCount;
+	NSInteger     dirtyRectCount;
 	int           n;
 	CGRect        clipRect;
 	CGRect        blitRect;