diff mbox series

[FFmpeg-devel] swresample/swresample: Remove array size hint from swr_convert()

Message ID AM7PR03MB6660FCE7AD8A9F4E3315DF9D8F679@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 77a37e0369b4b0adf06ccbda2f95828fb6afb2c3
Headers show
Series [FFmpeg-devel] swresample/swresample: Remove array size hint from swr_convert()
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 30, 2021, 11:31 a.m. UTC
SWR_CH_MAX is internal only and the arrays are therefore not required
to have that many elements (and they typically don't do it). So remove
this potentially confusing hint.

(Newer versions of GCC emit -Warray-parameter= warnings for this,
because the definition with explicit size differs from the declaration
(which leaves the size unspecified); this is IMO a false-positive,
because definition and declaration didn't conflict, but anyway it is
fixed by this commit.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libswresample/swresample.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Dec. 2, 2021, 6:40 a.m. UTC | #1
Andreas Rheinhardt:
> SWR_CH_MAX is internal only and the arrays are therefore not required
> to have that many elements (and they typically don't do it). So remove
> this potentially confusing hint.
> 
> (Newer versions of GCC emit -Warray-parameter= warnings for this,
> because the definition with explicit size differs from the declaration
> (which leaves the size unspecified); this is IMO a false-positive,
> because definition and declaration didn't conflict, but anyway it is
> fixed by this commit.)
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libswresample/swresample.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libswresample/swresample.c b/libswresample/swresample.c
> index 22c2c33673..c03fe5528f 100644
> --- a/libswresample/swresample.c
> +++ b/libswresample/swresample.c
> @@ -711,8 +711,10 @@ int swr_is_initialized(struct SwrContext *s) {
>      return !!s->in_buffer.ch_count;
>  }
>  
> -int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count,
> -                                                    const uint8_t *in_arg [SWR_CH_MAX], int  in_count){
> +int attribute_align_arg swr_convert(struct SwrContext *s,
> +                                          uint8_t **out_arg, int out_count,
> +                                    const uint8_t **in_arg,  int in_count)
> +{
>      AudioData * in= &s->in;
>      AudioData *out= &s->out;
>      int av_unused max_output;
> 

Will apply tonight unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 22c2c33673..c03fe5528f 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -711,8 +711,10 @@  int swr_is_initialized(struct SwrContext *s) {
     return !!s->in_buffer.ch_count;
 }
 
-int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count,
-                                                    const uint8_t *in_arg [SWR_CH_MAX], int  in_count){
+int attribute_align_arg swr_convert(struct SwrContext *s,
+                                          uint8_t **out_arg, int out_count,
+                                    const uint8_t **in_arg,  int in_count)
+{
     AudioData * in= &s->in;
     AudioData *out= &s->out;
     int av_unused max_output;