Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] Round of tiny fixes for clang warnings. (PR #21124)
@ 2025-12-08  3:07 Kacper Michajłow via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: Kacper Michajłow via ffmpeg-devel @ 2025-12-08  3:07 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Kacper Michajłow

PR #21124 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21124
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21124.patch

See: https://fate.ffmpeg.org/log.cgi?log=compile&time=20251207221916&slot=msys2-clang64


From 892c67016cff47bfd13d6da80124119f42ddf034 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 8 Dec 2025 03:36:05 +0100
Subject: [PATCH 1/7] avfilter/vf_neighbor_opencl: add error condition when
 filter name doesn't match
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This cannot really happen, but to suppress compiler warnings, we can
just return AVERROR_BUG here.

Fixes: warning: variable 'kernel_name' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavfilter/vf_neighbor_opencl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/vf_neighbor_opencl.c b/libavfilter/vf_neighbor_opencl.c
index 0b8d7fc998..eb39a5ec59 100644
--- a/libavfilter/vf_neighbor_opencl.c
+++ b/libavfilter/vf_neighbor_opencl.c
@@ -69,6 +69,9 @@ static int neighbor_opencl_init(AVFilterContext *avctx)
         kernel_name = "erosion_global";
     } else if (!strcmp(avctx->filter->name, "dilation_opencl")){
         kernel_name = "dilation_global";
+    } else {
+        err = AVERROR_BUG;
+        goto fail;
     }
     ctx->kernel = clCreateKernel(ctx->ocf.program, kernel_name, &cle);
     CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create "
-- 
2.49.1


From 31679cb6b66b7da2b421e42d9db8c2f5d40f2e03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 8 Dec 2025 03:38:56 +0100
Subject: [PATCH 2/7] avfilter/vf_libopencv: make sure there is space for
 null-terminator in shape_str
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes: warning: 'sscanf' may overflow; destination buffer in argument 7 has size 32, but the corresponding specifier may require size 33 [-Wfortify-source]
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavfilter/vf_libopencv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c
index ae8dd49b2c..8a80a7fdab 100644
--- a/libavfilter/vf_libopencv.c
+++ b/libavfilter/vf_libopencv.c
@@ -205,7 +205,7 @@ static int parse_iplconvkernel(IplConvKernel **kernel, char *buf, void *log_ctx)
     int cols = 0, rows = 0, anchor_x = 0, anchor_y = 0, shape = CV_SHAPE_RECT;
     int *values = NULL, ret = 0;
 
-    sscanf(buf, "%dx%d+%dx%d/%32[^=]=%127s", &cols, &rows, &anchor_x, &anchor_y, shape_str, shape_filename);
+    sscanf(buf, "%dx%d+%dx%d/%31[^=]=%127s", &cols, &rows, &anchor_x, &anchor_y, shape_str, shape_filename);
 
     if      (!strcmp(shape_str, "rect"   )) shape = CV_SHAPE_RECT;
     else if (!strcmp(shape_str, "cross"  )) shape = CV_SHAPE_CROSS;
-- 
2.49.1


From c1f917c6c438c2ee9e5c03a4d15777b74ea68c0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 8 Dec 2025 03:42:36 +0100
Subject: [PATCH 3/7] avcodec/libaomdec: add explicit enum cast to suppress
 compiler warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavcodec/libaomdec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index cf5986baf4..9e9c4d18c5 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -71,9 +71,9 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
         AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG
     };
     avctx->color_range = color_ranges[img->range];
-    avctx->color_primaries = img->cp;
-    avctx->colorspace  = img->mc;
-    avctx->color_trc   = img->tc;
+    avctx->color_primaries = (enum AVColorPrimaries)img->cp;
+    avctx->colorspace  = (enum AVColorSpace)img->mc;
+    avctx->color_trc   = (enum AVColorTransferCharacteristic)img->tc;
 
     switch (img->fmt) {
     case AOM_IMG_FMT_I420:
-- 
2.49.1


From 4a93058fbe25257a44739816b92aa2e4ecf4415c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 8 Dec 2025 03:48:08 +0100
Subject: [PATCH 4/7] avcodec/libsvtav1: add explicit enum cast to suppress
 compiler warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavcodec/libsvtav1.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 0e3e748b8d..7047b72422 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -241,10 +241,10 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
     }
 
     desc = av_pix_fmt_desc_get(avctx->pix_fmt);
