Browse Source

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;
^

Ozkan Sezer 6 years ago
parent
commit
922623e1b6
2 changed files with 12 additions and 12 deletions
  1. 10 10
      src/video/SDL_blit.h
  2. 2 2
      src/video/SDL_blit_N.c

+ 10 - 10
src/video/SDL_blit.h

@@ -126,7 +126,7 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
     b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
 }
 #define RGB_FROM_RGB565(Pixel, r, g, b)                                 \
-    {                                                                   \
+{                                                                       \
     r = SDL_expand_byte[3][((Pixel&0xF800)>>11)];                       \
     g = SDL_expand_byte[2][((Pixel&0x07E0)>>5)];                        \
     b = SDL_expand_byte[3][(Pixel&0x001F)];                             \
@@ -262,18 +262,18 @@ do {                                                                    \
 {                                                                       \
     switch (bpp) {                                                      \
         case 1: {                                                       \
-            Uint8 Pixel;                                                \
+            Uint8 _Pixel;                                               \
                                                                         \
-            PIXEL_FROM_RGB(Pixel, fmt, r, g, b);                        \
-            *((Uint8 *)(buf)) = Pixel;                                  \
+            PIXEL_FROM_RGB(_Pixel, fmt, r, g, b);                       \
+            *((Uint8 *)(buf)) = _Pixel;                                 \
         }                                                               \
         break;                                                          \
                                                                         \
         case 2: {                                                       \
-            Uint16 Pixel;                                               \
+            Uint16 _Pixel;                                              \
                                                                         \
-            PIXEL_FROM_RGB(Pixel, fmt, r, g, b);                        \
-            *((Uint16 *)(buf)) = Pixel;                                 \
+            PIXEL_FROM_RGB(_Pixel, fmt, r, g, b);                       \
+            *((Uint16 *)(buf)) = _Pixel;                                \
         }                                                               \
         break;                                                          \
                                                                         \
@@ -291,10 +291,10 @@ do {                                                                    \
         break;                                                          \
                                                                         \
         case 4: {                                                       \
-            Uint32 Pixel;                                               \
+            Uint32 _Pixel;                                              \
                                                                         \
-            PIXEL_FROM_RGB(Pixel, fmt, r, g, b);                        \
-            *((Uint32 *)(buf)) = Pixel;                                 \
+            PIXEL_FROM_RGB(_Pixel, fmt, r, g, b);                       \
+            *((Uint32 *)(buf)) = _Pixel;                                \
         }                                                               \
         break;                                                          \
     }                                                                   \

+ 2 - 2
src/video/SDL_blit_N.c

@@ -2418,8 +2418,8 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info)
             /* *INDENT-OFF* */
             DUFFS_LOOP(
             {
-                Uint32 Pixel = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
-                *dst32 = Pixel;
+                Uint32 Pixel_ = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
+                *dst32 = Pixel_;
                 ++src32;
                 ++dst32;
             },