[2/2] pnm: Drop inappropriate const qualifier

Message ID 1480539757-6450-2-git-send-email-diego@biurrun.de
State New
Headers show

Commit Message

Diego Biurrun Nov. 30, 2016, 9:02 p.m.
libavcodec/pnmdec.c:41:19: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
libavcodec/pnmdec.c:42:23: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
---
 libavcodec/pnmdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anton Khirnov Nov. 30, 2016, 9:09 p.m. | #1
Quoting Diego Biurrun (2016-11-30 22:02:37)
> libavcodec/pnmdec.c:41:19: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
> libavcodec/pnmdec.c:42:23: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
> ---
>  libavcodec/pnmdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
> index d23e2c0..f0c4818 100644
> --- a/libavcodec/pnmdec.c
> +++ b/libavcodec/pnmdec.c
> @@ -29,7 +29,7 @@
>  static int pnm_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;
>      PNMContext * const s = avctx->priv_data;
>      AVFrame * const p    = data;
> -- 
> 2.1.4

Again, how is it "inappropriate"? The input packet must not be modified
by the decoder, so buf being const is perfectly appropriate.

Patch

diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index d23e2c0..f0c4818 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -29,7 +29,7 @@ 
 static int pnm_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;
     PNMContext * const s = avctx->priv_data;
     AVFrame * const p    = data;