changeset 1472:4aac8563c296

Fixed more Win64 portability issues
author Sam Lantinga <slouken@libsdl.org>
date Mon, 06 Mar 2006 08:11:10 +0000
parents 9fb0eee04dd9
children 73777b138913
files VisualCE.zip src/main/win32/SDL_win32_main.c src/stdlib/SDL_getenv.c src/video/gapi/SDL_gapivideo.c src/video/wincommon/SDL_lowvideo.h src/video/wincommon/SDL_sysevents.c src/video/wincommon/SDL_sysmouse.c src/video/wincommon/SDL_wingl.c src/video/windib/SDL_dibevents.c src/video/windib/SDL_dibvideo.c src/video/windx5/SDL_dx5events.c src/video/windx5/SDL_dx5video.c
diffstat 12 files changed, 28 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
Binary file VisualCE.zip has changed
--- a/src/main/win32/SDL_win32_main.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/main/win32/SDL_win32_main.c	Mon Mar 06 08:11:10 2006 +0000
@@ -166,7 +166,7 @@
 /* This is where execution begins [console apps] */
 int console_main(int argc, char *argv[])
 {
-	int n;
+	size_t n;
 	char *bufp, *appname;
 	int status;
 
--- a/src/stdlib/SDL_getenv.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/stdlib/SDL_getenv.c	Mon Mar 06 08:11:10 2006 +0000
@@ -69,7 +69,7 @@
 {
 	size_t bufferlen;
 
-	bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
+	bufferlen = GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
 	if ( bufferlen == 0 ) {
 		return NULL;
 	}
@@ -80,7 +80,7 @@
 		}
 		SDL_envmem = newmem;
 		SDL_envmemlen = bufferlen;
-		GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
+		GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
 	}
 	return SDL_envmem;
 }
--- a/src/video/gapi/SDL_gapivideo.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/gapi/SDL_gapivideo.c	Mon Mar 06 08:11:10 2006 +0000
@@ -710,7 +710,7 @@
 	style = 0;
 
 	if (!SDL_windowid)
-		SetWindowLong(SDL_Window, GWL_STYLE, style);
+		SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
 
 	/* Allocate bitmap */
 	if(gapiBuffer) 
--- a/src/video/wincommon/SDL_lowvideo.h	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/wincommon/SDL_lowvideo.h	Mon Mar 06 08:11:10 2006 +0000
@@ -36,6 +36,9 @@
 #ifndef SetWindowLongPtr
 #define SetWindowLongPtr	SetWindowLong
 #endif
+#ifndef GWLP_WNDPROC
+#define GWLP_WNDPROC	GWL_WNDPROC
+#endif
 
 #include "../SDL_sysvideo.h"
 
--- a/src/video/wincommon/SDL_sysevents.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/wincommon/SDL_sysevents.c	Mon Mar 06 08:11:10 2006 +0000
@@ -562,7 +562,7 @@
 			   Aparently it's too difficult for MS to check
 			   inside their function, so I have to do it here.
           		 */
-         		style = GetWindowLong(hwnd, GWL_STYLE);
+         		style = GetWindowLongPtr(hwnd, GWL_STYLE);
          		AdjustWindowRect(
 				&size,
 				style,
--- a/src/video/wincommon/SDL_sysmouse.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/wincommon/SDL_sysmouse.c	Mon Mar 06 08:11:10 2006 +0000
@@ -172,7 +172,7 @@
 
 	/* Create the cursor */
 	cursor->curs = CreateCursor(
-			(HINSTANCE)GetWindowLongPtr(SDL_Window, GWL_HINSTANCE),
+			(HINSTANCE)GetWindowLongPtr(SDL_Window, GWLP_HINSTANCE),
 					hot_x, hot_y, allowed_x, allowed_y, 
 						cursor->ands, cursor->xors);
 	if ( cursor->curs == NULL ) {
--- a/src/video/wincommon/SDL_wingl.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/wincommon/SDL_wingl.c	Mon Mar 06 08:11:10 2006 +0000
@@ -45,7 +45,7 @@
 		/* Save the existing window attributes */
 		LONG style;
 		RECT rect = { 0, 0, 0, 0 };
-		style = GetWindowLong(SDL_Window, GWL_STYLE);
+		style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
 		GetWindowRect(SDL_Window, &rect);
 		DestroyWindow(SDL_Window);
 		SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
--- a/src/video/windib/SDL_dibevents.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/windib/SDL_dibevents.c	Mon Mar 06 08:11:10 2006 +0000
@@ -43,7 +43,7 @@
 
 /* The translation table from a Microsoft VK keysym to a SDL keysym */
 static SDLKey VK_keymap[SDLK_LAST];
-static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed);
+static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed);
 
 /* Masks for processing the windows KEYDOWN and KEYUP messages */
 #define REPEATED_KEYMASK	(1<<30)
@@ -376,7 +376,7 @@
 	VK_keymap[VK_APPS] = SDLK_MENU;
 }
 
