SDL_blit_N.c (BlitNtoNKeyCopyAlpha): fix -Wshadow warnings by adding _
authorOzkan Sezer <sezeroz@gmail.com>
Mon, 01 Oct 2018 21:29:11 +0300
changeset 12273c522b61334f1
parent 12272 c68b05ca0761
child 12274 736699aa224d
SDL_blit_N.c (BlitNtoNKeyCopyAlpha): fix -Wshadow warnings by adding _
suffix to the temp Pixel local in the DUFFS_LOOP.
SDL_blit.h (ASSEMBLE_RGB): add _ prefix to temp Pixel locals to avoid
any possible shadowings.


The warnings were like the following:

In file included from src/video/SDL_blit_N.c:26:0:
src/video/SDL_blit_N.c: In function 'BlitNtoNKeyCopyAlpha':
src/video/SDL_blit_N.c:2421:24: warning: declaration of 'Pixel' shadows a previous local [-Wshadow]
Uint32 Pixel = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
^
src/video/SDL_blit.h:475:21: note: in definition of macro 'DUFFS_LOOP8'
case 0: do { pixel_copy_increment; /* fallthrough */ \
^
src/video/SDL_blit_N.c:2419:13: note: in expansion of macro 'DUFFS_LOOP'
DUFFS_LOOP(
^
src/video/SDL_blit_N.c:2399:12: warning: shadowed declaration is here [-Wshadow]
Uint32 Pixel;
^
src/video/SDL_blit.h
src/video/SDL_blit_N.c
     1.1 --- a/src/video/SDL_blit.h	Mon Oct 01 09:47:10 2018 -0700
     1.2 +++ b/src/video/SDL_blit.h	Mon Oct 01 21:29:11 2018 +0300
     1.3 @@ -126,7 +126,7 @@
     1.4      b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
     1.5  }
     1.6  #define RGB_FROM_RGB565(Pixel, r, g, b)                                 \
     1.7 -    {                                                                   \
     1.8 +{                                                                       \
     1.9      r = SDL_expand_byte[3][((Pixel&0xF800)>>11)];                       \
    1.10      g = SDL_expand_byte[2][((Pixel&0x07E0)>>5)];                        \
    1.11      b = SDL_expand_byte[3][(Pixel&0x001F)];                             \
    1.12 @@ -262,18 +262,18 @@
    1.13  {                                                                       \
    1.14      switch (bpp) {                                                      \
    1.15          case 1: {                                                       \
    1.16 -            Uint8 Pixel;                                                \
    1.17 +            Uint8 _Pixel;                                               \
    1.18                                                                          \
    1.19 -            PIXEL_FROM_RGB(Pixel, fmt, r, g, b);                        \
    1.20 -            *((Uint8 *)(buf)) = Pixel;                                  \
    1.21 +            PIXEL_FROM_RGB(_Pixel, fmt, r, g, b);                       \
    1.22 +            *((Uint8 *)(buf)) = _Pixel;                                 \
    1.23          }                                                               \
    1.24          break;                                                          \
    1.25                                                                          \
    1.26          case 2: {                                                       \
    1.27 -            Uint16 Pixel;                                               \
    1.28 +            Uint16 _Pixel;                                              \
    1.29                                                                          \
    1.30 -            PIXEL_FROM_RGB(Pixel, fmt, r, g, b);                        \
    1.31 -            *((Uint16 *)(buf)) = Pixel;                                 \
    1.32 +            PIXEL_FROM_RGB(_Pixel, fmt, r, g, b);                       \
    1.33 +            *((Uint16 *)(buf)) = _Pixel;                                \
    1.34          }                                                               \
    1.35          break;                                                          \
    1.36                                                                          \
    1.37 @@ -291,10 +291,10 @@
    1.38          break;                                                          \
    1.39                                                                          \
    1.40          case 4: {                                                       \
    1.41 -            Uint32 Pixel;                                               \
    1.42 +            Uint32 _Pixel;                                              \
    1.43                                                                          \
    1.44 -            PIXEL_FROM_RGB(Pixel, fmt, r, g, b);                        \
    1.45 -            *((Uint32 *)(buf)) = Pixel;                                 \
    1.46 +            PIXEL_FROM_RGB(_Pixel, fmt, r, g, b);                       \
    1.47 +            *((Uint32 *)(buf)) = _Pixel;                                \
    1.48          }                                                               \
    1.49          break;                                                          \
    1.50      }                                                                   \
     2.1 --- a/src/video/SDL_blit_N.c	Mon Oct 01 09:47:10 2018 -0700
     2.2 +++ b/src/video/SDL_blit_N.c	Mon Oct 01 21:29:11 2018 +0300
     2.3 @@ -2418,8 +2418,8 @@
     2.4              /* *INDENT-OFF* */
     2.5              DUFFS_LOOP(
     2.6              {
     2.7 -                Uint32 Pixel = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
     2.8 -                *dst32 = Pixel;
     2.9 +                Uint32 Pixel_ = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
    2.10 +                *dst32 = Pixel_;
    2.11                  ++src32;
    2.12                  ++dst32;
    2.13              },