[FFmpeg-devel,v3] avcodec/tscc: fix for the backward compatibility to use const in the z_stream interface

Submitted by lance.lmwang@gmail.com on Sept. 11, 2019, 10:41 p.m.

Details

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

Commit Message

lance.lmwang@gmail.com Sept. 11, 2019, 10:41 p.m.
From: Limin Wang <lance.lmwang@gmail.com>

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

Comments

Carl Eugen Hoyos Sept. 12, 2019, 7:49 a.m.
> Am 12.09.2019 um 00:41 schrieb lance.lmwang@gmail.com:
> 
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavcodec/tscc.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
> index 6d03081..9eb17e3 100644
> --- a/libavcodec/tscc.c
> +++ b/libavcodec/tscc.c
> @@ -88,7 +88,11 @@ 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;
> +#if defined(z_const)
> +    c->zstream.next_in   = (z_const uint8_t*) buf;

This looks wrong.

> +#else
> +    c->zstream.next_in   = (uint8_t*) buf;
> +#endif

Since you have already shown that only a seven-year old version of zlib is necessary, I suggest to drop this patch.

Carl Eugen
lance.lmwang@gmail.com Sept. 12, 2019, 9:28 a.m.
On Thu, Sep 12, 2019 at 09:49:15AM +0200, Carl Eugen Hoyos wrote:
> 
> 
> > Am 12.09.2019 um 00:41 schrieb lance.lmwang@gmail.com:
> > 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavcodec/tscc.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
> > index 6d03081..9eb17e3 100644
> > --- a/libavcodec/tscc.c
> > +++ b/libavcodec/tscc.c
> > @@ -88,7 +88,11 @@ 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;
> > +#if defined(z_const)
> > +    c->zstream.next_in   = (z_const uint8_t*) buf;
> 
> This looks wrong.
> 
> > +#else
> > +    c->zstream.next_in   = (uint8_t*) buf;
> > +#endif
> 
> Since you have already shown that only a seven-year old version of zlib is necessary, I suggest to drop this patch.

OK, I'll try to upgrade my zlib. To keep consistent, I have submit other patches to remove the unnecessary type 
conversion in other modules, please review it.



> 
> Carl Eugen
> _______________________________________________
> 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".

Patch hide | download patch | download mbox

diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
index 6d03081..9eb17e3 100644
--- a/libavcodec/tscc.c
+++ b/libavcodec/tscc.c
@@ -88,7 +88,11 @@  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;
+#if defined(z_const)
+    c->zstream.next_in   = (z_const uint8_t*) buf;
+#else
+    c->zstream.next_in   = (uint8_t*) buf;
+#endif
     c->zstream.avail_in  = buf_size;
     c->zstream.next_out = c->decomp_buf;
     c->zstream.avail_out = c->decomp_size;