History

avfilter/blend_modes: Always preserve constness

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.

Andreas Rheinhardt committed 3 years ago

Commit 44dcc4d1 parent 29c6f433 files · +6 −6Browse files

Showing the changes to libavfilter (3 of 3 files). Show all

Unified · Split

3 files
  1. libavfilter/blend_modes.c +2 −2
  2. libavfilter/vf_blend.c +2 −2
  3. libavfilter/vf_blend_init.h +2 −2
libavfilter/blend_modes.c+2−2
@@ -93,8 +93,8 @@ static void fn0(NAME)(const uint8_t *_top, ptrdiff_t top_linesize, \ · 92 unmodified lines
9393 ptrdiff_t width, ptrdiff_t height, \
9494 FilterParams *param, double *values, int starty) \
9595 { \
96− const PIXEL *top = (PIXEL *)_top; \
97− const PIXEL *bottom = (PIXEL *)_bottom; \
96+ const PIXEL *top = (const PIXEL *)_top; \
97+ const PIXEL *bottom = (const PIXEL *)_bottom; \
9898 PIXEL *dst = (PIXEL *)_dst; \
9999 const float opacity = param->opacity; \
100100 \
libavfilter/vf_blend.c+2−2
@@ -133,8 +133,8 @@ static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize, · 132 unmodified lines
133133 ptrdiff_t width, ptrdiff_t height, \
134134 FilterParams *param, double *values, int starty) \
135135 { \
136− const type *top = (type*)_top; \
137− const type *bottom = (type*)_bottom; \
136+ const type *top = (const type*)_top; \
137+ const type *bottom = (const type*)_bottom; \
138138 type *dst = (type*)_dst; \
139139 AVExpr *e = param->e; \
140140 int y, x; \
libavfilter/vf_blend_init.h+2−2
@@ -82,8 +82,8 @@ static void blend_normal_##name(const uint8_t *_top, ptrdiff_t top_linesize, · 81 unmodified lines
8282 ptrdiff_t width, ptrdiff_t height, \
8383 FilterParams *param, double *values, int starty) \
8484 { \
85− const type *top = (type*)_top; \
86− const type *bottom = (type*)_bottom; \
85+ const type *top = (const type*)_top; \
86+ const type *bottom = (const type*)_bottom; \
8787 type *dst = (type*)_dst; \
8888 const float opacity = param->opacity; \
8989 \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t