Fixed mingw64 build and warnings
authorSam Lantinga <slouken@libsdl.org>
Mon, 07 Jul 2014 10:26:28 -0700
changeset 89761a5d959d7b32
parent 8975 180271d72b1e
child 8977 84ae33058c67
Fixed mingw64 build and warnings
configure
configure.in
src/audio/SDL_wave.c
src/events/SDL_mouse.c
src/haptic/SDL_syshaptic.h
src/haptic/windows/SDL_dinputhaptic.c
src/haptic/windows/SDL_windowshaptic_c.h
src/joystick/SDL_gamecontroller.c
src/joystick/windows/SDL_dinputjoystick.c
src/joystick/windows/SDL_windowsjoystick_c.h
src/joystick/windows/SDL_xinputjoystick.c
src/render/direct3d/SDL_render_d3d.c
src/video/SDL_egl.c
src/video/windows/SDL_windowsevents.c
src/video/windows/SDL_windowskeyboard.c
src/video/windows/SDL_windowsmouse.c
     1.1 --- a/configure	Sun Jul 06 20:41:39 2014 -0700
     1.2 +++ b/configure	Mon Jul 07 10:26:28 2014 -0700
     1.3 @@ -23067,7 +23067,7 @@
     1.4  $as_echo "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h
     1.5  
     1.6                  fi
     1.7 -                SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
     1.8 +                SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
     1.9                  have_haptic=yes
    1.10              fi
    1.11          fi
     2.1 --- a/configure.in	Sun Jul 06 20:41:39 2014 -0700
     2.2 +++ b/configure.in	Mon Jul 07 10:26:28 2014 -0700
     2.3 @@ -2982,7 +2982,7 @@
     2.4                  if test x$have_dinput = xyes; then
     2.5                      AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
     2.6                  fi
     2.7 -                SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
     2.8 +                SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
     2.9                  have_haptic=yes
    2.10              fi
    2.11          fi
     3.1 --- a/src/audio/SDL_wave.c	Sun Jul 06 20:41:39 2014 -0700
     3.2 +++ b/src/audio/SDL_wave.c	Mon Jul 07 10:26:28 2014 -0700
     3.3 @@ -345,7 +345,7 @@
     3.4      /* Check to make sure we have enough variables in the state array */
     3.5      channels = IMA_ADPCM_state.wavefmt.channels;
     3.6      if (channels > SDL_arraysize(IMA_ADPCM_state.state)) {
     3.7 -        SDL_SetError("IMA ADPCM decoder can only handle %zu channels",
     3.8 +        SDL_SetError("IMA ADPCM decoder can only handle %u channels",
     3.9                       SDL_arraysize(IMA_ADPCM_state.state));
    3.10          return (-1);
    3.11      }
     4.1 --- a/src/events/SDL_mouse.c	Sun Jul 06 20:41:39 2014 -0700
     4.2 +++ b/src/events/SDL_mouse.c	Mon Jul 07 10:26:28 2014 -0700
     4.3 @@ -204,7 +204,6 @@
     4.4      int posted;
     4.5      int xrel;
     4.6      int yrel;
     4.7 -    int x_max = 0, y_max = 0;
     4.8  
     4.9      if (mouse->relative_mode_warp) {
    4.10          int center_x = 0, center_y = 0;
     5.1 --- a/src/haptic/SDL_syshaptic.h	Sun Jul 06 20:41:39 2014 -0700
     5.2 +++ b/src/haptic/SDL_syshaptic.h	Mon Jul 07 10:26:28 2014 -0700
     5.3 @@ -21,6 +21,9 @@
     5.4  
     5.5  #include "../SDL_internal.h"
     5.6  
     5.7 +#ifndef _SDL_syshaptic_h
     5.8 +#define _SDL_syshaptic_h
     5.9 +
    5.10  #include "SDL_haptic.h"
    5.11  
    5.12  
    5.13 @@ -206,5 +209,7 @@
    5.14   */
    5.15  extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);
    5.16  
    5.17 +#endif /* _SDL_syshaptic_h */
    5.18 +
    5.19  /* vi: set ts=4 sw=4 expandtab: */
    5.20  
     6.1 --- a/src/haptic/windows/SDL_dinputhaptic.c	Sun Jul 06 20:41:39 2014 -0700
     6.2 +++ b/src/haptic/windows/SDL_dinputhaptic.c	Mon Jul 07 10:26:28 2014 -0700
     6.3 @@ -105,7 +105,7 @@
     6.4      instance = GetModuleHandle(NULL);
     6.5      if (instance == NULL) {
     6.6          SDL_SYS_HapticQuit();
     6.7 -        return SDL_SetError("GetModuleHandle() failed with error code %d.",
     6.8 +        return SDL_SetError("GetModuleHandle() failed with error code %lu.",
     6.9              GetLastError());
    6.10      }
    6.11      ret = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
     7.1 --- a/src/haptic/windows/SDL_windowshaptic_c.h	Sun Jul 06 20:41:39 2014 -0700
     7.2 +++ b/src/haptic/windows/SDL_windowshaptic_c.h	Mon Jul 07 10:26:28 2014 -0700
     7.3 @@ -24,7 +24,7 @@
     7.4  #define _SDL_windowshaptic_c_h
     7.5  
     7.6  #include "SDL_thread.h"
     7.7 -
     7.8 +#include "../SDL_syshaptic.h"
     7.9  #include "../../core/windows/SDL_directx.h"
    7.10  #include "../../core/windows/SDL_xinput.h"
    7.11  
     8.1 --- a/src/joystick/SDL_gamecontroller.c	Sun Jul 06 20:41:39 2014 -0700
     8.2 +++ b/src/joystick/SDL_gamecontroller.c	Mon Jul 07 10:26:28 2014 -0700
     8.3 @@ -258,10 +258,12 @@
     8.4   */
     8.5  ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
     8.6  {
     8.7 +#if SDL_JOYSTICK_XINPUT
     8.8      if (SDL_SYS_IsXInputGamepad_DeviceIndex(device_index) && s_pXInputMapping) {
     8.9          return s_pXInputMapping;
    8.10      }
    8.11      else
    8.12 +#endif /* SDL_JOYSTICK_XINPUT */
    8.13      {
    8.14          SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index);
    8.15          return SDL_PrivateGetControllerMappingForGUID(&jGUID);
     9.1 --- a/src/joystick/windows/SDL_dinputjoystick.c	Sun Jul 06 20:41:39 2014 -0700
     9.2 +++ b/src/joystick/windows/SDL_dinputjoystick.c	Mon Jul 07 10:26:28 2014 -0700
     9.3 @@ -231,7 +231,7 @@
     9.4      return SDL_SetError("%s() [%s]: %s", function,
     9.5      DXGetErrorString9A(code), DXGetErrorDescription9A(code));
     9.6      */
     9.7 -    return SDL_SetError("%s() DirectX error %d", function, code);
     9.8 +    return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code);
     9.9  }
    9.10  
    9.11  static SDL_bool
    9.12 @@ -324,7 +324,7 @@
    9.13      /* Because we used CoCreateInstance, we need to Initialize it, first. */
    9.14      instance = GetModuleHandle(NULL);
    9.15      if (instance == NULL) {
    9.16 -        return SDL_SetError("GetModuleHandle() failed with error code %d.", GetLastError());
    9.17 +        return SDL_SetError("GetModuleHandle() failed with error code %lu.", GetLastError());
    9.18      }
    9.19      result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
    9.20  
    10.1 --- a/src/joystick/windows/SDL_windowsjoystick_c.h	Sun Jul 06 20:41:39 2014 -0700
    10.2 +++ b/src/joystick/windows/SDL_windowsjoystick_c.h	Mon Jul 07 10:26:28 2014 -0700
    10.3 @@ -21,7 +21,6 @@
    10.4  #include "../../SDL_internal.h"
    10.5  
    10.6  #include "SDL_events.h"
    10.7 -#include "SDL_joystick.h"
    10.8  #include "../SDL_sysjoystick.h"
    10.9  #include "../../core/windows/SDL_windows.h"
   10.10  #include "../../core/windows/SDL_directx.h"
    11.1 --- a/src/joystick/windows/SDL_xinputjoystick.c	Sun Jul 06 20:41:39 2014 -0700
    11.2 +++ b/src/joystick/windows/SDL_xinputjoystick.c	Mon Jul 07 10:26:28 2014 -0700
    11.3 @@ -234,7 +234,6 @@
    11.4      };
    11.5      WORD wButtons = pXInputState->Gamepad.wButtons;
    11.6      Uint8 button;
    11.7 -    Uint8 hat = SDL_HAT_CENTERED;
    11.8  
    11.9      SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX);
   11.10      SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbLY)));
   11.11 @@ -379,12 +378,6 @@
   11.12  {
   11.13  }
   11.14  
   11.15 -SDL_bool
   11.16 -SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index)
   11.17 -{
   11.18 -    return SDL_FALSE;
   11.19 -}
   11.20 -
   11.21  #endif /* SDL_JOYSTICK_XINPUT */
   11.22  
   11.23  /* vi: set ts=4 sw=4 expandtab: */
    12.1 --- a/src/render/direct3d/SDL_render_d3d.c	Sun Jul 06 20:41:39 2014 -0700
    12.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Mon Jul 07 10:26:28 2014 -0700
    12.3 @@ -1113,7 +1113,7 @@
    12.4  static void
    12.5  D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
    12.6  {
    12.7 -    D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
    12.8 +    /*D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;*/
    12.9      D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
   12.10  
   12.11      if (!texturedata) {
    13.1 --- a/src/video/SDL_egl.c	Sun Jul 06 20:41:39 2014 -0700
    13.2 +++ b/src/video/SDL_egl.c	Mon Jul 07 10:26:28 2014 -0700
    13.3 @@ -69,6 +69,7 @@
    13.4  }
    13.5      
    13.6  /* EGL implementation of SDL OpenGL ES support */
    13.7 +#ifdef EGL_KHR_create_context        
    13.8  static int SDL_EGL_HasExtension(_THIS, const char *ext)
    13.9  {
   13.10      int i;
   13.11 @@ -100,6 +101,7 @@
   13.12  
   13.13      return 0;
   13.14  }
   13.15 +#endif /* EGL_KHR_create_context */
   13.16  
   13.17  void *
   13.18  SDL_EGL_GetProcAddress(_THIS, const char *proc)
   13.19 @@ -552,21 +554,22 @@
   13.20  EGLSurface *
   13.21  SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) 
   13.22  {
   13.23 -    EGLint format;
   13.24 -    
   13.25      if (SDL_EGL_ChooseConfig(_this) != 0) {
   13.26          return EGL_NO_SURFACE;
   13.27      }
   13.28      
   13.29  #if __ANDROID__
   13.30 -    /* Android docs recommend doing this!
   13.31 -     * Ref: http://developer.android.com/reference/android/app/NativeActivity.html 
   13.32 -     */
   13.33 -    _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
   13.34 -                                        _this->egl_data->egl_config, 
   13.35 -                                        EGL_NATIVE_VISUAL_ID, &format);
   13.36 +    {
   13.37 +        /* Android docs recommend doing this!
   13.38 +         * Ref: http://developer.android.com/reference/android/app/NativeActivity.html 
   13.39 +         */
   13.40 +        EGLint format;
   13.41 +        _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
   13.42 +                                            _this->egl_data->egl_config, 
   13.43 +                                            EGL_NATIVE_VISUAL_ID, &format);
   13.44  
   13.45 -    ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
   13.46 +        ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
   13.47 +    }
   13.48  #endif    
   13.49      
   13.50      return _this->egl_data->eglCreateWindowSurface(
    14.1 --- a/src/video/windows/SDL_windowsevents.c	Sun Jul 06 20:41:39 2014 -0700
    14.2 +++ b/src/video/windows/SDL_windowsevents.c	Mon Jul 07 10:26:28 2014 -0700
    14.3 @@ -453,31 +453,30 @@
    14.4              /* Mouse data */
    14.5              if (inp.header.dwType == RIM_TYPEMOUSE) {
    14.6                  if (isRelative) {
    14.7 -                    RAWMOUSE* mouse = &inp.data.mouse;
    14.8 +                    RAWMOUSE* rawmouse = &inp.data.mouse;
    14.9  
   14.10 -                    if ((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
   14.11 -                        SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
   14.12 +                    if ((rawmouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
   14.13 +                        SDL_SendMouseMotion(data->window, 0, 1, (int)rawmouse->lLastX, (int)rawmouse->lLastY);
   14.14                      } else {
   14.15                          /* synthesize relative moves from the abs position */
   14.16                          static SDL_Point initialMousePoint;
   14.17                          if (initialMousePoint.x == 0 && initialMousePoint.y == 0) {
   14.18 -                            initialMousePoint.x = mouse->lLastX;
   14.19 -                            initialMousePoint.y = mouse->lLastY;
   14.20 +                            initialMousePoint.x = rawmouse->lLastX;
   14.21 +                            initialMousePoint.y = rawmouse->lLastY;
   14.22                          }
   14.23  
   14.24 -                        SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
   14.25 +                        SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y) );
   14.26  
   14.27 -                        initialMousePoint.x = mouse->lLastX;
   14.28 -                        initialMousePoint.y = mouse->lLastY;
   14.29 +                        initialMousePoint.x = rawmouse->lLastX;
   14.30 +                        initialMousePoint.y = rawmouse->lLastY;
   14.31                      }
   14.32 -                    WIN_CheckRawMouseButtons( mouse->usButtonFlags, data );
   14.33 +                    WIN_CheckRawMouseButtons(rawmouse->usButtonFlags, data);
   14.34                  } else if (isCapture) {
   14.35                      /* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */
   14.36                      POINT pt;
   14.37 -                    HWND hwnd = data->hwnd;
   14.38                      GetCursorPos(&pt);
   14.39                      if (WindowFromPoint(pt) != hwnd) {  /* if in the window, WM_MOUSEMOVE, etc, will cover it. */
   14.40 -                        ScreenToClient(data->hwnd, &pt);
   14.41 +                        ScreenToClient(hwnd, &pt);
   14.42                          SDL_SendMouseMotion(data->window, 0, 0, (int) pt.x, (int) pt.y);
   14.43                          SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT);
   14.44                          SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT);
   14.45 @@ -892,7 +891,7 @@
   14.46              SDL_Window *window = data->window;
   14.47              if (window->hit_test) {
   14.48                  POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) };
   14.49 -                if (ScreenToClient(data->hwnd, &winpoint)) {
   14.50 +                if (ScreenToClient(hwnd, &winpoint)) {
   14.51                      const SDL_Point point = { (int) winpoint.x, (int) winpoint.y };
   14.52                      const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
   14.53                      switch (rc) {
   14.54 @@ -905,6 +904,7 @@
   14.55                          case SDL_HITTEST_RESIZE_BOTTOM: return HTBOTTOM;
   14.56                          case SDL_HITTEST_RESIZE_BOTTOMLEFT: return HTBOTTOMLEFT;
   14.57                          case SDL_HITTEST_RESIZE_LEFT: return HTLEFT;
   14.58 +                        case SDL_HITTEST_NORMAL: return HTCLIENT;
   14.59                      }
   14.60                  }
   14.61                  /* If we didn't return, this will call DefWindowProc below. */
    15.1 --- a/src/video/windows/SDL_windowskeyboard.c	Sun Jul 06 20:41:39 2014 -0700
    15.2 +++ b/src/video/windows/SDL_windowskeyboard.c	Mon Jul 07 10:26:28 2014 -0700
    15.3 @@ -750,18 +750,16 @@
    15.4          if (cand_list) {
    15.5              size = ImmGetCandidateListW(himc, 0, cand_list, size);
    15.6              if (size) {
    15.7 -                int i = 0;
    15.8 -                int j = 0;
    15.9 -                int page_start = 0;
   15.10 +                UINT i, j;
   15.11 +                UINT page_start = 0;
   15.12                  videodata->ime_candsel = cand_list->dwSelection;
   15.13                  videodata->ime_candcount = cand_list->dwCount;
   15.14  
   15.15                  if (LANG() == LANG_CHS && IME_GetId(videodata, 0)) {
   15.16                      const UINT maxcandchar = 18;
   15.17 -                    UINT i = 0;
   15.18                      size_t cchars = 0;
   15.19  
   15.20 -                    for (; i < videodata->ime_candcount; ++i) {
   15.21 +                    for (i = 0; i < videodata->ime_candcount; ++i) {
   15.22                          size_t len = SDL_wcslen((LPWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i])) + 1;
   15.23                          if (len + cchars > maxcandchar) {
   15.24                              if (i > cand_list->dwSelection)
   15.25 @@ -775,8 +773,7 @@
   15.26                          }
   15.27                      }
   15.28                      videodata->ime_candpgsize = i - page_start;
   15.29 -                }
   15.30 -                else {
   15.31 +                } else {
   15.32                      videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST);
   15.33                      page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize;
   15.34                  }
    16.1 --- a/src/video/windows/SDL_windowsmouse.c	Sun Jul 06 20:41:39 2014 -0700
    16.2 +++ b/src/video/windows/SDL_windowsmouse.c	Mon Jul 07 10:26:28 2014 -0700
    16.3 @@ -258,7 +258,6 @@
    16.4      if (!window) {
    16.5          SDL_Window *focusWin = SDL_GetKeyboardFocus();
    16.6          if (focusWin) {
    16.7 -            SDL_WindowData *data = (SDL_WindowData *)focusWin->driverdata;
    16.8              WIN_OnWindowEnter(SDL_GetVideoDevice(), focusWin);  /* make sure WM_MOUSELEAVE messages are (re)enabled. */
    16.9          }
   16.10      }