diff mbox series

[FFmpeg-devel] lavfi/signature: Fix a cast of a function pointer

Message ID CAB0OVGoY37A91ixR=LXx2A0ZUodzR_152b3i--Nseym+2_WrMQ@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] lavfi/signature: Fix a cast of a function pointer
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Carl Eugen Hoyos May 1, 2020, 9:57 p.m. UTC
Hi!

Attached patch fixes an ugly warning when compiling with -Wpedantic.
I am not in favour of adding casts to silence such warnings, but there
already is an incorrect cast.

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos May 3, 2020, 9:58 a.m. UTC | #1
Am Fr., 1. Mai 2020 um 23:57 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:

> Attached patch fixes an ugly warning when compiling with -Wpedantic.
> I am not in favour of adding casts to silence such warnings, but there
> already is an incorrect cast.

Will push if there are no comments.

Carl Eugen
diff mbox series

Patch

From ed41ff40b9e1bff357b52394dcfa1107dc4ada74 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Fri, 1 May 2020 23:54:24 +0200
Subject: [PATCH] lavfi/signature: Fix a cast of a funtion pointer.

Fixes the following pedantic warning:
libavfilter/vf_signature.c:294:69: warning: ISO C forbids conversion of function pointer to object pointer type
---
 libavfilter/vf_signature.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index d07b213f31..3524ce5d50 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -291,7 +291,7 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
         }
 
         /* get threshold */
-        qsort(sortsignature, elemcat->elem_count, sizeof(uint64_t), (void*) cmp);
+        qsort(sortsignature, elemcat->elem_count, sizeof(uint64_t), (int (*)(const void *, const void *))cmp);
         th = sortsignature[(int) (elemcat->elem_count*0.333)];
 
         /* ternarize */
@@ -317,7 +317,7 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
     }
 
     /* confidence */
-    qsort(conflist, DIFFELEM_SIZE, sizeof(uint64_t), (void*) cmp);
+    qsort(conflist, DIFFELEM_SIZE, sizeof(uint64_t), (int (*)(const void *, const void *))cmp);
     fs->confidence = FFMIN(conflist[DIFFELEM_SIZE/2], 255);
 
     /* coarsesignature */
-- 
2.24.1