[vlc-commits] avcodec: fix obvious variable shadowing

Rémi Denis-Courmont git at videolan.org
Sat Nov 4 17:33:08 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov  4 18:32:49 2017 +0200| [2c611eda7af4a41465dfa2c2b355d0b53e5b5260] | committer: Rémi Denis-Courmont

avcodec: fix obvious variable shadowing

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c611eda7af4a41465dfa2c2b355d0b53e5b5260
---

 modules/codec/avcodec/video.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 0e1ce088ba..4dee8dd7fd 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1494,13 +1494,12 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
     decoder_t *p_dec = p_context->opaque;
     decoder_sys_t *p_sys = p_dec->p_sys;
     video_format_t fmt;
-    size_t i;
 
     /* Enumerate available formats */
     enum PixelFormat swfmt = avcodec_default_get_format(p_context, pi_fmt);
     bool can_hwaccel = false;
 
-    for( i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++ )
+    for (size_t i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++)
     {
         const AVPixFmtDescriptor *dsc = av_pix_fmt_desc_get(pi_fmt[i]);
         if (dsc == NULL)
@@ -1513,8 +1512,10 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
             can_hwaccel = true;
     }
 #if defined(_WIN32) && LIBAVUTIL_VERSION_CHECK(54, 13, 1, 24, 100)
-    enum PixelFormat p_fmts[i+1];
-    if (i > 1 && pi_fmt[0] == AV_PIX_FMT_DXVA2_VLD && pi_fmt[1] == AV_PIX_FMT_D3D11VA_VLD)
+    size_t count;
+    for (count = 0; pi_fmt[count] != AV_PIX_FMT_NONE; count++);
+    enum PixelFormat p_fmts[count + 1];
+    if (pi_fmt[0] == AV_PIX_FMT_DXVA2_VLD && pi_fmt[1] == AV_PIX_FMT_D3D11VA_VLD)
     {
         /* favor D3D11VA over DXVA2 as the order will decide which vout will be
          * used */



More information about the vlc-commits mailing list