Fixed build warnings and errors
authorSam Lantinga <slouken@libsdl.org>
Sat, 01 Oct 2016 14:48:18 -0700
changeset 1044280d5e7642a06
parent 10441 5eac139165bc
child 10443 89d875e0a08c
Fixed build warnings and errors
src/haptic/windows/SDL_dinputhaptic.c
src/joystick/windows/SDL_dinputjoystick.c
src/joystick/windows/SDL_dinputjoystick_c.h
src/render/opengl/SDL_render_gl.c
src/video/x11/SDL_x11video.c
     1.1 --- a/src/haptic/windows/SDL_dinputhaptic.c	Sat Oct 01 14:34:52 2016 -0700
     1.2 +++ b/src/haptic/windows/SDL_dinputhaptic.c	Sat Oct 01 14:48:18 2016 -0700
     1.3 @@ -325,7 +325,7 @@
     1.4  
     1.5          /* Set data format. */
     1.6          ret = IDirectInputDevice8_SetDataFormat(haptic->hwdata->device,
     1.7 -                                                &c_dfDIJoystick2);
     1.8 +                                                &SDL_c_dfDIJoystick2);
     1.9          if (FAILED(ret)) {
    1.10              DI_SetError("Setting data format", ret);
    1.11              goto acquire_err;
     2.1 --- a/src/joystick/windows/SDL_dinputjoystick.c	Sat Oct 01 14:34:52 2016 -0700
     2.2 +++ b/src/joystick/windows/SDL_dinputjoystick.c	Sat Oct 01 14:48:18 2016 -0700
     2.3 @@ -214,7 +214,7 @@
     2.4          { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
     2.5  };
     2.6  
     2.7 -static const DIDATAFORMAT c_dfDIJoystick2 = {
     2.8 +const DIDATAFORMAT SDL_c_dfDIJoystick2 = {
     2.9      sizeof(DIDATAFORMAT),
    2.10      sizeof(DIOBJECTDATAFORMAT),
    2.11      DIDF_ABSAXIS,
    2.12 @@ -594,7 +594,7 @@
    2.13      /* Use the extended data structure: DIJOYSTATE2. */
    2.14      result =
    2.15          IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice,
    2.16 -        &c_dfDIJoystick2);
    2.17 +        &SDL_c_dfDIJoystick2);
    2.18      if (FAILED(result)) {
    2.19          return SetDIerror("IDirectInputDevice8::SetDataFormat", result);
    2.20      }
     3.1 --- a/src/joystick/windows/SDL_dinputjoystick_c.h	Sat Oct 01 14:34:52 2016 -0700
     3.2 +++ b/src/joystick/windows/SDL_dinputjoystick_c.h	Sat Oct 01 14:48:18 2016 -0700
     3.3 @@ -27,4 +27,6 @@
     3.4  extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick);
     3.5  extern void SDL_DINPUT_JoystickQuit(void);
     3.6  
     3.7 +extern const DIDATAFORMAT SDL_c_dfDIJoystick2;
     3.8 +
     3.9  /* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/src/render/opengl/SDL_render_gl.c	Sat Oct 01 14:34:52 2016 -0700
     4.2 +++ b/src/render/opengl/SDL_render_gl.c	Sat Oct 01 14:48:18 2016 -0700
     4.3 @@ -1439,7 +1439,10 @@
     4.4          return SDL_OutOfMemory();
     4.5      }
     4.6  
     4.7 -    convert_format(data, temp_format, &internalFormat, &format, &type);
     4.8 +    if (!convert_format(data, temp_format, &internalFormat, &format, &type)) {
     4.9 +        return SDL_SetError("Texture format %s not supported by OpenGL",
    4.10 +                            SDL_GetPixelFormatName(temp_format));
    4.11 +    }
    4.12  
    4.13      SDL_GetRendererOutputSize(renderer, &w, &h);
    4.14  
     5.1 --- a/src/video/x11/SDL_x11video.c	Sat Oct 01 14:34:52 2016 -0700
     5.2 +++ b/src/video/x11/SDL_x11video.c	Sat Oct 01 14:48:18 2016 -0700
     5.3 @@ -290,7 +290,7 @@
     5.4      device->StartTextInput = X11_StartTextInput;
     5.5      device->StopTextInput = X11_StopTextInput;
     5.6      device->SetTextInputRect = X11_SetTextInputRect;
     5.7 -    
     5.8 +
     5.9      device->free = X11_DeleteDevice;
    5.10  
    5.11      return device;
    5.12 @@ -395,33 +395,31 @@
    5.13             Compose keys will work correctly. */
    5.14          char *prev_locale = setlocale(LC_ALL, NULL);
    5.15          char *prev_xmods  = X11_XSetLocaleModifiers(NULL);
    5.16 -        
    5.17 +        const char *new_xmods = "";
    5.18 +        const char *env_xmods = SDL_getenv("XMODIFIERS");
    5.19 +
    5.20          if (prev_xmods) {
    5.21              prev_xmods = SDL_strdup(prev_xmods);
    5.22          }
    5.23 -        
    5.24 +
    5.25          /* IBus resends some key events that were filtered by XFilterEvents
    5.26             when it is used via XIM which causes issues. Prevent this by forcing
    5.27             @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via 
    5.28             the DBus implementation, which also has support for pre-editing. */
    5.29 -        const char *new_xmods = "";
    5.30 -        const char *env_xmods = SDL_getenv("XMODIFIERS");
    5.31 -        
    5.32          if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
    5.33              new_xmods = "@im=none";
    5.34          }
    5.35 -        
    5.36 +
    5.37          setlocale(LC_ALL, "");
    5.38          X11_XSetLocaleModifiers(new_xmods);
    5.39 -        
    5.40 -        data->im =
    5.41 -            X11_XOpenIM(data->display, NULL, data->classname, data->classname);
    5.42 -        
    5.43 +
    5.44 +        data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
    5.45 +
    5.46          /* Reset the locale + X locale modifiers back to how they were,
    5.47             locale first because the X locale modifiers depend on it. */
    5.48          setlocale(LC_ALL, prev_locale);
    5.49          X11_XSetLocaleModifiers(prev_xmods);
    5.50 -        
    5.51 +
    5.52          if (prev_xmods) {
    5.53              SDL_free(prev_xmods);
    5.54          }