[vlc-commits] [Git][videolan/vlc][master] swscale: rename pointer to avoid shadowing

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jul 29 15:26:41 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2fe1b994 by Alexandre Janniaux at 2023-07-29T15:11:08+00:00
swscale: rename pointer to avoid shadowing

The dst pointer was shadowing a variable of a different type (before was
declared a uint8_t *[4] vs uint8_t* after). The variable is mostly used
for copying the palette in multiple steps while tracking the beginning
of the current step, so renaming it "cursor".

    ../../modules/video_chroma/swscale.c: In function ‘Convert’:
    ../../modules/video_chroma/swscale.c:632:22: warning: declaration of ‘dst’ shadows a previous local [-Wshadow=local]
      632 |             uint8_t *dst = palette;
          |                      ^~~
    ../../modules/video_chroma/swscale.c:619:23: note: shadowed declaration is here
      619 |     uint8_t *src[4], *dst[4];
          |                       ^~~

Warning from commit 1df6df8b27e6e3b6e5caec8dda613059530cf98a.

- - - - -


1 changed file:

- modules/video_chroma/swscale.c


Changes:

=====================================
modules/video_chroma/swscale.c
=====================================
@@ -629,11 +629,11 @@ static void Convert( filter_t *p_filter, struct SwsContext *ctx,
             const video_palette_t *p_palette = p_filter->fmt_in.video.p_palette;
             static_assert(sizeof(p_palette->palette) == AVPALETTE_SIZE,
                           "Palette size mismatch between vlc and libavutil");
-            uint8_t *dst = palette;
+            uint8_t *cursor = palette;
             for (size_t i=0; i<sizeof(p_palette->palette[0]); i++)
             {
-                memcpy(dst, p_palette->palette[i], ARRAY_SIZE(p_palette->palette));
-                dst += ARRAY_SIZE(p_palette->palette);
+                memcpy(cursor, p_palette->palette[i], ARRAY_SIZE(p_palette->palette));
+                cursor += ARRAY_SIZE(p_palette->palette);
             }
         }
         else



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2fe1b99471f8bea1d6aff30c5ec65b35d87398e8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2fe1b99471f8bea1d6aff30c5ec65b35d87398e8
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list