[FFmpeg-devel] [PATCH v2] avcodec/tscc: fix the warning: assigning to 'Bytef *' (aka 'unsigned char *') from 'const uint8_t *

Limin Wang lance.lmwang at gmail.com
Thu Sep 12 01:48:01 EEST 2019


On Wed, Sep 11, 2019 at 01:42:38AM +0200, Carl Eugen Hoyos wrote:
> Am Do., 5. Sept. 2019 um 00:45 Uhr schrieb <lance.lmwang at gmail.com>:
> >
> > From: Limin Wang <lance.lmwang at gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> > ---
> >  libavcodec/tscc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
> > index 6d03081..b0dbef4 100644
> > --- a/libavcodec/tscc.c
> > +++ b/libavcodec/tscc.c
> > @@ -88,7 +88,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
> >          av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", ret);
> >          return AVERROR_UNKNOWN;
> >      }
> > -    c->zstream.next_in   = buf;
> > +    c->zstream.next_in   = (uint8_t*)buf;
> 
> Iirc, the warning also happens when compiling for android and the reason
> is that their zlib header is different / old and therefore doesn't mark the
> input as const (as the zlib header does on different systems here, both
> new and old). I therefore believe this line should not be changed.
> 
> If it is changed, the commit message should first state was is done
> ("cast a pointer to avoid a warning") and the actual complete warning
> should be part of the commit message.
> 

Thanks for the feedback, I update the patch to use z_const to keep
backward compatibility. Now the default configure will define ZLIB_CONST,
so for new version zlib, it'll use z_const, or for old system, it'll force
to avoid comiler warning.  I have tested with mac pro(old zlib) and imac(new zlib). 

reference link:
https://gitlab.kitware.com/third-party/zlib/commit/5ab9f47745fe9353291b217f705086b6070575d5


> Carl Eugen
> 
> (Checking Android sources seems to show that they have fixed
> this issue in more recent versions.)
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list