Quoting Diego Biurrun (2016-11-30 22:02:36)
> libavcodec/rangecoder.c:57:30: warning: cast discards ‘const’ qualifier from 
> pointer target type [-Wcast-qual]
> ---
>  libavcodec/rangecoder.c | 6 ++----
>  libavcodec/rangecoder.h | 2 +-
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c
> index 4c4731d..3ef4b31 100644
> --- a/libavcodec/rangecoder.c
> +++ b/libavcodec/rangecoder.c
> @@ -49,11 +49,9 @@ av_cold void ff_init_range_encoder(RangeCoder *c, uint8_t 
> *buf, int buf_size)
>      c->outstanding_byte  = -1;
>  }
>  
> -av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf,
> -                                   int buf_size)
> +av_cold void ff_init_range_decoder(RangeCoder *c, uint8_t *buf, int buf_size)
>  {
> -    /* cast to avoid compiler warning */
> -    ff_init_range_encoder(c, (uint8_t *)buf, buf_size);
> +    ff_init_range_encoder(c, buf, buf_size);
>  
>      c->low         = AV_RB16(c->bytestream);
>      c->bytestream += 2;
> diff --git a/libavcodec/rangecoder.h b/libavcodec/rangecoder.h
> index 2ead446..c07a99b 100644
> --- a/libavcodec/rangecoder.h
> +++ b/libavcodec/rangecoder.h
> @@ -45,7 +45,7 @@ typedef struct RangeCoder {
>  } RangeCoder;
>  
>  void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size);
> -void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size);
> +void ff_init_range_decoder(RangeCoder *c, uint8_t *buf, int buf_size);
>  int ff_rac_terminate(RangeCoder *c);
>  void ff_build_rac_states(RangeCoder *c, int factor, int max_p);
>  
> -- 
> 2.1.4

Why is it incorrect? Does the range decoder modify the input buffer?

And I asked you multiple times already to stop just citing warnings as
justifications for such patches. A warning may or may not be a symptom
of a problem in the code. What you should be fixed is that underlying
problem, not the warning itself. And the commit message should properly
explain what the problem was and why the commit is the right way to
solve it.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to