Fixed build warnings and errors
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
diff --git a/src/haptic/windows/SDL_dinputhaptic.c b/src/haptic/windows/SDL_dinputhaptic.c
index c51470d..0c9d9ec 100644
--- a/src/haptic/windows/SDL_dinputhaptic.c
+++ b/src/haptic/windows/SDL_dinputhaptic.c
@@ -325,7 +325,7 @@ SDL_DINPUT_HapticOpenFromDevice(SDL_Haptic * haptic, LPDIRECTINPUTDEVICE8 device
/* Set data format. */
ret = IDirectInputDevice8_SetDataFormat(haptic->hwdata->device,
- &c_dfDIJoystick2);
+ &SDL_c_dfDIJoystick2);
if (FAILED(ret)) {
DI_SetError("Setting data format", ret);
goto acquire_err;
diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c
index 14df652..7166075 100644
--- a/src/joystick/windows/SDL_dinputjoystick.c
+++ b/src/joystick/windows/SDL_dinputjoystick.c
@@ -214,7 +214,7 @@ static DIOBJECTDATAFORMAT dfDIJoystick2[] = {
{ &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
};
-static const DIDATAFORMAT c_dfDIJoystick2 = {
+const DIDATAFORMAT SDL_c_dfDIJoystick2 = {
sizeof(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT),
DIDF_ABSAXIS,
@@ -594,7 +594,7 @@ SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde
/* Use the extended data structure: DIJOYSTATE2. */
result =
IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice,
- &c_dfDIJoystick2);
+ &SDL_c_dfDIJoystick2);
if (FAILED(result)) {
return SetDIerror("IDirectInputDevice8::SetDataFormat", result);
}
diff --git a/src/joystick/windows/SDL_dinputjoystick_c.h b/src/joystick/windows/SDL_dinputjoystick_c.h
index 7e4ff3e..fa36885 100644
--- a/src/joystick/windows/SDL_dinputjoystick_c.h
+++ b/src/joystick/windows/SDL_dinputjoystick_c.h
@@ -27,4 +27,6 @@ extern void SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick);
extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick);
extern void SDL_DINPUT_JoystickQuit(void);
+extern const DIDATAFORMAT SDL_c_dfDIJoystick2;
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 0276f28..5b28dec 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -1439,7 +1439,10 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
return SDL_OutOfMemory();
}
- convert_format(data, temp_format, &internalFormat, &format, &type);
+ if (!convert_format(data, temp_format, &internalFormat, &format, &type)) {
+ return SDL_SetError("Texture format %s not supported by OpenGL",
+ SDL_GetPixelFormatName(temp_format));
+ }
SDL_GetRendererOutputSize(renderer, &w, &h);
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index a8c3b25..66a1c26 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -290,7 +290,7 @@ X11_CreateDevice(int devindex)
device->StartTextInput = X11_StartTextInput;
device->StopTextInput = X11_StopTextInput;
device->SetTextInputRect = X11_SetTextInputRect;
-
+
device->free = X11_DeleteDevice;
return device;
@@ -395,33 +395,31 @@ X11_VideoInit(_THIS)
Compose keys will work correctly. */
char *prev_locale = setlocale(LC_ALL, NULL);
char *prev_xmods = X11_XSetLocaleModifiers(NULL);
-
+ const char *new_xmods = "";
+ const char *env_xmods = SDL_getenv("XMODIFIERS");
+
if (prev_xmods) {
prev_xmods = SDL_strdup(prev_xmods);
}
-
+
/* IBus resends some key events that were filtered by XFilterEvents
when it is used via XIM which causes issues. Prevent this by forcing
@im=none if XMODIFIERS contains @im=ibus. IBus can still be used via
the DBus implementation, which also has support for pre-editing. */
- const char *new_xmods = "";
- const char *env_xmods = SDL_getenv("XMODIFIERS");
-
if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
new_xmods = "@im=none";
}
-
+
setlocale(LC_ALL, "");
X11_XSetLocaleModifiers(new_xmods);
-
- data->im =
- X11_XOpenIM(data->display, NULL, data->classname, data->classname);
-
+
+ data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
+
/* Reset the locale + X locale modifiers back to how they were,
locale first because the X locale modifiers depend on it. */
setlocale(LC_ALL, prev_locale);
X11_XSetLocaleModifiers(prev_xmods);
-
+
if (prev_xmods) {
SDL_free(prev_xmods);
}