-    param->color_primaries          = avctx->color_primaries;
-    param->matrix_coefficients      = (desc->flags & AV_PIX_FMT_FLAG_RGB) ?
-                                      AVCOL_SPC_RGB : avctx->colorspace;
-    param->transfer_characteristics = avctx->color_trc;
+    param->color_primaries          = (enum EbColorPrimaries)avctx->color_primaries;
+    param->matrix_coefficients      = (enum EbMatrixCoefficients)((desc->flags & AV_PIX_FMT_FLAG_RGB) ?
+                                      AVCOL_SPC_RGB : avctx->colorspace);
+    param->transfer_characteristics = (enum EbTransferCharacteristics)avctx->color_trc;
 
     if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
         param->color_range = avctx->color_range == AVCOL_RANGE_JPEG;
-- 
2.49.1


From 00556666cb5782011681493c157bbdcaeebed90a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 8 Dec 2025 03:53:10 +0100
Subject: [PATCH 5/7] avcodec/libx265: add explicit enum cast to suppress
 compiler warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavcodec/libx265.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 2b83a91d00..341868e7cd 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -770,7 +770,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                 sei_payload = &sei->payloads[sei->numPayloads];
                 sei_payload->payload = sei_data;
                 sei_payload->payloadSize = sei_size;
-                sei_payload->payloadType = SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35;
+                sei_payload->payloadType = (SEIPayloadType)SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35;
                 sei->numPayloads++;
             }
         }
@@ -801,7 +801,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                 }
                 sei_payload->payloadSize = side_data->size;
                 /* Equal to libx265 USER_DATA_UNREGISTERED */
-                sei_payload->payloadType = SEI_TYPE_USER_DATA_UNREGISTERED;
+                sei_payload->payloadType = (SEIPayloadType)SEI_TYPE_USER_DATA_UNREGISTERED;
                 sei->numPayloads++;
             }
         }
-- 
2.49.1


From 85530640aa733173510cd77977d4af046692e9d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 8 Dec 2025 03:57:25 +0100
Subject: [PATCH 6/7] swresample/soxr_resample: pass initialized data to
 soxr_process() in flush()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libswresample/soxr_resample.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswresample/soxr_resample.c b/libswresample/soxr_resample.c
index cc5b4db5d4..b71ece61f8 100644
--- a/libswresample/soxr_resample.c
+++ b/libswresample/soxr_resample.c
@@ -72,7 +72,7 @@ static int flush(struct SwrContext *s){
     soxr_process((soxr_t)s->resample, NULL, 0, NULL, NULL, 0, NULL);
 
     {
-        float f;
+        float f = 0;
         size_t idone, odone;
         soxr_process((soxr_t)s->resample, &f, 0, &idone, &f, 0, &odone);
         s->delayed_samples_fixup -= soxr_delay((soxr_t)s->resample);
-- 
2.49.1


From 0cf54250e6b9e4086329ca3ba0f6b2c0fa54ffc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 8 Dec 2025 04:02:19 +0100
Subject: [PATCH 7/7] avutil/hwcontext_vaapi: mark try_all with av_unused to
 suppres warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes: warning: variable 'try_all' set but not used [-Wunused-but-set-variable]
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavutil/hwcontext_vaapi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 4f3502797b..98130f9fb1 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1715,7 +1715,7 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
     VAAPIDevicePriv *priv;
     VADisplay display = NULL;
     const AVDictionaryEntry *ent;
-    int try_drm, try_x11, try_win32, try_all;
+    int try_drm, try_x11, try_win32, try_all av_unused;
 
     priv = av_mallocz(sizeof(*priv));
     if (!priv)
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-08  3:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-08  3:07 [FFmpeg-devel] [PATCH] Round of tiny fixes for clang warnings. (PR #21124) Kacper Michajłow via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git