diff mbox

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

Message ID 20190904224455.29670-1-lance.lmwang@gmail.com
State New
Headers show

Commit Message

Lance Wang Sept. 4, 2019, 10:44 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/tscc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lance Wang Sept. 10, 2019, 2:19 p.m. UTC | #1
On Thu, Sep 05, 2019 at 06:44:55AM +0800, lance.lmwang@gmail.com wrote:

ping

> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@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;
>      c->zstream.avail_in  = buf_size;
>      c->zstream.next_out = c->decomp_buf;
>      c->zstream.avail_out = c->decomp_size;
> -- 
> 2.6.4
>
Carl Eugen Hoyos Sept. 10, 2019, 11:42 p.m. UTC | #2
Am Do., 5. Sept. 2019 um 00:45 Uhr schrieb <lance.lmwang@gmail.com>:
>
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@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.

Carl Eugen

(Checking Android sources seems to show that they have fixed
this issue in more recent versions.)
Lance Wang Sept. 11, 2019, 10:48 p.m. UTC | #3
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@gmail.com>:
> >
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@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@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

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;
     c->zstream.avail_in  = buf_size;
     c->zstream.next_out = c->decomp_buf;
     c->zstream.avail_out = c->decomp_size;