Fixed a whole slew of compiler warnings that -Wall exposed.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 13 Oct 2011 01:08:30 -0400
changeset 598175caa8a7d559
parent 5980 612b41c44af1
child 5982 f324bd81b52c
Fixed a whole slew of compiler warnings that -Wall exposed.
src/cpuinfo/SDL_cpuinfo.c
src/events/SDL_gesture.c
src/events/SDL_mouse.c
src/power/linux/SDL_syspower.c
src/render/opengl/SDL_render_gl.c
src/render/software/SDL_blendline.c
src/render/software/SDL_draw.h
src/thread/pthread/SDL_syssem.c
src/thread/pthread/SDL_systhread.c
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11framebuffer.c
src/video/x11/SDL_x11mouse.c
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11shape.c
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11touch.c
src/video/x11/SDL_x11window.c
     1.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Wed Oct 12 20:01:09 2011 -0400
     1.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Oct 13 01:08:30 2011 -0400
     1.3 @@ -384,6 +384,8 @@
     1.4      return SDL_CPUType;
     1.5  }
     1.6  
     1.7 +
     1.8 +#ifdef TEST_MAIN  /* !!! FIXME: only used for test at the moment. */
     1.9  static const char *
    1.10  SDL_GetCPUName(void)
    1.11  {
    1.12 @@ -455,6 +457,7 @@
    1.13      }
    1.14      return SDL_CPUName;
    1.15  }
    1.16 +#endif
    1.17  
    1.18  int
    1.19  SDL_GetCPUCacheLineSize(void)
     2.1 --- a/src/events/SDL_gesture.c	Wed Oct 12 20:01:09 2011 -0400
     2.2 +++ b/src/events/SDL_gesture.c	Thu Oct 13 01:08:30 2011 -0400
     2.3 @@ -390,10 +390,11 @@
     2.4  float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) {
     2.5          
     2.6          SDL_FloatPoint points[DOLLARNPOINTS];
     2.7 -        int numPoints = dollarNormalize(path,points);
     2.8          int i;
     2.9          float bestDiff = 10000;
    2.10  
    2.11 +        dollarNormalize(path,points);
    2.12 +
    2.13          //PrintPath(points);
    2.14          *bestTempl = -1;
    2.15          for(i = 0;i < touch->numDollarTemplates;i++) {
     3.1 --- a/src/events/SDL_mouse.c	Wed Oct 12 20:01:09 2011 -0400
     3.2 +++ b/src/events/SDL_mouse.c	Thu Oct 13 01:08:30 2011 -0400
     3.3 @@ -349,7 +349,6 @@
     3.4  SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
     3.5                   int w, int h, int hot_x, int hot_y)
     3.6  {
     3.7 -    SDL_Mouse *mouse = SDL_GetMouse();
     3.8      SDL_Surface *surface;
     3.9      SDL_Cursor *cursor;
    3.10      int x, y;
     4.1 --- a/src/power/linux/SDL_syspower.c	Wed Oct 12 20:01:09 2011 -0400
     4.2 +++ b/src/power/linux/SDL_syspower.c	Thu Oct 13 01:08:30 2011 -0400
     4.3 @@ -128,7 +128,6 @@
     4.4      char *val = NULL;
     4.5      SDL_bool charge = SDL_FALSE;
     4.6      SDL_bool choose = SDL_FALSE;
     4.7 -    SDL_bool is_ac = SDL_FALSE;
     4.8      int maximum = -1;
     4.9      int remaining = -1;
    4.10      int secs = -1;
    4.11 @@ -214,13 +213,6 @@
    4.12      char *ptr = NULL;
    4.13      char *key = NULL;
    4.14      char *val = NULL;
    4.15 -    SDL_bool charge = SDL_FALSE;
    4.16 -    SDL_bool choose = SDL_FALSE;
    4.17 -    SDL_bool is_ac = SDL_FALSE;
    4.18 -    int maximum = -1;
    4.19 -    int remaining = -1;
    4.20 -    int secs = -1;
    4.21 -    int pct = -1;
    4.22  
    4.23      if (!load_acpi_file(base, node, "state", state, sizeof (state))) {
    4.24          return;
     5.1 --- a/src/render/opengl/SDL_render_gl.c	Wed Oct 12 20:01:09 2011 -0400
     5.2 +++ b/src/render/opengl/SDL_render_gl.c	Thu Oct 13 01:08:30 2011 -0400
     5.3 @@ -348,8 +348,6 @@
     5.4  static void
     5.5  GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
     5.6  {
     5.7 -    GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
     5.8 -
     5.9      if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
    5.10          /* Rebind the context to the window area and update matrices */
    5.11          SDL_CurrentContext = NULL;
     6.1 --- a/src/render/software/SDL_blendline.c	Wed Oct 12 20:01:09 2011 -0400
     6.2 +++ b/src/render/software/SDL_blendline.c	Thu Oct 13 01:08:30 2011 -0400
     6.3 @@ -124,7 +124,6 @@
     6.4                       SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
     6.5                       SDL_bool draw_end)
     6.6  {
     6.7 -    const SDL_PixelFormat *fmt = dst->format;
     6.8      unsigned r, g, b, a, inva;
     6.9  
    6.10      if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
    6.11 @@ -216,7 +215,6 @@
    6.12                       SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
    6.13                       SDL_bool draw_end)
    6.14  {
    6.15 -    const SDL_PixelFormat *fmt = dst->format;
    6.16      unsigned r, g, b, a, inva;
    6.17  
    6.18      if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
    6.19 @@ -492,7 +490,6 @@
    6.20                       SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
    6.21                       SDL_bool draw_end)
    6.22  {
    6.23 -    const SDL_PixelFormat *fmt = dst->format;
    6.24      unsigned r, g, b, a, inva;
    6.25  
    6.26      if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
    6.27 @@ -584,7 +581,6 @@
    6.28                         SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
    6.29                         SDL_bool draw_end)
    6.30  {
    6.31 -    const SDL_PixelFormat *fmt = dst->format;
    6.32      unsigned r, g, b, a, inva;
    6.33  
    6.34      if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
     7.1 --- a/src/render/software/SDL_draw.h	Wed Oct 12 20:01:09 2011 -0400
     7.2 +++ b/src/render/software/SDL_draw.h	Thu Oct 13 01:08:30 2011 -0400
     7.3 @@ -45,13 +45,13 @@
     7.4  
     7.5  #define DRAW_SETPIXEL(setpixel) \
     7.6  do { \
     7.7 -    unsigned sr = r, sg = g, sb = b, sa = a; \
     7.8 +    unsigned sr = r, sg = g, sb = b, sa = a; (void) sa; \
     7.9      setpixel; \
    7.10  } while (0)
    7.11  
    7.12  #define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
    7.13  do { \
    7.14 -    unsigned sr, sg, sb, sa; sa; \
    7.15 +    unsigned sr, sg, sb, sa; (void) sa; \
    7.16      getpixel; \
    7.17      sr = DRAW_MUL(inva, sr) + r; \
    7.18      sg = DRAW_MUL(inva, sg) + g; \
    7.19 @@ -61,7 +61,7 @@
    7.20  
    7.21  #define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
    7.22  do { \
    7.23 -    unsigned sr, sg, sb, sa; sa; \
    7.24 +    unsigned sr, sg, sb, sa; (void) sa; \
    7.25      getpixel; \
    7.26      sr += r; if (sr > 0xff) sr = 0xff; \
    7.27      sg += g; if (sg > 0xff) sg = 0xff; \
    7.28 @@ -71,7 +71,7 @@
    7.29  
    7.30  #define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
    7.31  do { \
    7.32 -    unsigned sr, sg, sb, sa; sa; \
    7.33 +    unsigned sr, sg, sb, sa; (void) sa; \
    7.34      getpixel; \
    7.35      sr = DRAW_MUL(sr, r); \
    7.36      sg = DRAW_MUL(sg, g); \
     8.1 --- a/src/thread/pthread/SDL_syssem.c	Wed Oct 12 20:01:09 2011 -0400
     8.2 +++ b/src/thread/pthread/SDL_syssem.c	Thu Oct 13 01:08:30 2011 -0400
     8.3 @@ -23,6 +23,7 @@
     8.4  #include <errno.h>
     8.5  #include <pthread.h>
     8.6  #include <semaphore.h>
     8.7 +#include <sys/time.h>
     8.8  
     8.9  #include "SDL_thread.h"
    8.10  #include "SDL_timer.h"
     9.1 --- a/src/thread/pthread/SDL_systhread.c	Wed Oct 12 20:01:09 2011 -0400
     9.2 +++ b/src/thread/pthread/SDL_systhread.c	Thu Oct 13 01:08:30 2011 -0400
     9.3 @@ -18,6 +18,7 @@
     9.4       misrepresented as being the original software.
     9.5    3. This notice may not be removed or altered from any source distribution.
     9.6  */
     9.7 +
     9.8  #include "SDL_config.h"
     9.9  
    9.10  #include <pthread.h>
    9.11 @@ -31,6 +32,8 @@
    9.12  #include <sys/time.h>
    9.13  #include <sys/resource.h>
    9.14  #include <sys/syscall.h>
    9.15 +#include <unistd.h>
    9.16 +extern int pthread_setname_np (pthread_t __target_thread, __const char *__name) __THROW __nonnull ((2));
    9.17  #endif
    9.18  
    9.19  #include "SDL_platform.h"
    10.1 --- a/src/video/x11/SDL_x11events.c	Wed Oct 12 20:01:09 2011 -0400
    10.2 +++ b/src/video/x11/SDL_x11events.c	Thu Oct 13 01:08:30 2011 -0400
    10.3 @@ -234,7 +234,6 @@
    10.4      case KeyPress:{
    10.5              KeyCode keycode = xevent.xkey.keycode;
    10.6              KeySym keysym = NoSymbol;
    10.7 -            SDL_Scancode scancode;
    10.8              char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
    10.9              Status status = 0;
   10.10  
   10.11 @@ -243,7 +242,7 @@
   10.12  #endif
   10.13              SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
   10.14  #if 1
   10.15 -            if (videodata->key_layout[keycode] == SDLK_UNKNOWN) {
   10.16 +            if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN) {
   10.17                  int min_keycode, max_keycode;
   10.18                  XDisplayKeycodes(display, &min_keycode, &max_keycode);
   10.19                  keysym = XKeycodeToKeysym(display, keycode, 0);
   10.20 @@ -522,6 +521,11 @@
   10.21      return (0);
   10.22  }
   10.23  
   10.24 +
   10.25 +/* !!! FIXME: this should be exposed in a header, or something. */
   10.26 +int SDL_GetNumTouch(void);
   10.27 +
   10.28 +
   10.29  void
   10.30  X11_PumpEvents(_THIS)
   10.31  {
   10.32 @@ -545,7 +549,6 @@
   10.33  #ifdef SDL_INPUT_LINUXEV
   10.34      /* Process Touch events - TODO When X gets touch support, use that instead*/
   10.35      int i = 0,rd;
   10.36 -    char name[256];
   10.37      struct input_event ev[64];
   10.38      int size = sizeof (struct input_event);
   10.39  
    11.1 --- a/src/video/x11/SDL_x11framebuffer.c	Wed Oct 12 20:01:09 2011 -0400
    11.2 +++ b/src/video/x11/SDL_x11framebuffer.c	Thu Oct 13 01:08:30 2011 -0400
    11.3 @@ -183,7 +183,10 @@
    11.4                    rect->x, rect->y, rect->w, rect->h);
    11.5          }
    11.6      }
    11.7 +
    11.8      XSync(display, False);
    11.9 +
   11.10 +    return 0;
   11.11  }
   11.12  
   11.13  void
    12.1 --- a/src/video/x11/SDL_x11mouse.c	Wed Oct 12 20:01:09 2011 -0400
    12.2 +++ b/src/video/x11/SDL_x11mouse.c	Thu Oct 13 01:08:30 2011 -0400
    12.3 @@ -136,7 +136,7 @@
    12.4      /* Code below assumes ARGB pixel format */
    12.5      SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
    12.6  
    12.7 -    rfg = gfg = bfg = rbg = gbg = bbg = fgBits = 0;
    12.8 +    rfg = gfg = bfg = rbg = gbg = bbg = fgBits = bgBits = 0;
    12.9      for (y = 0; y < surface->h; ++y) {
   12.10          ptr = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch);
   12.11          for (x = 0; x < surface->w; ++x) {
    13.1 --- a/src/video/x11/SDL_x11opengl.c	Wed Oct 12 20:01:09 2011 -0400
    13.2 +++ b/src/video/x11/SDL_x11opengl.c	Thu Oct 13 01:08:30 2011 -0400
    13.3 @@ -19,8 +19,8 @@
    13.4    3. This notice may not be removed or altered from any source distribution.
    13.5  */
    13.6  #include "SDL_config.h"
    13.7 -
    13.8  #include "SDL_x11video.h"
    13.9 +#include "SDL_assert.h"
   13.10  
   13.11  /* GLX implementation of SDL OpenGL support */
   13.12  
   13.13 @@ -388,8 +388,10 @@
   13.14      XVisualInfo *vinfo;
   13.15  
   13.16      /* 64 seems nice. */
   13.17 -    int attribs[64];
   13.18 -    int i = X11_GL_GetAttributes(_this,display,screen,attribs,64);
   13.19 +    const int max_attrs = 64;
   13.20 +    int attribs[max_attrs];
   13.21 +    const int i = X11_GL_GetAttributes(_this,display,screen,attribs,max_attrs);
   13.22 +    SDL_assert(i <= max_attrs);
   13.23  
   13.24      vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
   13.25      if (!vinfo) {
    14.1 --- a/src/video/x11/SDL_x11shape.c	Wed Oct 12 20:01:09 2011 -0400
    14.2 +++ b/src/video/x11/SDL_x11shape.c	Thu Oct 13 01:08:30 2011 -0400
    14.3 @@ -26,6 +26,7 @@
    14.4  #include "SDL_x11video.h"
    14.5  #include "SDL_x11shape.h"
    14.6  #include "SDL_x11window.h"
    14.7 +#include "../SDL_shape_internals.h"
    14.8  
    14.9  SDL_Window*
   14.10  X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
    15.1 --- a/src/video/x11/SDL_x11sym.h	Wed Oct 12 20:01:09 2011 -0400
    15.2 +++ b/src/video/x11/SDL_x11sym.h	Thu Oct 13 01:08:30 2011 -0400
    15.3 @@ -178,17 +178,17 @@
    15.4  /* XCursor support */
    15.5  #if SDL_VIDEO_DRIVER_X11_XCURSOR
    15.6  SDL_X11_MODULE(XCURSOR)
    15.7 -SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),)
    15.8 +SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),return)
    15.9  SDL_X11_SYM(void,XcursorImageDestroy,(XcursorImage *a),(a),)
   15.10 -SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),)
   15.11 +SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),return)
   15.12  #endif
   15.13  
   15.14  /* Xinerama support */
   15.15  #if SDL_VIDEO_DRIVER_X11_XINERAMA
   15.16  SDL_X11_MODULE(XINERAMA)
   15.17 -SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),)
   15.18 -SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),)
   15.19 -SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),)
   15.20 +SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),return)
   15.21 +SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
   15.22 +SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),return)
   15.23  #endif
   15.24  
   15.25  /* XInput support for multiple mice, tablets, etc. */
   15.26 @@ -229,12 +229,12 @@
   15.27  
   15.28  #if SDL_VIDEO_DRIVER_X11_XVIDMODE
   15.29  SDL_X11_MODULE(XVIDMODE)
   15.30 -SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),)
   15.31 -SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),)
   15.32 -SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),)
   15.33 -SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),)
   15.34 -SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),)
   15.35 -SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),)
   15.36 +SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),return)
   15.37 +SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),return)
   15.38 +SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),return)
   15.39 +SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
   15.40 +SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),return)
   15.41 +SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),return)
   15.42  #endif
   15.43  
   15.44  /* *INDENT-ON* */
    16.1 --- a/src/video/x11/SDL_x11touch.c	Wed Oct 12 20:01:09 2011 -0400
    16.2 +++ b/src/video/x11/SDL_x11touch.c	Thu Oct 13 01:08:30 2011 -0400
    16.3 @@ -39,7 +39,6 @@
    16.4    FILE *fd;
    16.5    fd = fopen("/proc/bus/input/devices","r");
    16.6  
    16.7 -  char c;
    16.8    int i = 0;
    16.9    int tsfd;
   16.10    char line[256];
   16.11 @@ -111,7 +110,7 @@
   16.12      }
   16.13    }
   16.14  
   16.15 -  close(fd);
   16.16 +  fclose(fd);
   16.17  #endif
   16.18  }
   16.19  
    17.1 --- a/src/video/x11/SDL_x11window.c	Wed Oct 12 20:01:09 2011 -0400
    17.2 +++ b/src/video/x11/SDL_x11window.c	Thu Oct 13 01:08:30 2011 -0400
    17.3 @@ -86,31 +86,6 @@
    17.4      return count;
    17.5  }
    17.6  
    17.7 -static void
    17.8 -X11_GetDisplaySize(_THIS, SDL_Window * window, int *w, int *h)
    17.9 -{
   17.10 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   17.11 -    SDL_DisplayData *displaydata =
   17.12 -        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
   17.13 -    XWindowAttributes attr;
   17.14 -
   17.15 -    XGetWindowAttributes(data->display, RootWindow(data->display, displaydata->screen), &attr);
   17.16 -    if (window->flags & SDL_WINDOW_FULLSCREEN) {
   17.17 -        /* The bounds when this window is visible is the fullscreen mode */
   17.18 -        SDL_DisplayMode fullscreen_mode;
   17.19 -        if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
   17.20 -            attr.width = fullscreen_mode.w;
   17.21 -            attr.height = fullscreen_mode.h;
   17.22 -        }
   17.23 -    }
   17.24 -    if (w) {
   17.25 -        *w = attr.width;
   17.26 -    }
   17.27 -    if (h) {
   17.28 -        *h = attr.height;
   17.29 -    }
   17.30 -}
   17.31 -
   17.32  static int
   17.33  SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
   17.34  {
   17.35 @@ -320,7 +295,6 @@
   17.36      xattr.border_pixel = 0;
   17.37  
   17.38      if (visual->class == DirectColor) {
   17.39 -        Status status;
   17.40          XColor *colorcells;
   17.41          int i;
   17.42          int ncolors;
   17.43 @@ -757,7 +731,6 @@
   17.44  {
   17.45      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   17.46      Display *display = data->videodata->display;
   17.47 -    int x, y;
   17.48  
   17.49      XMoveWindow(display, data->xwindow, window->x, window->y);
   17.50      XFlush(display);
   17.51 @@ -952,7 +925,7 @@
   17.52      int ncolors;
   17.53      int rmask, gmask, bmask;
   17.54      int rshift, gshift, bshift;
   17.55 -    int i, j;
   17.56 +    int i;
   17.57  
   17.58      if (visual->class != DirectColor) {
   17.59          SDL_SetError("Window doesn't have DirectColor visual");