From 27176bdaf472bc8c162f44045bba13467086a4fe Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 13 Oct 2011 16:38:05 -0400 Subject: [PATCH] Fixed a bunch more compiler warnings in the 1.2 branch. --- src/cdrom/beos/SDL_syscdrom.cc | 2 -- src/file/SDL_rwops.c | 1 + src/video/SDL_bmp.c | 2 +- src/video/wincommon/SDL_sysevents.c | 27 ++++++++++++++++++++------- src/video/windx5/SDL_dx5video.c | 3 ++- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/cdrom/beos/SDL_syscdrom.cc b/src/cdrom/beos/SDL_syscdrom.cc index ef09dded5..6e0fb6e58 100644 --- a/src/cdrom/beos/SDL_syscdrom.cc +++ b/src/cdrom/beos/SDL_syscdrom.cc @@ -150,8 +150,6 @@ struct ide_ctrl_info { int SDL_SYS_CDInit(void) { char *SDLcdrom; - int raw_fd; - struct ide_ctrl_info info; /* Fill in our driver capabilities */ SDL_CDcaps.Name = SDL_SYS_CDName; diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index a7bbc28f0..ba451c73a 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -485,6 +485,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) SDL_RWops *rwops = NULL; #ifdef HAVE_STDIO_H FILE *fp = NULL; + (void) fp; #endif if ( !file || !*file || !mode || !*mode ) { SDL_SetError("SDL_RWFromFile(): No file or no mode specified"); diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index c517db666..3b8029edb 100644 --- a/src/video/SDL_bmp.c +++ b/src/video/SDL_bmp.c @@ -48,7 +48,7 @@ SDL_Surface * SDL_LoadBMP_RW (SDL_RWops *src, int freesrc) { SDL_bool was_error; - long fp_offset; + long fp_offset = 0; int bmpPitch; int i, pad; SDL_Surface *surface; diff --git a/src/video/wincommon/SDL_sysevents.c b/src/video/wincommon/SDL_sysevents.c index dfefef3e5..39af302b1 100644 --- a/src/video/wincommon/SDL_sysevents.c +++ b/src/video/wincommon/SDL_sysevents.c @@ -220,13 +220,13 @@ static BOOL (WINAPI *_TrackMouseEvent)(TRACKMOUSEEVENT *ptme) = NULL; static VOID CALLBACK TrackMouseTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime) { - RECT rect; + union { RECT rect; POINT pt; } rectpt; /* prevent type-punning issue. */ POINT pt; - GetClientRect(hWnd, &rect); - MapWindowPoints(hWnd, NULL, (LPPOINT)&rect, 2); + GetClientRect(hWnd, &rectpt.rect); + MapWindowPoints(hWnd, NULL, &rectpt.pt, 2); GetCursorPos(&pt); - if ( !PtInRect(&rect, pt) || (WindowFromPoint(pt) != hWnd) ) { + if ( !PtInRect(&rectpt.rect, pt) || (WindowFromPoint(pt) != hWnd) ) { if ( !KillTimer(hWnd, idEvent) ) { /* Error killing the timer! */ } @@ -572,11 +572,24 @@ this->hidden->hiresFix, &x, &y); case WM_WINDOWPOSCHANGED: { SDL_VideoDevice *this = current_video; + POINT pt; int w, h; GetClientRect(SDL_Window, &SDL_bounds); - ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds); - ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds+1); + + /* avoiding type-punning here... */ + pt.x = SDL_bounds.left; + pt.y = SDL_bounds.top; + ClientToScreen(SDL_Window, &pt); + SDL_bounds.left = pt.x; + SDL_bounds.top = pt.y; + + pt.x = SDL_bounds.right; + pt.y = SDL_bounds.bottom; + ClientToScreen(SDL_Window, &pt); + SDL_bounds.right = pt.x; + SDL_bounds.bottom = pt.y; + if ( !SDL_resizing && !IsZoomed(SDL_Window) && SDL_PublicSurface && !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) { @@ -831,7 +844,7 @@ static int WINAPI ToUnicode9xME(UINT vkey, UINT scancode, const BYTE *keystate, /* arg #3 should be const BYTE *, but cygwin lists it as PBYTE. */ if (ToAsciiEx(vkey, scancode, (PBYTE) keystate, (WORD*)chars, 0, GetKeyboardLayout(0)) == 1) { - return MultiByteToWideChar(codepage, 0, chars, 1, wchars, wsize); + return MultiByteToWideChar(codepage, 0, (LPCSTR) chars, 1, wchars, wsize); } return 0; } diff --git a/src/video/windx5/SDL_dx5video.c b/src/video/windx5/SDL_dx5video.c index a37f1a8c7..f84817680 100644 --- a/src/video/windx5/SDL_dx5video.c +++ b/src/video/windx5/SDL_dx5video.c @@ -1034,7 +1034,8 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags) { SDL_Surface *video; - int prev_w, prev_h; + int prev_w = -1; + int prev_h = -1; HRESULT result; DWORD sharemode; DWORD style;