Fixed mingw64 build and warnings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
diff --git a/configure b/configure
index a598f36..533591a 100755
--- a/configure
+++ b/configure
@@ -23067,7 +23067,7 @@ $as_echo "#define SDL_HAPTIC_XINPUT 1" >>confdefs.h
$as_echo "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h
fi
- SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
+ SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
have_haptic=yes
fi
fi
diff --git a/configure.in b/configure.in
index 42aec1d..80e88e7 100644
--- a/configure.in
+++ b/configure.in
@@ -2982,7 +2982,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
if test x$have_dinput = xyes; then
AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
fi
- SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
+ SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
have_haptic=yes
fi
fi
diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
index 8316c6f..794b3ac 100644
--- a/src/audio/SDL_wave.c
+++ b/src/audio/SDL_wave.c
@@ -345,7 +345,7 @@ IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
/* Check to make sure we have enough variables in the state array */
channels = IMA_ADPCM_state.wavefmt.channels;
if (channels > SDL_arraysize(IMA_ADPCM_state.state)) {
- SDL_SetError("IMA ADPCM decoder can only handle %zu channels",
+ SDL_SetError("IMA ADPCM decoder can only handle %u channels",
SDL_arraysize(IMA_ADPCM_state.state));
return (-1);
}
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index a3ee3a2..f313e7f 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -204,7 +204,6 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
int posted;
int xrel;
int yrel;
- int x_max = 0, y_max = 0;
if (mouse->relative_mode_warp) {
int center_x = 0, center_y = 0;
diff --git a/src/haptic/SDL_syshaptic.h b/src/haptic/SDL_syshaptic.h
index b2918be..c808adc 100644
--- a/src/haptic/SDL_syshaptic.h
+++ b/src/haptic/SDL_syshaptic.h
@@ -21,6 +21,9 @@
#include "../SDL_internal.h"
+#ifndef _SDL_syshaptic_h
+#define _SDL_syshaptic_h
+
#include "SDL_haptic.h"
@@ -206,5 +209,7 @@ extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic);
*/
extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);
+#endif /* _SDL_syshaptic_h */
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/haptic/windows/SDL_dinputhaptic.c b/src/haptic/windows/SDL_dinputhaptic.c
index e96fe1b..489ca5e 100644
--- a/src/haptic/windows/SDL_dinputhaptic.c
+++ b/src/haptic/windows/SDL_dinputhaptic.c
@@ -105,7 +105,7 @@ SDL_DINPUT_HapticInit(void)
instance = GetModuleHandle(NULL);
if (instance == NULL) {
SDL_SYS_HapticQuit();
- return SDL_SetError("GetModuleHandle() failed with error code %d.",
+ return SDL_SetError("GetModuleHandle() failed with error code %lu.",
GetLastError());
}
ret = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
diff --git a/src/haptic/windows/SDL_windowshaptic_c.h b/src/haptic/windows/SDL_windowshaptic_c.h
index a978c24..e715339 100644
--- a/src/haptic/windows/SDL_windowshaptic_c.h
+++ b/src/haptic/windows/SDL_windowshaptic_c.h
@@ -24,7 +24,7 @@
#define _SDL_windowshaptic_c_h
#include "SDL_thread.h"
-
+#include "../SDL_syshaptic.h"
#include "../../core/windows/SDL_directx.h"
#include "../../core/windows/SDL_xinput.h"
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index d53acdf..c60f391 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -258,10 +258,12 @@ ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *gu
*/
ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
{
+#if SDL_JOYSTICK_XINPUT
if (SDL_SYS_IsXInputGamepad_DeviceIndex(device_index) && s_pXInputMapping) {
return s_pXInputMapping;
}
else
+#endif /* SDL_JOYSTICK_XINPUT */
{
SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index);
return SDL_PrivateGetControllerMappingForGUID(&jGUID);
diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c
index c5816e9..179f992 100644
--- a/src/joystick/windows/SDL_dinputjoystick.c
+++ b/src/joystick/windows/SDL_dinputjoystick.c
@@ -231,7 +231,7 @@ SetDIerror(const char *function, HRESULT code)
return SDL_SetError("%s() [%s]: %s", function,
DXGetErrorString9A(code), DXGetErrorDescription9A(code));
*/
- return SDL_SetError("%s() DirectX error %d", function, code);
+ return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code);
}
static SDL_bool
@@ -324,7 +324,7 @@ SDL_DINPUT_JoystickInit(void)
/* Because we used CoCreateInstance, we need to Initialize it, first. */
instance = GetModuleHandle(NULL);
if (instance == NULL) {
- return SDL_SetError("GetModuleHandle() failed with error code %d.", GetLastError());
+ return SDL_SetError("GetModuleHandle() failed with error code %lu.", GetLastError());
}
result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
diff --git a/src/joystick/windows/SDL_windowsjoystick_c.h b/src/joystick/windows/SDL_windowsjoystick_c.h
index 703b0cc..9b09e65 100644
--- a/src/joystick/windows/SDL_windowsjoystick_c.h
+++ b/src/joystick/windows/SDL_windowsjoystick_c.h
@@ -21,7 +21,6 @@
#include "../../SDL_internal.h"
#include "SDL_events.h"
-#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../../core/windows/SDL_windows.h"
#include "../../core/windows/SDL_directx.h"
diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c
index 4a625a5..2d507e7 100644
--- a/src/joystick/windows/SDL_xinputjoystick.c
+++ b/src/joystick/windows/SDL_xinputjoystick.c
@@ -234,7 +234,6 @@ UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputS
};
WORD wButtons = pXInputState->Gamepad.wButtons;
Uint8 button;
- Uint8 hat = SDL_HAT_CENTERED;
SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX);
SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbLY)));
@@ -379,12 +378,6 @@ SDL_XINPUT_JoystickQuit(void)
{
}
-SDL_bool
-SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index)
-{
- return SDL_FALSE;
-}
-
#endif /* SDL_JOYSTICK_XINPUT */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c
index 7d872ff..6927985 100644
--- a/src/render/direct3d/SDL_render_d3d.c
+++ b/src/render/direct3d/SDL_render_d3d.c
@@ -1113,7 +1113,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static void
D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
- D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
+ /*D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;*/
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
if (!texturedata) {
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index 461d0ac..8a2e2fc 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -69,6 +69,7 @@ if (!_this->egl_data->NAME) \
}
/* EGL implementation of SDL OpenGL ES support */
+#ifdef EGL_KHR_create_context
static int SDL_EGL_HasExtension(_THIS, const char *ext)
{
int i;
@@ -100,6 +101,7 @@ static int SDL_EGL_HasExtension(_THIS, const char *ext)
return 0;
}
+#endif /* EGL_KHR_create_context */
void *
SDL_EGL_GetProcAddress(_THIS, const char *proc)
@@ -552,21 +554,22 @@ SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
EGLSurface *
SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
{
- EGLint format;
-
if (SDL_EGL_ChooseConfig(_this) != 0) {
return EGL_NO_SURFACE;
}
#if __ANDROID__
- /* Android docs recommend doing this!
- * Ref: http://developer.android.com/reference/android/app/NativeActivity.html
- */
- _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
- _this->egl_data->egl_config,
- EGL_NATIVE_VISUAL_ID, &format);
+ {
+ /* Android docs recommend doing this!
+ * Ref: http://developer.android.com/reference/android/app/NativeActivity.html
+ */
+ EGLint format;
+ _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
+ _this->egl_data->egl_config,
+ EGL_NATIVE_VISUAL_ID, &format);
- ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
+ ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
+ }
#endif
return _this->egl_data->eglCreateWindowSurface(
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 7ff47d4..28801d2 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -453,31 +453,30 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* Mouse data */
if (inp.header.dwType == RIM_TYPEMOUSE) {
if (isRelative) {
- RAWMOUSE* mouse = &inp.data.mouse;
+ RAWMOUSE* rawmouse = &inp.data.mouse;
- if ((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
- SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
+ if ((rawmouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
+ SDL_SendMouseMotion(data->window, 0, 1, (int)rawmouse->lLastX, (int)rawmouse->lLastY);
} else {
/* synthesize relative moves from the abs position */
static SDL_Point initialMousePoint;
if (initialMousePoint.x == 0 && initialMousePoint.y == 0) {
- initialMousePoint.x = mouse->lLastX;
- initialMousePoint.y = mouse->lLastY;
+ initialMousePoint.x = rawmouse->lLastX;
+ initialMousePoint.y = rawmouse->lLastY;
}
- SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
+ SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y) );
- initialMousePoint.x = mouse->lLastX;
- initialMousePoint.y = mouse->lLastY;
+ initialMousePoint.x = rawmouse->lLastX;
+ initialMousePoint.y = rawmouse->lLastY;
}
- WIN_CheckRawMouseButtons( mouse->usButtonFlags, data );
+ WIN_CheckRawMouseButtons(rawmouse->usButtonFlags, data);
} else if (isCapture) {
/* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */
POINT pt;
- HWND hwnd = data->hwnd;
GetCursorPos(&pt);
if (WindowFromPoint(pt) != hwnd) { /* if in the window, WM_MOUSEMOVE, etc, will cover it. */
- ScreenToClient(data->hwnd, &pt);
+ ScreenToClient(hwnd, &pt);
SDL_SendMouseMotion(data->window, 0, 0, (int) pt.x, (int) pt.y);
SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT);
SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT);
@@ -892,7 +891,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_Window *window = data->window;
if (window->hit_test) {
POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) };
- if (ScreenToClient(data->hwnd, &winpoint)) {
+ if (ScreenToClient(hwnd, &winpoint)) {
const SDL_Point point = { (int) winpoint.x, (int) winpoint.y };
const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
switch (rc) {
@@ -905,6 +904,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case SDL_HITTEST_RESIZE_BOTTOM: return HTBOTTOM;
case SDL_HITTEST_RESIZE_BOTTOMLEFT: return HTBOTTOMLEFT;
case SDL_HITTEST_RESIZE_LEFT: return HTLEFT;
+ case SDL_HITTEST_NORMAL: return HTCLIENT;
}
}
/* If we didn't return, this will call DefWindowProc below. */
diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c
index 828e3ff..0557b6c 100644
--- a/src/video/windows/SDL_windowskeyboard.c
+++ b/src/video/windows/SDL_windowskeyboard.c
@@ -750,18 +750,16 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata)
if (cand_list) {
size = ImmGetCandidateListW(himc, 0, cand_list, size);
if (size) {
- int i = 0;
- int j = 0;
- int page_start = 0;
+ UINT i, j;
+ UINT page_start = 0;
videodata->ime_candsel = cand_list->dwSelection;
videodata->ime_candcount = cand_list->dwCount;
if (LANG() == LANG_CHS && IME_GetId(videodata, 0)) {
const UINT maxcandchar = 18;
- UINT i = 0;
size_t cchars = 0;
- for (; i < videodata->ime_candcount; ++i) {
+ for (i = 0; i < videodata->ime_candcount; ++i) {
size_t len = SDL_wcslen((LPWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i])) + 1;
if (len + cchars > maxcandchar) {
if (i > cand_list->dwSelection)
@@ -775,8 +773,7 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata)
}
}
videodata->ime_candpgsize = i - page_start;
- }
- else {
+ } else {
videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST);
page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize;
}
diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c
index 1998502..c61076c 100644
--- a/src/video/windows/SDL_windowsmouse.c
+++ b/src/video/windows/SDL_windowsmouse.c
@@ -258,7 +258,6 @@ WIN_CaptureMouse(SDL_Window *window)
if (!window) {
SDL_Window *focusWin = SDL_GetKeyboardFocus();
if (focusWin) {
- SDL_WindowData *data = (SDL_WindowData *)focusWin->driverdata;
WIN_OnWindowEnter(SDL_GetVideoDevice(), focusWin); /* make sure WM_MOUSELEAVE messages are (re)enabled. */
}
}