diff mbox series

[FFmpeg-devel,31/31] avfilter/blend_modes: Always preserve constness

Message ID AS8P250MB074445E7983249CCE510019B8FEEA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 44dcc4d6060c6dfffb60777396ee8ed8bd1fed76
Headers show
Series [FFmpeg-devel,v2,01/22] fate/demux, lavf-container: Workaround for AV1-aspect ratio issue | expand

Commit Message

Andreas Rheinhardt Sept. 7, 2023, 2:03 p.m. UTC
These casts cast const away temporarily; they are safe, because
the pointers that are initialized point to const data. But this
is nevertheless not nice and leads to warnings when using
-Wcast-qual. blend_modes.c generates 546 (2*39*7) such warnings
which is the majority of such warnings for FFmpeg as a whole.
vf_blend.c and vf_blend_init.h also use this pattern;
they have also been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/blend_modes.c   | 4 ++--
 libavfilter/vf_blend.c      | 4 ++--
 libavfilter/vf_blend_init.h | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

Paul B Mahol Sept. 7, 2023, 2:32 p.m. UTC | #1
OK
diff mbox series

Patch

diff --git a/libavfilter/blend_modes.c b/libavfilter/blend_modes.c
index e2be676243..65c5e6f890 100644
--- a/libavfilter/blend_modes.c
+++ b/libavfilter/blend_modes.c
@@ -93,8 +93,8 @@  static void fn0(NAME)(const uint8_t *_top, ptrdiff_t top_linesize, \
      ptrdiff_t width, ptrdiff_t height,                       \
      FilterParams *param, double *values, int starty)         \
 {                                                                                   \
-    const PIXEL *top = (PIXEL *)_top;                                               \
-    const PIXEL *bottom = (PIXEL *)_bottom;                                         \
+    const PIXEL *top = (const PIXEL *)_top;                                         \
+    const PIXEL *bottom = (const PIXEL *)_bottom;                                   \
     PIXEL *dst = (PIXEL *)_dst;                                                     \
     const float opacity = param->opacity;                                           \
                                                                                     \
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index dfe2b8b174..7100d9f372 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -133,8 +133,8 @@  static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize,
                                ptrdiff_t width, ptrdiff_t height,              \
                                FilterParams *param, double *values, int starty) \
 {                                                                              \
-    const type *top = (type*)_top;                                             \
-    const type *bottom = (type*)_bottom;                                       \
+    const type *top = (const type*)_top;                                       \
+    const type *bottom = (const type*)_bottom;                                 \
     type *dst = (type*)_dst;                                                   \
     AVExpr *e = param->e;                                                      \
     int y, x;                                                                  \
diff --git a/libavfilter/vf_blend_init.h b/libavfilter/vf_blend_init.h
index f531338a54..d24f178032 100644
--- a/libavfilter/vf_blend_init.h
+++ b/libavfilter/vf_blend_init.h
@@ -82,8 +82,8 @@  static void blend_normal_##name(const uint8_t *_top, ptrdiff_t top_linesize,
                                 ptrdiff_t width, ptrdiff_t height,                \
                                 FilterParams *param, double *values, int starty)  \
 {                                                                                 \
-    const type *top = (type*)_top;                                                \
-    const type *bottom = (type*)_bottom;                                          \
+    const type *top = (const type*)_top;                                          \
+    const type *bottom = (const type*)_bottom;                                    \
     type *dst = (type*)_dst;                                                      \
     const float opacity = param->opacity;                                         \
                                                                                   \