Fixed build warnings and errors

This commit is contained in:
Sam Lantinga 2016-10-01 14:48:18 -07:00
parent fae5d0eab3
commit fa0f417631
5 changed files with 19 additions and 16 deletions

View File

@ -325,7 +325,7 @@ SDL_DINPUT_HapticOpenFromDevice(SDL_Haptic * haptic, LPDIRECTINPUTDEVICE8 device
/* Set data format. */ /* Set data format. */
ret = IDirectInputDevice8_SetDataFormat(haptic->hwdata->device, ret = IDirectInputDevice8_SetDataFormat(haptic->hwdata->device,
&c_dfDIJoystick2); &SDL_c_dfDIJoystick2);
if (FAILED(ret)) { if (FAILED(ret)) {
DI_SetError("Setting data format", ret); DI_SetError("Setting data format", ret);
goto acquire_err; goto acquire_err;

View File

@ -214,7 +214,7 @@ static DIOBJECTDATAFORMAT dfDIJoystick2[] = {
{ &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, { &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(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT), sizeof(DIOBJECTDATAFORMAT),
DIDF_ABSAXIS, DIDF_ABSAXIS,
@ -594,7 +594,7 @@ SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde
/* Use the extended data structure: DIJOYSTATE2. */ /* Use the extended data structure: DIJOYSTATE2. */
result = result =
IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice, IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice,
&c_dfDIJoystick2); &SDL_c_dfDIJoystick2);
if (FAILED(result)) { if (FAILED(result)) {
return SetDIerror("IDirectInputDevice8::SetDataFormat", result); return SetDIerror("IDirectInputDevice8::SetDataFormat", result);
} }

View File

@ -27,4 +27,6 @@ extern void SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick);
extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick); extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick);
extern void SDL_DINPUT_JoystickQuit(void); extern void SDL_DINPUT_JoystickQuit(void);
extern const DIDATAFORMAT SDL_c_dfDIJoystick2;
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View File

@ -1439,7 +1439,10 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
return SDL_OutOfMemory(); 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); SDL_GetRendererOutputSize(renderer, &w, &h);

View File

@ -290,7 +290,7 @@ X11_CreateDevice(int devindex)
device->StartTextInput = X11_StartTextInput; device->StartTextInput = X11_StartTextInput;
device->StopTextInput = X11_StopTextInput; device->StopTextInput = X11_StopTextInput;
device->SetTextInputRect = X11_SetTextInputRect; device->SetTextInputRect = X11_SetTextInputRect;
device->free = X11_DeleteDevice; device->free = X11_DeleteDevice;
return device; return device;
@ -395,33 +395,31 @@ X11_VideoInit(_THIS)
Compose keys will work correctly. */ Compose keys will work correctly. */
char *prev_locale = setlocale(LC_ALL, NULL); char *prev_locale = setlocale(LC_ALL, NULL);
char *prev_xmods = X11_XSetLocaleModifiers(NULL); char *prev_xmods = X11_XSetLocaleModifiers(NULL);
const char *new_xmods = "";
const char *env_xmods = SDL_getenv("XMODIFIERS");
if (prev_xmods) { if (prev_xmods) {
prev_xmods = SDL_strdup(prev_xmods); prev_xmods = SDL_strdup(prev_xmods);
} }
/* IBus resends some key events that were filtered by XFilterEvents /* IBus resends some key events that were filtered by XFilterEvents
when it is used via XIM which causes issues. Prevent this by forcing 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 @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via
the DBus implementation, which also has support for pre-editing. */ 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) { if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
new_xmods = "@im=none"; new_xmods = "@im=none";
} }
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
X11_XSetLocaleModifiers(new_xmods); X11_XSetLocaleModifiers(new_xmods);
data->im = data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
X11_XOpenIM(data->display, NULL, data->classname, data->classname);
/* Reset the locale + X locale modifiers back to how they were, /* Reset the locale + X locale modifiers back to how they were,
locale first because the X locale modifiers depend on it. */ locale first because the X locale modifiers depend on it. */
setlocale(LC_ALL, prev_locale); setlocale(LC_ALL, prev_locale);
X11_XSetLocaleModifiers(prev_xmods); X11_XSetLocaleModifiers(prev_xmods);
if (prev_xmods) { if (prev_xmods) {
SDL_free(prev_xmods); SDL_free(prev_xmods);
} }