[FFmpeg-devel] [PATCH 1/2] pnm: fix warnings about discarding qualifiers [-Wincompatible-pointer-types]

Paul B Mahol onemda at gmail.com
Sun Mar 25 12:55:48 CEST 2012


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/pnm.h        |    4 ++--
 libavcodec/pnm_parser.c |    4 ++--
 libavcodec/pnmdec.c     |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/pnm.h b/libavcodec/pnm.h
index ac4b108..71072e7 100644
--- a/libavcodec/pnm.h
+++ b/libavcodec/pnm.h
@@ -26,8 +26,8 @@
 
 typedef struct PNMContext {
     uint8_t *bytestream;
-    uint8_t *bytestream_start;
-    uint8_t *bytestream_end;
+    const uint8_t *bytestream_start;
+    const uint8_t *bytestream_end;
     AVFrame picture;
     int maxval;                 ///< maximum value of a pixel
     int type;
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index 658469e..13d2884 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -40,9 +40,9 @@ retry:
         pnmctx.bytestream       = pc->buffer;
         pnmctx.bytestream_end   = pc->buffer + pc->index;
     } else {
-        pnmctx.bytestream_start =
+        pnmctx.bytestream_start = buf;
         pnmctx.bytestream       = (uint8_t *) buf; /* casts avoid warnings */
-        pnmctx.bytestream_end   = (uint8_t *) buf + buf_size;
+        pnmctx.bytestream_end   = buf + buf_size;
     }
     if (ff_pnm_decode_header(avctx, &pnmctx) < 0) {
         if (pnmctx.bytestream < pnmctx.bytestream_end) {
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index 0c1fad8..ce4ba52 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -36,8 +36,8 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
     unsigned char *ptr;
     int components, sample_len;
 
-    s->bytestream_start =
-    s->bytestream       = buf;
+    s->bytestream_start = buf;
+    s->bytestream       = (uint8_t *)buf;
     s->bytestream_end   = buf + buf_size;
 
     if (ff_pnm_decode_header(avctx, s) < 0)
-- 
1.7.7



More information about the ffmpeg-devel mailing list