[FFmpeg-cvslog] avcodec/g2meet: fix variable shadowing

Marvin Scholz git at videolan.org
Fri Sep 13 20:43:47 EEST 2024


ffmpeg | branch: master | Marvin Scholz <epirat07 at gmail.com> | Sun Sep  8 23:25:51 2024 +0200| [0f87ff0db41df2dde91f51da833316cf050a73e2] | committer: Marvin Scholz

avcodec/g2meet: fix variable shadowing

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f87ff0db41df2dde91f51da833316cf050a73e2
---

 libavcodec/g2meet.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 7ae987ec40..f952a06f12 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -1052,7 +1052,6 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
 {
     int width, height;
     int hdr, zsize, npal, tidx = -1, ret;
-    int i, j;
     const uint8_t *src_end = src + src_size;
     uint8_t pal[768], transp[3];
     uLongf dlen = (c->tile_width + 1) * c->tile_height;
@@ -1071,11 +1070,10 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
     hdr      = *src++;
     sub_type = hdr >> 5;
     if (sub_type == 0) {
-        int j;
         memcpy(transp, src, 3);
         src += 3;
-        for (j = 0; j < height; j++, dst += c->framebuf_stride)
-            for (i = 0; i < width; i++)
+        for (int j = 0; j < height; j++, dst += c->framebuf_stride)
+            for (int i = 0; i < width; i++)
                 memcpy(dst + i * 3, transp, 3);
         return 0;
     } else if (sub_type == 1) {
@@ -1093,7 +1091,7 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
     memcpy(pal, src, npal * 3);
     src += npal * 3;
     if (sub_type != 2) {
-        for (i = 0; i < npal; i++) {
+        for (int i = 0; i < npal; i++) {
             if (!memcmp(pal + i * 3, transp, 3)) {
                 tidx = i;
                 break;
@@ -1125,8 +1123,8 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
     bstride = FFALIGN(width, 16) >> 3;
     // blocks are coded LSB and we need normal bitreader for JPEG data
     bits = 0;
-    for (i = 0; i < (FFALIGN(height, 16) >> 4); i++) {
-        for (j = 0; j < (FFALIGN(width, 16) >> 4); j++) {
+    for (int i = 0; i < (FFALIGN(height, 16) >> 4); i++) {
+        for (int j = 0; j < (FFALIGN(width, 16) >> 4); j++) {
             if (!bits) {
                 if (src >= src_end)
                     return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list