Fixed a bunch more compiler warnings in the 1.2 branch. SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Thu, 13 Oct 2011 16:38:05 -0400
branchSDL-1.2
changeset 5988bf927e528813
parent 5987 825e1072eac6
child 6047 54b2716f595d
Fixed a bunch more compiler warnings in the 1.2 branch.
src/cdrom/beos/SDL_syscdrom.cc
src/file/SDL_rwops.c
src/video/SDL_bmp.c
src/video/wincommon/SDL_sysevents.c
src/video/windx5/SDL_dx5video.c
     1.1 --- a/src/cdrom/beos/SDL_syscdrom.cc	Thu Oct 13 16:35:25 2011 -0400
     1.2 +++ b/src/cdrom/beos/SDL_syscdrom.cc	Thu Oct 13 16:38:05 2011 -0400
     1.3 @@ -150,8 +150,6 @@
     1.4  int  SDL_SYS_CDInit(void)
     1.5  {
     1.6  	char *SDLcdrom;
     1.7 -	int raw_fd;
     1.8 -	struct ide_ctrl_info info;
     1.9  
    1.10  	/* Fill in our driver capabilities */
    1.11  	SDL_CDcaps.Name = SDL_SYS_CDName;
     2.1 --- a/src/file/SDL_rwops.c	Thu Oct 13 16:35:25 2011 -0400
     2.2 +++ b/src/file/SDL_rwops.c	Thu Oct 13 16:38:05 2011 -0400
     2.3 @@ -485,6 +485,7 @@
     2.4  	SDL_RWops *rwops = NULL;
     2.5  #ifdef HAVE_STDIO_H
     2.6  	FILE *fp = NULL;
     2.7 +	(void) fp;
     2.8  #endif
     2.9  	if ( !file || !*file || !mode || !*mode ) {
    2.10  		SDL_SetError("SDL_RWFromFile(): No file or no mode specified");
     3.1 --- a/src/video/SDL_bmp.c	Thu Oct 13 16:35:25 2011 -0400
     3.2 +++ b/src/video/SDL_bmp.c	Thu Oct 13 16:38:05 2011 -0400
     3.3 @@ -48,7 +48,7 @@
     3.4  SDL_Surface * SDL_LoadBMP_RW (SDL_RWops *src, int freesrc)
     3.5  {
     3.6  	SDL_bool was_error;
     3.7 -	long fp_offset;
     3.8 +	long fp_offset = 0;
     3.9  	int bmpPitch;
    3.10  	int i, pad;
    3.11  	SDL_Surface *surface;
     4.1 --- a/src/video/wincommon/SDL_sysevents.c	Thu Oct 13 16:35:25 2011 -0400
     4.2 +++ b/src/video/wincommon/SDL_sysevents.c	Thu Oct 13 16:38:05 2011 -0400
     4.3 @@ -220,13 +220,13 @@
     4.4  static VOID CALLBACK
     4.5  TrackMouseTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime)
     4.6  {
     4.7 -	RECT rect;
     4.8 +	union { RECT rect; POINT pt; } rectpt;  /* prevent type-punning issue. */
     4.9  	POINT pt;
    4.10  
    4.11 -	GetClientRect(hWnd, &rect);
    4.12 -	MapWindowPoints(hWnd, NULL, (LPPOINT)&rect, 2);
    4.13 +	GetClientRect(hWnd, &rectpt.rect);
    4.14 +	MapWindowPoints(hWnd, NULL, &rectpt.pt, 2);
    4.15  	GetCursorPos(&pt);
    4.16 -	if ( !PtInRect(&rect, pt) || (WindowFromPoint(pt) != hWnd) ) {
    4.17 +	if ( !PtInRect(&rectpt.rect, pt) || (WindowFromPoint(pt) != hWnd) ) {
    4.18  		if ( !KillTimer(hWnd, idEvent) ) {
    4.19  			/* Error killing the timer! */
    4.20  		}
    4.21 @@ -572,11 +572,24 @@
    4.22  
    4.23  		case WM_WINDOWPOSCHANGED: {
    4.24  			SDL_VideoDevice *this = current_video;
    4.25 +			POINT pt;
    4.26  			int w, h;
    4.27  
    4.28  			GetClientRect(SDL_Window, &SDL_bounds);
    4.29 -			ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds);
    4.30 -			ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds+1);
    4.31 +
    4.32 +			/* avoiding type-punning here... */
    4.33 +			pt.x = SDL_bounds.left;
    4.34 +			pt.y = SDL_bounds.top;
    4.35 +			ClientToScreen(SDL_Window, &pt);
    4.36 +			SDL_bounds.left = pt.x;
    4.37 +			SDL_bounds.top = pt.y;
    4.38 +
    4.39 +			pt.x = SDL_bounds.right;
    4.40 +			pt.y = SDL_bounds.bottom;
    4.41 +			ClientToScreen(SDL_Window, &pt);
    4.42 +			SDL_bounds.right = pt.x;
    4.43 +			SDL_bounds.bottom = pt.y;
    4.44 +
    4.45  			if ( !SDL_resizing && !IsZoomed(SDL_Window) &&
    4.46  			     SDL_PublicSurface &&
    4.47  				!(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {
    4.48 @@ -831,7 +844,7 @@
    4.49  
    4.50  	/* arg #3 should be const BYTE *, but cygwin lists it as PBYTE. */
    4.51  	if (ToAsciiEx(vkey, scancode, (PBYTE) keystate, (WORD*)chars, 0, GetKeyboardLayout(0)) == 1) {
    4.52 -		return MultiByteToWideChar(codepage, 0, chars, 1, wchars, wsize);
    4.53 +		return MultiByteToWideChar(codepage, 0, (LPCSTR) chars, 1, wchars, wsize);
    4.54  	}
    4.55  	return 0;
    4.56  }
     5.1 --- a/src/video/windx5/SDL_dx5video.c	Thu Oct 13 16:35:25 2011 -0400
     5.2 +++ b/src/video/windx5/SDL_dx5video.c	Thu Oct 13 16:38:05 2011 -0400
     5.3 @@ -1034,7 +1034,8 @@
     5.4  				int width, int height, int bpp, Uint32 flags)
     5.5  {
     5.6  	SDL_Surface *video;
     5.7 -	int prev_w, prev_h;
     5.8 +	int prev_w = -1;
     5.9 +	int prev_h = -1;
    5.10  	HRESULT result;
    5.11  	DWORD sharemode;
    5.12  	DWORD style;