Fixes for -Wdeclaration-after-statement
authorGabriel Jacobo <gabomdq@gmail.com>
Wed, 21 Aug 2013 10:12:16 -0300
changeset 7679b1fe132bc6a4
parent 7678 286c42d7c5ed
child 7680 6ab959ebea26
Fixes for -Wdeclaration-after-statement
src/render/opengles/SDL_render_gles.c
src/timer/unix/SDL_systimer.c
src/video/SDL_egl.c
src/video/SDL_fillrect.c
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11shape.c
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11xinput2.c
     1.1 --- a/src/render/opengles/SDL_render_gles.c	Wed Aug 21 09:47:10 2013 -0300
     1.2 +++ b/src/render/opengles/SDL_render_gles.c	Wed Aug 21 10:12:16 2013 -0300
     1.3 @@ -864,6 +864,8 @@
     1.4      GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
     1.5      GLfloat minx, miny, maxx, maxy;
     1.6      GLfloat minu, maxu, minv, maxv;
     1.7 +    GLfloat vertices[8];
     1.8 +    GLfloat texCoords[8];
     1.9  
    1.10      GLES_ActivateRenderer(renderer);
    1.11  
    1.12 @@ -924,9 +926,6 @@
    1.13          maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
    1.14          maxv *= texturedata->texh;
    1.15  
    1.16 -        GLfloat vertices[8];
    1.17 -        GLfloat texCoords[8];
    1.18 -
    1.19          vertices[0] = minx;
    1.20          vertices[1] = miny;
    1.21          vertices[2] = maxx;
    1.22 @@ -965,6 +964,9 @@
    1.23      GLfloat minx, miny, maxx, maxy;
    1.24      GLfloat minu, maxu, minv, maxv;
    1.25      GLfloat centerx, centery;
    1.26 +    GLfloat vertices[8];
    1.27 +    GLfloat texCoords[8];
    1.28 +
    1.29  
    1.30      GLES_ActivateRenderer(renderer);
    1.31  
    1.32 @@ -1015,9 +1017,6 @@
    1.33      maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
    1.34      maxv *= texturedata->texh;
    1.35  
    1.36 -    GLfloat vertices[8];
    1.37 -    GLfloat texCoords[8];
    1.38 -
    1.39      vertices[0] = minx;
    1.40      vertices[1] = miny;
    1.41      vertices[2] = maxx;
     2.1 --- a/src/timer/unix/SDL_systimer.c	Wed Aug 21 09:47:10 2013 -0300
     2.2 +++ b/src/timer/unix/SDL_systimer.c	Wed Aug 21 10:12:16 2013 -0300
     2.3 @@ -86,11 +86,11 @@
     2.4  Uint32
     2.5  SDL_GetTicks(void)
     2.6  {
     2.7 +    Uint32 ticks;
     2.8      if (!ticks_started) {
     2.9          SDL_InitTicks();
    2.10      }
    2.11  
    2.12 -    Uint32 ticks;
    2.13      if (has_monotonic_time) {
    2.14  #if HAVE_CLOCK_GETTIME
    2.15          struct timespec now;
    2.16 @@ -115,11 +115,11 @@
    2.17  Uint64
    2.18  SDL_GetPerformanceCounter(void)
    2.19  {
    2.20 +    Uint64 ticks;
    2.21      if (!ticks_started) {
    2.22          SDL_InitTicks();
    2.23      }
    2.24  
    2.25 -    Uint64 ticks;
    2.26      if (has_monotonic_time) {
    2.27  #if HAVE_CLOCK_GETTIME
    2.28          struct timespec now;
     3.1 --- a/src/video/SDL_egl.c	Wed Aug 21 09:47:10 2013 -0300
     3.2 +++ b/src/video/SDL_egl.c	Wed Aug 21 10:12:16 2013 -0300
     3.3 @@ -305,12 +305,12 @@
     3.4  int
     3.5  SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
     3.6  {
     3.7 +    EGLContext egl_context = (EGLContext) context;
     3.8 +
     3.9      if (!_this->egl_data) {
    3.10          return SDL_SetError("OpenGL not initialized");
    3.11      }
    3.12      
    3.13 -    EGLContext egl_context = (EGLContext) context;
    3.14 -    
    3.15      /* The android emulator crashes badly if you try to eglMakeCurrent 
    3.16       * with a valid context and invalid surface, so we have to check for both here.
    3.17       */
    3.18 @@ -330,11 +330,12 @@
    3.19  int
    3.20  SDL_EGL_SetSwapInterval(_THIS, int interval)
    3.21  {
    3.22 +    EGLBoolean status;
    3.23 +    
    3.24      if (_this->egl_data) {
    3.25          return SDL_SetError("OpenGL ES context not active");
    3.26      }
    3.27      
    3.28 -    EGLBoolean status;
    3.29      status = _this->egl_data->eglSwapInterval(_this->egl_data->egl_display, interval);
    3.30      if (status == EGL_TRUE) {
    3.31          _this->egl_data->egl_swapinterval = interval;
    3.32 @@ -363,13 +364,13 @@
    3.33  void
    3.34  SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
    3.35  {
    3.36 +    EGLContext egl_context = (EGLContext) context;
    3.37 +
    3.38      /* Clean up GLES and EGL */
    3.39      if (!_this->egl_data) {
    3.40          return;
    3.41      }
    3.42      
    3.43 -    EGLContext egl_context = (EGLContext) context;
    3.44 -    
    3.45      if (!egl_context && egl_context != EGL_NO_CONTEXT) {
    3.46          SDL_EGL_MakeCurrent(_this, NULL, NULL);
    3.47          _this->egl_data->eglDestroyContext(_this->egl_data->egl_display, egl_context);
     4.1 --- a/src/video/SDL_fillrect.c	Wed Aug 21 09:47:10 2013 -0300
     4.2 +++ b/src/video/SDL_fillrect.c	Wed Aug 21 10:12:16 2013 -0300
     4.3 @@ -36,12 +36,13 @@
     4.4      c128.m128_u32[3] = color;
     4.5  #else
     4.6  #define SSE_BEGIN \
     4.7 +    __m128 c128; \
     4.8      DECLARE_ALIGNED(Uint32, cccc[4], 16); \
     4.9      cccc[0] = color; \
    4.10      cccc[1] = color; \
    4.11      cccc[2] = color; \
    4.12      cccc[3] = color; \
    4.13 -    __m128 c128 = *(__m128 *)cccc;
    4.14 +    c128 = *(__m128 *)cccc;
    4.15  #endif
    4.16  
    4.17  #define SSE_WORK \
    4.18 @@ -59,11 +60,14 @@
    4.19  static void \
    4.20  SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
    4.21  { \
    4.22 +    int i, n; \
    4.23 +    Uint8 *p = NULL; \
    4.24 + \
    4.25      SSE_BEGIN; \
    4.26   \
    4.27      while (h--) { \
    4.28 -        int i, n = w * bpp; \
    4.29 -        Uint8 *p = pixels; \
    4.30 +        n = w * bpp; \
    4.31 +        p = pixels; \
    4.32   \
    4.33          if (n > 63) { \
    4.34              int adjust = 16 - ((uintptr_t)p & 15); \
    4.35 @@ -94,11 +98,13 @@
    4.36  static void
    4.37  SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
    4.38  {
    4.39 +    int i, n;
    4.40 +    Uint8 *p = NULL;
    4.41 +    
    4.42      SSE_BEGIN;
    4.43 -
    4.44      while (h--) {
    4.45 -        int i, n = w;
    4.46 -        Uint8 *p = pixels;
    4.47 +        n = w;
    4.48 +        p = pixels;
    4.49  
    4.50          if (n > 63) {
    4.51              int adjust = 16 - ((uintptr_t)p & 15);
    4.52 @@ -152,11 +158,14 @@
    4.53  static void \
    4.54  SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
    4.55  { \
    4.56 +    int i, n; \
    4.57 +    Uint8 *p = NULL; \
    4.58 + \
    4.59      MMX_BEGIN; \
    4.60   \
    4.61      while (h--) { \
    4.62 -        int i, n = w * bpp; \
    4.63 -        Uint8 *p = pixels; \
    4.64 +        n = w * bpp; \
    4.65 +        p = pixels; \
    4.66   \
    4.67          if (n > 63) { \
    4.68              int adjust = 8 - ((uintptr_t)p & 7); \
     5.1 --- a/src/video/x11/SDL_x11events.c	Wed Aug 21 09:47:10 2013 -0300
     5.2 +++ b/src/video/x11/SDL_x11events.c	Wed Aug 21 10:12:16 2013 -0300
     5.3 @@ -173,11 +173,12 @@
     5.4  */
     5.5  static char* X11_URIToLocal(char* uri) {
     5.6      char *file = NULL;
     5.7 +    SDL_bool local;
     5.8  
     5.9      if (memcmp(uri,"file:/",6) == 0) uri += 6;      /* local file? */
    5.10      else if (strstr(uri,":/") != NULL) return file; /* wrong scheme */
    5.11  
    5.12 -    SDL_bool local = uri[0] != '/' || ( uri[0] != '\0' && uri[1] == '/' );
    5.13 +    local = uri[0] != '/' || ( uri[0] != '\0' && uri[1] == '/' );
    5.14  
    5.15      /* got a hostname? */
    5.16      if ( !local && uri[0] == '/' && uri[2] != '/' ) {
    5.17 @@ -267,6 +268,7 @@
    5.18      SDL_WindowData *data;
    5.19      XEvent xevent;
    5.20      int i;
    5.21 +    XClientMessageEvent m;
    5.22  
    5.23      SDL_zero(xevent);           /* valgrind fix. --ryan. */
    5.24      XNextEvent(display, &xevent);
    5.25 @@ -549,7 +551,6 @@
    5.26              else if (xevent.xclient.message_type == videodata->XdndPosition) {
    5.27  
    5.28                  /* reply with status */
    5.29 -                XClientMessageEvent m;
    5.30                  memset(&m, 0, sizeof(XClientMessageEvent));
    5.31                  m.type = ClientMessage;
    5.32                  m.display = xevent.xclient.display;
    5.33 @@ -568,7 +569,6 @@
    5.34              else if(xevent.xclient.message_type == videodata->XdndDrop) {
    5.35                  if (data->xdnd_req == None) {
    5.36                      /* say again - not interested! */
    5.37 -                    XClientMessageEvent m;
    5.38                      memset(&m, 0, sizeof(XClientMessageEvent));
    5.39                      m.type = ClientMessage;
    5.40                      m.display = xevent.xclient.display;
    5.41 @@ -841,7 +841,6 @@
    5.42                  XFree(p.data);
    5.43  
    5.44                  /* send reply */
    5.45 -                XClientMessageEvent m;
    5.46                  SDL_memset(&m, 0, sizeof(XClientMessageEvent));
    5.47                  m.type = ClientMessage;
    5.48                  m.display = display;
     6.1 --- a/src/video/x11/SDL_x11opengl.c	Wed Aug 21 09:47:10 2013 -0300
     6.2 +++ b/src/video/x11/SDL_x11opengl.c	Wed Aug 21 10:12:16 2013 -0300
     6.3 @@ -564,6 +564,7 @@
     6.4      XVisualInfo v, *vinfo;
     6.5      int n;
     6.6      GLXContext context = NULL, share_context;
     6.7 +    PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = NULL;
     6.8  
     6.9      if (_this->gl_config.share_with_current_context) {
    6.10          share_context = (GLXContext)SDL_GL_GetCurrentContext();
    6.11 @@ -617,7 +618,7 @@
    6.12                  attribs[iattr++] = 0;
    6.13  
    6.14                  /* Get a pointer to the context creation function for GL 3.0 */
    6.15 -                PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs =
    6.16 +                glXCreateContextAttribs =
    6.17                      (PFNGLXCREATECONTEXTATTRIBSARBPROC) _this->gl_data->
    6.18                      glXGetProcAddress((GLubyte *)
    6.19                                        "glXCreateContextAttribsARB");
     7.1 --- a/src/video/x11/SDL_x11shape.c	Wed Aug 21 09:47:10 2013 -0300
     7.2 +++ b/src/video/x11/SDL_x11shape.c	Wed Aug 21 10:12:16 2013 -0300
     7.3 @@ -36,6 +36,8 @@
     7.4  SDL_WindowShaper*
     7.5  X11_CreateShaper(SDL_Window* window) {
     7.6      SDL_WindowShaper* result = NULL;
     7.7 +    SDL_ShapeData* data = NULL;
     7.8 +    int resized_properly;
     7.9  
    7.10  #if SDL_VIDEO_DRIVER_X11_XSHAPE
    7.11      if (SDL_X11_HAVE_XSHAPE) {  /* Make sure X server supports it. */
    7.12 @@ -44,12 +46,12 @@
    7.13          result->mode.mode = ShapeModeDefault;
    7.14          result->mode.parameters.binarizationCutoff = 1;
    7.15          result->userx = result->usery = 0;
    7.16 -        SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData));
    7.17 +        data = SDL_malloc(sizeof(SDL_ShapeData));
    7.18          result->driverdata = data;
    7.19          data->bitmapsize = 0;
    7.20          data->bitmap = NULL;
    7.21          window->shaper = result;
    7.22 -        int resized_properly = X11_ResizeWindowShape(window);
    7.23 +        resized_properly = X11_ResizeWindowShape(window);
    7.24          SDL_assert(resized_properly == 0);
    7.25      }
    7.26  #endif
    7.27 @@ -60,9 +62,9 @@
    7.28  int
    7.29  X11_ResizeWindowShape(SDL_Window* window) {
    7.30      SDL_ShapeData* data = window->shaper->driverdata;
    7.31 +    unsigned int bitmapsize = window->w / 8;
    7.32      SDL_assert(data != NULL);
    7.33  
    7.34 -    unsigned int bitmapsize = window->w / 8;
    7.35      if(window->w % 8 > 0)
    7.36          bitmapsize += 1;
    7.37      bitmapsize *= window->h;
    7.38 @@ -86,6 +88,10 @@
    7.39  
    7.40  int
    7.41  X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
    7.42 +    SDL_ShapeData *data = NULL;
    7.43 +    SDL_WindowData *windowdata = NULL;
    7.44 +    Pixmap shapemask = NULL;
    7.45 +    
    7.46      if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
    7.47          return -1;
    7.48  
    7.49 @@ -94,13 +100,13 @@
    7.50          return -2;
    7.51      if(shape->w != shaper->window->w || shape->h != shaper->window->h)
    7.52          return -3;
    7.53 -    SDL_ShapeData *data = shaper->driverdata;
    7.54 +    data = shaper->driverdata;
    7.55  
    7.56      /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
    7.57      SDL_CalculateShapeBitmap(shaper->mode,shape,data->bitmap,8);
    7.58  
    7.59 -    SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata);
    7.60 -    Pixmap shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
    7.61 +    windowdata = (SDL_WindowData*)(shaper->window->driverdata);
    7.62 +    shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
    7.63  
    7.64      XShapeCombineMask(windowdata->videodata->display,windowdata->xwindow, ShapeBounding, 0, 0,shapemask, ShapeSet);
    7.65      XSync(windowdata->videodata->display,False);
     8.1 --- a/src/video/x11/SDL_x11video.c	Wed Aug 21 09:47:10 2013 -0300
     8.2 +++ b/src/video/x11/SDL_x11video.c	Wed Aug 21 10:12:16 2013 -0300
     8.3 @@ -259,10 +259,11 @@
     8.4  static int
     8.5  X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
     8.6  {
     8.7 +    SDL_VideoDevice *device = NULL;
     8.8      /* if we trigger an error in our error handler, don't try again. */
     8.9      if (!safety_net_triggered) {
    8.10          safety_net_triggered = SDL_TRUE;
    8.11 -        SDL_VideoDevice *device = SDL_GetVideoDevice();
    8.12 +        device = SDL_GetVideoDevice();
    8.13          if (device != NULL) {
    8.14              int i;
    8.15              for (i = 0; i < device->num_displays; i++) {
     9.1 --- a/src/video/x11/SDL_x11xinput2.c	Wed Aug 21 09:47:10 2013 -0300
     9.2 +++ b/src/video/x11/SDL_x11xinput2.c	Wed Aug 21 10:12:16 2013 -0300
     9.3 @@ -206,14 +206,17 @@
     9.4  X11_Xinput2SelectTouch(_THIS, SDL_Window *window)
     9.5  {
     9.6  #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
     9.7 +    SDL_VideoData *data = NULL;
     9.8 +    XIEventMask eventmask;
     9.9 +    unsigned char mask[3] = { 0,0,0 };
    9.10 +    SDL_WindowData *window_data = NULL;
    9.11 +    
    9.12      if (!X11_Xinput2IsMultitouchSupported()) {
    9.13          return;
    9.14      }
    9.15  
    9.16 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    9.17 -    XIEventMask eventmask;
    9.18 -    unsigned char mask[3] = { 0,0,0 };
    9.19 -    SDL_WindowData *window_data = (SDL_WindowData*)window->driverdata;
    9.20 +    data = (SDL_VideoData *) _this->driverdata;
    9.21 +    window_data = (SDL_WindowData*)window->driverdata;
    9.22  
    9.23      eventmask.deviceid = XIAllMasterDevices;
    9.24      eventmask.mask_len = sizeof(mask);