From 922623e1b6fe201516f69d20d04ec993d94020c9 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Mon, 1 Oct 2018 21:29:11 +0300 Subject: [PATCH] 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 | 20 ++++++++++---------- src/video/SDL_blit_N.c | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/video/SDL_blit.h b/src/video/SDL_blit.h index ca10534453f6f..6c95aafd050f4 100644 --- a/src/video/SDL_blit.h +++ b/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; \ } \ diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 5a7ba9d496a9c..de495163a8db5 100644 --- a/src/video/SDL_blit_N.c +++ b/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; },