Fixed more Win64 portability issues
authorSam Lantinga <slouken@libsdl.org>
Mon, 06 Mar 2006 08:11:10 +0000
changeset 14724aac8563c296
parent 1471 9fb0eee04dd9
child 1473 73777b138913
Fixed more Win64 portability issues
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
     1.1 Binary file VisualCE.zip has changed
     2.1 --- a/src/main/win32/SDL_win32_main.c	Mon Mar 06 07:42:36 2006 +0000
     2.2 +++ b/src/main/win32/SDL_win32_main.c	Mon Mar 06 08:11:10 2006 +0000
     2.3 @@ -166,7 +166,7 @@
     2.4  /* This is where execution begins [console apps] */
     2.5  int console_main(int argc, char *argv[])
     2.6  {
     2.7 -	int n;
     2.8 +	size_t n;
     2.9  	char *bufp, *appname;
    2.10  	int status;
    2.11  
     3.1 --- a/src/stdlib/SDL_getenv.c	Mon Mar 06 07:42:36 2006 +0000
     3.2 +++ b/src/stdlib/SDL_getenv.c	Mon Mar 06 08:11:10 2006 +0000
     3.3 @@ -69,7 +69,7 @@
     3.4  {
     3.5  	size_t bufferlen;
     3.6  
     3.7 -	bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
     3.8 +	bufferlen = GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
     3.9  	if ( bufferlen == 0 ) {
    3.10  		return NULL;
    3.11  	}
    3.12 @@ -80,7 +80,7 @@
    3.13  		}
    3.14  		SDL_envmem = newmem;
    3.15  		SDL_envmemlen = bufferlen;
    3.16 -		GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
    3.17 +		GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
    3.18  	}
    3.19  	return SDL_envmem;
    3.20  }
     4.1 --- a/src/video/gapi/SDL_gapivideo.c	Mon Mar 06 07:42:36 2006 +0000
     4.2 +++ b/src/video/gapi/SDL_gapivideo.c	Mon Mar 06 08:11:10 2006 +0000
     4.3 @@ -710,7 +710,7 @@
     4.4  	style = 0;
     4.5  
     4.6  	if (!SDL_windowid)
     4.7 -		SetWindowLong(SDL_Window, GWL_STYLE, style);
     4.8 +		SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
     4.9  
    4.10  	/* Allocate bitmap */
    4.11  	if(gapiBuffer) 
     5.1 --- a/src/video/wincommon/SDL_lowvideo.h	Mon Mar 06 07:42:36 2006 +0000
     5.2 +++ b/src/video/wincommon/SDL_lowvideo.h	Mon Mar 06 08:11:10 2006 +0000
     5.3 @@ -36,6 +36,9 @@
     5.4  #ifndef SetWindowLongPtr
     5.5  #define SetWindowLongPtr	SetWindowLong
     5.6  #endif
     5.7 +#ifndef GWLP_WNDPROC
     5.8 +#define GWLP_WNDPROC	GWL_WNDPROC
     5.9 +#endif
    5.10  
    5.11  #include "../SDL_sysvideo.h"
    5.12  
     6.1 --- a/src/video/wincommon/SDL_sysevents.c	Mon Mar 06 07:42:36 2006 +0000
     6.2 +++ b/src/video/wincommon/SDL_sysevents.c	Mon Mar 06 08:11:10 2006 +0000
     6.3 @@ -562,7 +562,7 @@
     6.4  			   Aparently it's too difficult for MS to check
     6.5  			   inside their function, so I have to do it here.
     6.6            		 */
     6.7 -         		style = GetWindowLong(hwnd, GWL_STYLE);
     6.8 +         		style = GetWindowLongPtr(hwnd, GWL_STYLE);
     6.9           		AdjustWindowRect(
    6.10  				&size,
    6.11  				style,
     7.1 --- a/src/video/wincommon/SDL_sysmouse.c	Mon Mar 06 07:42:36 2006 +0000
     7.2 +++ b/src/video/wincommon/SDL_sysmouse.c	Mon Mar 06 08:11:10 2006 +0000
     7.3 @@ -172,7 +172,7 @@
     7.4  
     7.5  	/* Create the cursor */
     7.6  	cursor->curs = CreateCursor(
     7.7 -			(HINSTANCE)GetWindowLongPtr(SDL_Window, GWL_HINSTANCE),
     7.8 +			(HINSTANCE)GetWindowLongPtr(SDL_Window, GWLP_HINSTANCE),
     7.9  					hot_x, hot_y, allowed_x, allowed_y, 
    7.10  						cursor->ands, cursor->xors);
    7.11  	if ( cursor->curs == NULL ) {
     8.1 --- a/src/video/wincommon/SDL_wingl.c	Mon Mar 06 07:42:36 2006 +0000
     8.2 +++ b/src/video/wincommon/SDL_wingl.c	Mon Mar 06 08:11:10 2006 +0000
     8.3 @@ -45,7 +45,7 @@
     8.4  		/* Save the existing window attributes */
     8.5  		LONG style;
     8.6  		RECT rect = { 0, 0, 0, 0 };
     8.7 -		style = GetWindowLong(SDL_Window, GWL_STYLE);
     8.8 +		style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
     8.9  		GetWindowRect(SDL_Window, &rect);
    8.10  		DestroyWindow(SDL_Window);
    8.11  		SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
     9.1 --- a/src/video/windib/SDL_dibevents.c	Mon Mar 06 07:42:36 2006 +0000
     9.2 +++ b/src/video/windib/SDL_dibevents.c	Mon Mar 06 08:11:10 2006 +0000
     9.3 @@ -43,7 +43,7 @@
     9.4  
     9.5  /* The translation table from a Microsoft VK keysym to a SDL keysym */
     9.6  static SDLKey VK_keymap[SDLK_LAST];
     9.7 -static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed);
     9.8 +static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed);
     9.9  
    9.10  /* Masks for processing the windows KEYDOWN and KEYUP messages */
    9.11  #define REPEATED_KEYMASK	(1<<30)
    9.12 @@ -376,7 +376,7 @@
    9.13  	VK_keymap[VK_APPS] = SDLK_MENU;
    9.14  }
    9.15  
    9.16 -static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed)
    9.17 +static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed)
    9.18  {
    9.19  	/* Set the keysym information */
    9.20  	keysym->scancode = (unsigned char) scancode;
    9.21 @@ -426,8 +426,8 @@
    9.22  		/* DJM: we want all event's for the user specified
    9.23  			window to be handled by SDL.
    9.24  		 */
    9.25 -		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
    9.26 -		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
    9.27 +		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC);
    9.28 +		SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage);
    9.29  	} else {
    9.30  		SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
    9.31                          (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
    9.32 @@ -444,7 +444,7 @@
    9.33  void DIB_DestroyWindow(_THIS)
    9.34  {
    9.35  	if ( SDL_windowid ) {
    9.36 -		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
    9.37 +		SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc);
    9.38  	} else {
    9.39  		DestroyWindow(SDL_Window);
    9.40  	}
    10.1 --- a/src/video/windib/SDL_dibvideo.c	Mon Mar 06 07:42:36 2006 +0000
    10.2 +++ b/src/video/windib/SDL_dibvideo.c	Mon Mar 06 08:11:10 2006 +0000
    10.3 @@ -647,7 +647,7 @@
    10.4  		screen_pal = DIB_CreatePalette(bpp);
    10.5  	}
    10.6  
    10.7 -	style = GetWindowLong(SDL_Window, GWL_STYLE);
    10.8 +	style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
    10.9  	style &= ~(resizestyle|WS_MAXIMIZE);
   10.10  	if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
   10.11  		style &= ~windowstyle;
   10.12 @@ -677,7 +677,7 @@
   10.13  
   10.14  	/* DJM: Don't piss of anyone who has setup his own window */
   10.15  	if ( !SDL_windowid )
   10.16 -		SetWindowLong(SDL_Window, GWL_STYLE, style);
   10.17 +		SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
   10.18  
   10.19  	/* Delete the old bitmap if necessary */
   10.20  	if ( screen_bmp != NULL ) {
   10.21 @@ -780,7 +780,7 @@
   10.22  		bounds.top = SDL_windowY;
   10.23  		bounds.right = SDL_windowX+video->w;
   10.24  		bounds.bottom = SDL_windowY+video->h;
   10.25 -		AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
   10.26 +		AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
   10.27  		width = bounds.right-bounds.left;
   10.28  		height = bounds.bottom-bounds.top;
   10.29  		if ( (flags & SDL_FULLSCREEN) ) {
    11.1 --- a/src/video/windx5/SDL_dx5events.c	Mon Mar 06 07:42:36 2006 +0000
    11.2 +++ b/src/video/windx5/SDL_dx5events.c	Mon Mar 06 08:11:10 2006 +0000
    11.3 @@ -874,8 +874,8 @@
    11.4  		/* DJM: we want all event's for the user specified
    11.5  			window to be handled by SDL.
    11.6  		 */
    11.7 -		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
    11.8 -		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
    11.9 +		userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC);
   11.10 +		SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage);
   11.11  	} else {
   11.12  		SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
   11.13                          (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
   11.14 @@ -903,7 +903,7 @@
   11.15  
   11.16  	/* Destroy our window */
   11.17  	if ( SDL_windowid ) {
   11.18 -		SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
   11.19 +		SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc);
   11.20  	} else {
   11.21  		DestroyWindow(SDL_Window);
   11.22  	}
    12.1 --- a/src/video/windx5/SDL_dx5video.c	Mon Mar 06 07:42:36 2006 +0000
    12.2 +++ b/src/video/windx5/SDL_dx5video.c	Mon Mar 06 08:11:10 2006 +0000
    12.3 @@ -1123,7 +1123,7 @@
    12.4  		}
    12.5  #endif /* !NO_CHANGEDISPLAYSETTINGS */
    12.6  
    12.7 -		style = GetWindowLong(SDL_Window, GWL_STYLE);
    12.8 +		style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
    12.9  		style &= ~(resizestyle|WS_MAXIMIZE);
   12.10  		if ( video->flags & SDL_FULLSCREEN ) {
   12.11  			style &= ~windowstyle;
   12.12 @@ -1148,7 +1148,7 @@
   12.13  
   12.14  		/* DJM: Don't piss of anyone who has setup his own window */
   12.15  		if ( !SDL_windowid )
   12.16 -			SetWindowLong(SDL_Window, GWL_STYLE, style);
   12.17 +			SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
   12.18  
   12.19  		/* Resize the window (copied from SDL WinDIB driver) */
   12.20  		if ( !SDL_windowid && !IsZoomed(SDL_Window) ) {
   12.21 @@ -1178,7 +1178,7 @@
   12.22  			bounds.top = SDL_windowY;
   12.23  			bounds.right = SDL_windowX+video->w;
   12.24  			bounds.bottom = SDL_windowY+video->h;
   12.25 -			AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
   12.26 +			AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
   12.27  			width = bounds.right-bounds.left;
   12.28  			height = bounds.bottom-bounds.top;
   12.29  			if ( (flags & SDL_FULLSCREEN) ) {
   12.30 @@ -1217,7 +1217,7 @@
   12.31  	}
   12.32  
   12.33  	/* Set the appropriate window style */
   12.34 -	style = GetWindowLong(SDL_Window, GWL_STYLE);
   12.35 +	style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
   12.36  	style &= ~(resizestyle|WS_MAXIMIZE);
   12.37  	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
   12.38  		style &= ~windowstyle;
   12.39 @@ -1239,7 +1239,7 @@
   12.40  	}
   12.41  	/* DJM: Don't piss of anyone who has setup his own window */
   12.42  	if ( !SDL_windowid )
   12.43 -		SetWindowLong(SDL_Window, GWL_STYLE, style);
   12.44 +		SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
   12.45  
   12.46  	/* Set DirectDraw sharing mode.. exclusive when fullscreen */
   12.47  	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
   12.48 @@ -1264,7 +1264,7 @@
   12.49  		bounds.top = 0;
   12.50  		bounds.right = GetSystemMetrics(SM_CXSCREEN);
   12.51  		bounds.bottom = GetSystemMetrics(SM_CYSCREEN);
   12.52 -		AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
   12.53 +		AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
   12.54  		SetWindowPos(SDL_Window, HWND_TOPMOST,
   12.55  			bounds.left, bounds.top, 
   12.56  			bounds.right - bounds.left,
   12.57 @@ -1581,7 +1581,7 @@
   12.58  			bounds.top = SDL_windowY;
   12.59  			bounds.right = SDL_windowX+video->w;
   12.60  			bounds.bottom = SDL_windowY+video->h;
   12.61 -			AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
   12.62 +			AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
   12.63  			width = bounds.right-bounds.left;
   12.64  			height = bounds.bottom-bounds.top;
   12.65  			if ( center ) {