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

Submitted by lance.lmwang@gmail.com on Sept. 4, 2019, 2:38 p.m.

Details

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

Commit Message

lance.lmwang@gmail.com Sept. 4, 2019, 2:38 p.m.
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

Carl Eugen Hoyos Sept. 4, 2019, 6:06 p.m.
Am Mi., 4. Sept. 2019 um 16:47 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..f3b959c 100644
> --- a/libavcodec/tscc.c
> +++ b/libavcodec/tscc.c
> @@ -64,7 +64,7 @@ typedef struct TsccContext {
>  static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
>                          AVPacket *avpkt)
>  {
> -    const uint8_t *buf = avpkt->data;
> +    uint8_t *buf = avpkt->data;

How can I reproduce the warning?

Carl Eugen
lance.lmwang@gmail.com Sept. 4, 2019, 10:39 p.m.
On Wed, Sep 04, 2019 at 08:06:39PM +0200, Carl Eugen Hoyos wrote:
> Am Mi., 4. Sept. 2019 um 16:47 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..f3b959c 100644
> > --- a/libavcodec/tscc.c
> > +++ b/libavcodec/tscc.c
> > @@ -64,7 +64,7 @@ typedef struct TsccContext {
> >  static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
> >                          AVPacket *avpkt)
> >  {
> > -    const uint8_t *buf = avpkt->data;
> > +    uint8_t *buf = avpkt->data;
> 
> How can I reproduce the warning?

 My system info:
 ➜  ~ sw_vers
 ProductName:    Mac OS X
 ProductVersion: 10.11.6
 BuildVersion:   15G22010
 ➜  ~ gcc -v
 Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
 Apple LLVM version 8.0.0 (clang-800.0.42.1)
 Target: x86_64-apple-darwin15.6.0
 Thread model: posix
 InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Maybe the change is misleading as avpkt->data is const, I'll update the patch to more clear.

> 
> 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..f3b959c 100644
--- a/libavcodec/tscc.c
+++ b/libavcodec/tscc.c
@@ -64,7 +64,7 @@  typedef struct TsccContext {
 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                         AVPacket *avpkt)
 {
-    const uint8_t *buf = avpkt->data;
+    uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     CamtasiaContext * const c = avctx->priv_data;
     AVFrame *frame = c->frame;