-static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed)
+static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed)
 {
 	/* Set the keysym information */
 	keysym->scancode = (unsigned char) scancode;
@@ -426,8 +426,8 @@
 		/* DJM: we want all event's for the user specified
 			window to be handled by SDL.
 		 */
-		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
-		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
+		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC);
+		SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage);
 	} else {
 		SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
                         (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
@@ -444,7 +444,7 @@
 void DIB_DestroyWindow(_THIS)
 {
 	if ( SDL_windowid ) {
-		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
+		SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc);
 	} else {
 		DestroyWindow(SDL_Window);
 	}
--- a/src/video/windib/SDL_dibvideo.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Mon Mar 06 08:11:10 2006 +0000
@@ -647,7 +647,7 @@
 		screen_pal = DIB_CreatePalette(bpp);
 	}
 
-	style = GetWindowLong(SDL_Window, GWL_STYLE);
+	style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
 	style &= ~(resizestyle|WS_MAXIMIZE);
 	if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
 		style &= ~windowstyle;
@@ -677,7 +677,7 @@
 
 	/* DJM: Don't piss of anyone who has setup his own window */
 	if ( !SDL_windowid )
-		SetWindowLong(SDL_Window, GWL_STYLE, style);
+		SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
 
 	/* Delete the old bitmap if necessary */
 	if ( screen_bmp != NULL ) {
@@ -780,7 +780,7 @@
 		bounds.top = SDL_windowY;
 		bounds.right = SDL_windowX+video->w;
 		bounds.bottom = SDL_windowY+video->h;
-		AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
+		AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
 		width = bounds.right-bounds.left;
 		height = bounds.bottom-bounds.top;
 		if ( (flags & SDL_FULLSCREEN) ) {
--- a/src/video/windx5/SDL_dx5events.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/windx5/SDL_dx5events.c	Mon Mar 06 08:11:10 2006 +0000
@@ -874,8 +874,8 @@
 		/* DJM: we want all event's for the user specified
 			window to be handled by SDL.
 		 */
-		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
-		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
+		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC);
+		SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage);
 	} else {
 		SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
                         (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
@@ -903,7 +903,7 @@
 
 	/* Destroy our window */
 	if ( SDL_windowid ) {
-		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
+		SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc);
 	} else {
 		DestroyWindow(SDL_Window);
 	}
--- a/src/video/windx5/SDL_dx5video.c	Mon Mar 06 07:42:36 2006 +0000
+++ b/src/video/windx5/SDL_dx5video.c	Mon Mar 06 08:11:10 2006 +0000
@@ -1123,7 +1123,7 @@
 		}
 #endif /* !NO_CHANGEDISPLAYSETTINGS */
 
-		style = GetWindowLong(SDL_Window, GWL_STYLE);
+		style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
 		style &= ~(resizestyle|WS_MAXIMIZE);
 		if ( video->flags & SDL_FULLSCREEN ) {
 			style &= ~windowstyle;
@@ -1148,7 +1148,7 @@
 
 		/* DJM: Don't piss of anyone who has setup his own window */
 		if ( !SDL_windowid )
-			SetWindowLong(SDL_Window, GWL_STYLE, style);
+			SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
 
 		/* Resize the window (copied from SDL WinDIB driver) */
 		if ( !SDL_windowid && !IsZoomed(SDL_Window) ) {
@@ -1178,7 +1178,7 @@
 			bounds.top = SDL_windowY;
 			bounds.right = SDL_windowX+video->w;
 			bounds.bottom = SDL_windowY+video->h;
-			AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
+			AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
 			width = bounds.right-bounds.left;
 			height = bounds.bottom-bounds.top;
 			if ( (flags & SDL_FULLSCREEN) ) {
@@ -1217,7 +1217,7 @@
 	}
 
 	/* Set the appropriate window style */
-	style = GetWindowLong(SDL_Window, GWL_STYLE);
+	style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
 	style &= ~(resizestyle|WS_MAXIMIZE);
 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
 		style &= ~windowstyle;
@@ -1239,7 +1239,7 @@
 	}
 	/* DJM: Don't piss of anyone who has setup his own window */
 	if ( !SDL_windowid )
-		SetWindowLong(SDL_Window, GWL_STYLE, style);
+		SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
 
 	/* Set DirectDraw sharing mode.. exclusive when fullscreen */
 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
@@ -1264,7 +1264,7 @@
 		bounds.top = 0;
 		bounds.right = GetSystemMetrics(SM_CXSCREEN);
 		bounds.bottom = GetSystemMetrics(SM_CYSCREEN);
-		AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
+		AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
 		SetWindowPos(SDL_Window, HWND_TOPMOST,
 			bounds.left, bounds.top, 
 			bounds.right - bounds.left,
@@ -1581,7 +1581,7 @@
 			bounds.top = SDL_windowY;
 			bounds.right = SDL_windowX+video->w;
 			bounds.bottom = SDL_windowY+video->h;
-			AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
+			AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
 			width = bounds.right-bounds.left;
 			height = bounds.bottom-bounds.top;
 			if ( center ) {