All these casts do not avoid warnings, so there is no point in
obfuscating the code.
---
This of course exchanges of the type
warning: cast discards ‘const’ qualifier from pointer target type
for warnings of the type
warning: assignment discards ‘const’ qualifier from pointer target type
so one can discuss if it's worth the trouble, but it eliminates pretty
pointless casts.
libavcodec/aac_adtstoasc_bsf.c | 4 ++--
libavcodec/bitstream_filter.c | 2 +-
libavcodec/chomp_bsf.c | 2 +-
libavcodec/flac_parser.c | 2 +-
libavcodec/h264_mp4toannexb_bsf.c | 2 +-
libavcodec/h264_slice.c | 2 +-
libavcodec/parser.c | 5 ++---
libavcodec/pnm_parser.c | 2 +-
libavcodec/rangecoder.c | 3 +--
libavformat/mpegts.c | 2 +-
10 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
index bedaa49..759b27b 100644
--- a/libavcodec/aac_adtstoasc_bsf.c
+++ b/libavcodec/aac_adtstoasc_bsf.c
@@ -48,7 +48,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext
*bsfc,
init_get_bits(&gb, buf, AAC_ADTS_HEADER_SIZE*8);
- *poutbuf = (uint8_t*) buf;
+ *poutbuf = buf;
*poutbuf_size = buf_size;
if (avctx->extradata)
@@ -107,7 +107,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext
*bsfc,
ctx->first_frame_done = 1;
}
- *poutbuf = (uint8_t*) buf;
+ *poutbuf = buf;
*poutbuf_size = buf_size;
return 0;
diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c
index 3b19bbd..f59ec32 100644
--- a/libavcodec/bitstream_filter.c
+++ b/libavcodec/bitstream_filter.c
@@ -79,7 +79,7 @@ int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size, int keyframe)
{
- *poutbuf = (uint8_t *)buf;
+ *poutbuf = buf;
*poutbuf_size = buf_size;
return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size,
buf, buf_size, keyframe);
diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c
index 9ed7496..ac2d53d 100644
--- a/libavcodec/chomp_bsf.c
+++ b/libavcodec/chomp_bsf.c
@@ -31,7 +31,7 @@ static int chomp_filter(AVBitStreamFilterContext *bsfc,
while (buf_size > 0 && !buf[buf_size-1])
buf_size--;
- *poutbuf = (uint8_t*) buf;
+ *poutbuf = buf;
*poutbuf_size = buf_size;
return 0;
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index bf2c118..a8676df 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -575,7 +575,7 @@ static int flac_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
}
if (buf) {
- av_fifo_generic_write(fpc->fifo_buf, (void*) read_start,
+ av_fifo_generic_write(fpc->fifo_buf, read_start,
read_end - read_start, NULL);
} else {
int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 };
diff --git a/libavcodec/h264_mp4toannexb_bsf.c
b/libavcodec/h264_mp4toannexb_bsf.c
index 3b212e5..8c0444c 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -143,7 +143,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext
*bsfc,
/* nothing to filter */
if (!avctx->extradata || avctx->extradata_size < 6) {
- *poutbuf = (uint8_t *)buf;
+ *poutbuf = buf;
*poutbuf_size = buf_size;
return 0;
}
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 6f22c87..89df410 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1487,7 +1487,7 @@ int ff_h264_decode_slice_header(H264Context *h,
H264Context *h0)
if (prev) {
av_image_copy(h->short_ref[0]->f.data,
h->short_ref[0]->f.linesize,
- (const uint8_t **)prev->f.data,
+ prev->f.data,
prev->f.linesize,
h->avctx->pix_fmt,
h->mb_width * 16,
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 4404d97..23d2d4a 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -156,7 +156,7 @@ int av_parser_parse2(AVCodecParserContext *s,
AVCodecContext *avctx,
ff_fetch_timestamp(s, 0, 0);
}
/* WARNING: the returned index can be negative */
- index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
+ index = s->parser->parser_parse(s, avctx, poutbuf,
poutbuf_size, buf, buf_size);
/* update the file pointer */
if (*poutbuf_size) {
@@ -186,8 +186,7 @@ int av_parser_change(AVCodecParserContext *s,
AVCodecContext *avctx,
}
}
- /* cast to avoid warning about discarding qualifiers */
- *poutbuf = (uint8_t *) buf;
+ *poutbuf = buf;
*poutbuf_size = buf_size;
if (avctx->extradata) {
if (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)) {
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index 2e00c0a..65ac278 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -41,7 +41,7 @@ retry:
pnmctx.bytestream_end = pc->buffer + pc->index;
} else {
pnmctx.bytestream_start =
- pnmctx.bytestream = (uint8_t *) buf; /* casts avoid warnings */
+ pnmctx.bytestream = buf;
pnmctx.bytestream_end = (uint8_t *) buf + buf_size;
}
if (ff_pnm_decode_header(avctx, &pnmctx) < 0) {
diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c
index af0a8c0..15d1986 100644
--- a/libavcodec/rangecoder.c
+++ b/libavcodec/rangecoder.c
@@ -52,8 +52,7 @@ av_cold void ff_init_range_encoder(RangeCoder *c, uint8_t
*buf, int buf_size)
av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf,
int buf_size)
{
- /* cast to avoid compiler warning */
- ff_init_range_encoder(c, (uint8_t *)buf, buf_size);
+ ff_init_range_encoder(c, buf, buf_size);
c->low = bytestream_get_be16(&c->bytestream);
}
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 39eb74a..a09cafb 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1044,7 +1044,7 @@ static int init_MP4DescrParseContext(MP4DescrParseContext
*d, AVFormatContext *s
if (size > (1 << 30))
return AVERROR_INVALIDDATA;
- if ((ret = ffio_init_context(&d->pb, (unsigned char *)buf, size, 0,
+ if ((ret = ffio_init_context(&d->pb, buf, size, 0,
NULL, NULL, NULL, NULL)) < 0)
return ret;
--
2.1.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel