[PR] avutil/hwcontext_cuda: fix unused variable 'i' warning (PR #23877)

Zhao Zhili via ffmpeg-devel <[email protected]> Thu, 23 Jul 2026 04:58:06 -0000
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178478268738.59.8784860602961611926@29965ddac10e>
PR #23877 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23877
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23877.patch

The variable i is only used inside the HAVE_FFNVCODEC_CUARRAY block.

Signed-off-by: Zhao Zhili <[email protected]>

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 80eb9e99b93491753fc9d5bf1f8718c361131998 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Thu, 23 Jul 2026 11:04:10 +0800
Subject: [PATCH] avutil/hwcontext_cuda: fix unused variable 'i' warning

The variable i is only used inside the HAVE_FFNVCODEC_CUARRAY block.

Signed-off-by: Zhao Zhili <[email protected]>
---
 libavutil/hwcontext_cuda.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index b38573b04b..0ee6bb4945 100644
--- a/libavutil/hwcontext_cuda.c
+++ b/libavutil/hwcontext_cuda.c
@@ -273,7 +273,7 @@ static int cuda_frames_init(AVHWFramesContext *ctx)
     CUDAFramesContext       *priv = ctx->hwctx;
     CudaFunctions             *cu = hwctx->internal->cuda_dl;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(ctx->sw_format);
-    int err, i;
+    int err;
 
     if (!desc) {
         av_log(ctx, AV_LOG_ERROR, "Invalid pixel format\n");
@@ -352,7 +352,7 @@ static int cuda_frames_init(AVHWFramesContext *ctx)
             return err;
         }
 
-        for (i = 0; i < priv->p.cuarray_num_surfaces; i++) {
+        for (int i = 0; i < priv->p.cuarray_num_surfaces; i++) {
             err = CHECK_CU(cu->cuArray3DCreate(&priv->p.cuarray_surfaces[i], &priv->p.cuarray_desc));
             if (err < 0) {
                 for (i = i - 1; i >= 0; i--)
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]