Fixed a bunch of compiler warnings with Cygwin/MingW.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 24 Aug 2012 19:34:28 -0400
changeset 6403 8d34c6248f4a
parent 6401 a4bd9821a796
child 6404 724e1fba7933
Fixed a bunch of compiler warnings with Cygwin/MingW.
src/haptic/windows/SDL_syshaptic.c
src/joystick/windows/SDL_dxjoystick.c
src/render/direct3d/SDL_render_d3d.c
src/video/windows/SDL_windowskeyboard.c
src/video/windows/SDL_windowsshape.c
src/video/windows/SDL_windowswindow.c
--- a/src/haptic/windows/SDL_syshaptic.c	Fri Aug 24 10:03:05 2012 -0700
+++ b/src/haptic/windows/SDL_syshaptic.c	Fri Aug 24 19:34:28 2012 -0400
@@ -120,12 +120,7 @@
 static int
 DI_GUIDIsSame(const GUID * a, const GUID * b)
 {
-    if (((a)->Data1 == (b)->Data1) &&
-        ((a)->Data2 == (b)->Data2) &&
-        ((a)->Data3 == (b)->Data3) &&
-        (SDL_strcmp((a)->Data4, (b)->Data4) == 0))
-        return 1;
-    return 0;
+    return (SDL_memcmp(a, b, sizeof (GUID)) == 0);
 }
 
 
--- a/src/joystick/windows/SDL_dxjoystick.c	Fri Aug 24 10:03:05 2012 -0700
+++ b/src/joystick/windows/SDL_dxjoystick.c	Fri Aug 24 19:34:28 2012 -0400
@@ -65,7 +65,6 @@
 static DIDEVICEINSTANCE SYS_Joystick[MAX_JOYSTICKS];    /* array to hold joystick ID values */
 static char *SYS_JoystickNames[MAX_JOYSTICKS];
 static int SYS_NumJoysticks;
-static HINSTANCE DInputDLL = NULL;
 
 
 /* local prototypes */
--- a/src/render/direct3d/SDL_render_d3d.c	Fri Aug 24 10:03:05 2012 -0700
+++ b/src/render/direct3d/SDL_render_d3d.c	Fri Aug 24 19:34:28 2012 -0400
@@ -681,9 +681,6 @@
 static int
 D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
-    D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
-    SDL_Window *window = renderer->window;
-    D3DFORMAT display_format = renderdata->pparams.BackBufferFormat;
     D3D_TextureData *data;
     D3DPOOL pool;
     DWORD usage;
--- a/src/video/windows/SDL_windowskeyboard.c	Fri Aug 24 10:03:05 2012 -0700
+++ b/src/video/windows/SDL_windowskeyboard.c	Fri Aug 24 19:34:28 2012 -0400
@@ -572,20 +572,20 @@
                         #define pVerFixedInfo   ((VS_FIXEDFILEINFO FAR*)lpVerData)
                         DWORD dwVer = pVerFixedInfo->dwFileVersionMS;
                         dwVer = (dwVer & 0x00ff0000) << 8 | (dwVer & 0x000000ff) << 16;
-                        if (videodata->GetReadingString ||
-                            dwLang == LANG_CHT && (
+                        if ((videodata->GetReadingString) ||
+                            ((dwLang == LANG_CHT) && (
                             dwVer == MAKEIMEVERSION(4, 2) ||
                             dwVer == MAKEIMEVERSION(4, 3) ||
                             dwVer == MAKEIMEVERSION(4, 4) ||
                             dwVer == MAKEIMEVERSION(5, 0) ||
                             dwVer == MAKEIMEVERSION(5, 1) ||
                             dwVer == MAKEIMEVERSION(5, 2) ||
-                            dwVer == MAKEIMEVERSION(6, 0))
+                            dwVer == MAKEIMEVERSION(6, 0)))
                             ||
-                            dwLang == LANG_CHS && (
+                            ((dwLang == LANG_CHS) && (
                             dwVer == MAKEIMEVERSION(4, 1) ||
                             dwVer == MAKEIMEVERSION(4, 2) ||
-                            dwVer == MAKEIMEVERSION(5, 3))) {
+                            dwVer == MAKEIMEVERSION(5, 3)))) {
                             dwRet[0] = dwVer | dwLang;
                             dwRet[1] = pVerFixedInfo->dwFileVersionLS;
                             SDL_free(lpVerBuffer);
@@ -1050,7 +1050,6 @@
     if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) {
         BSTR bstr;
         if (SUCCEEDED(preading->lpVtbl->GetString(preading, &bstr)) && bstr) {
-            WCHAR *s = (WCHAR *)bstr;
             SysFreeString(bstr);
         }
         preading->lpVtbl->Release(preading);
@@ -1133,7 +1132,7 @@
 
 STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
 {
-    static GUID TF_PROFILE_DAYI = {0x037B2C25, 0x480C, 0x4D7F, 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A};
+    static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } };
     SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
     videodata->ime_candlistindexbase = SDL_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1;
     if (SDL_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE))
--- a/src/video/windows/SDL_windowsshape.c	Fri Aug 24 10:03:05 2012 -0700
+++ b/src/video/windows/SDL_windowsshape.c	Fri Aug 24 19:34:28 2012 -0400
@@ -65,11 +65,14 @@
     SDL_ShapeData *data;
     HRGN mask_region = NULL;
 
-    if (shaper == NULL || shape == NULL)
+    if( (shaper == NULL) ||
+        (shape == NULL) ||
+        ((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey)) ||
+        (shape->w != shaper->window->w) ||
+        (shape->h != shaper->window->h) ) {
         return SDL_INVALID_SHAPE_ARGUMENT;
-    if(shape->format->Amask == 0 && shape_mode->mode != ShapeModeColorKey || shape->w != shaper->window->w || shape->h != shaper->window->h)
-        return SDL_INVALID_SHAPE_ARGUMENT;
-    
+    }
+
     data = (SDL_ShapeData*)shaper->driverdata;
     if(data->mask_tree != NULL)
         SDL_FreeShapeTree(&data->mask_tree);
--- a/src/video/windows/SDL_windowswindow.c	Fri Aug 24 10:03:05 2012 -0700
+++ b/src/video/windows/SDL_windowswindow.c	Fri Aug 24 19:34:28 2012 -0400
@@ -74,7 +74,6 @@
 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
 {
     SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
-    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
     SDL_WindowData *data;
 
     /* Allocate the window data */
@@ -193,7 +192,6 @@
 int
 WIN_CreateWindow(_THIS, SDL_Window * window)
 {
-    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
     HWND hwnd;
     RECT rect;
     DWORD style = STYLE_BASIC;
@@ -344,7 +342,6 @@
 void
 WIN_SetWindowPosition(_THIS, SDL_Window * window)
 {
-    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     RECT rect;
     DWORD style;
@@ -481,11 +478,12 @@
 WIN_MaximizeWindow(_THIS, SDL_Window * window)
 {
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
-    SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
 
 #ifdef _WIN32_WCE
-    if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen)
+    if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen) {
+        SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
         videodata->SHFullScreen(hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
+    }
 #endif
 
     ShowWindow(hwnd, SW_MAXIMIZE);
@@ -495,13 +493,14 @@
 WIN_MinimizeWindow(_THIS, SDL_Window * window)
 {
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
-    SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
 
     ShowWindow(hwnd, SW_MINIMIZE);
 
 #ifdef _WIN32_WCE
-    if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen)
+    if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen) {
+        SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
         videodata->SHFullScreen(hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
+    }
 #endif
 }