[FFmpeg-devel] [PATCH] Replace all %t print prefixes with macros
jamal
jamrial at gmail.com
Tue Aug 21 08:11:36 CEST 2012
Some C libraries don't support the %t lenght specifier, resulting in print functions
outputting said string literally and ignoring the argument
---
libavcodec/dvdsubenc.c | 2 +-
libavcodec/flac_parser.c | 2 +-
libavcodec/h264.c | 4 ++--
libavcodec/mjpegdec.c | 6 +++---
libavcodec/mpeg12.c | 2 +-
libavcodec/zmbv.c | 6 +++---
libavformat/oggparsevorbis.c | 2 +-
libavformat/rtpdec_xiph.c | 4 ++--
libavformat/sdp.c | 2 +-
9 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index c87f336..66cacc6 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -372,7 +372,7 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
qq = outbuf;
bytestream_put_be16(&qq, q - outbuf);
- av_log(NULL, AV_LOG_DEBUG, "subtitle_packet size=%td\n", q - outbuf);
+ av_log(NULL, AV_LOG_DEBUG, "subtitle_packet size=%" PRIdPTR "\n", q - outbuf);
ret = q - outbuf;
fail:
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 17b96e2..d6d7622 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -564,7 +564,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
if ( av_fifo_space(fpc->fifo_buf) < read_end - read_start
&& av_fifo_realloc2(fpc->fifo_buf, (read_end - read_start) + 2*av_fifo_size(fpc->fifo_buf)) < 0) {
av_log(avctx, AV_LOG_ERROR,
- "couldn't reallocate buffer of size %td\n",
+ "couldn't reallocate buffer of size %" PRIdPTR "\n",
(read_end - read_start) + av_fifo_size(fpc->fifo_buf));
goto handle_error;
}
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index f94e1e1..81afda9 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3573,10 +3573,10 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
return 0;
}
if (h->cabac.bytestream > h->cabac.bytestream_end + 2 )
- av_log(h->s.avctx, AV_LOG_DEBUG, "bytestream overread %td\n", h->cabac.bytestream_end - h->cabac.bytestream);
+ av_log(h->s.avctx, AV_LOG_DEBUG, "bytestream overread %" PRIdPTR "\n", h->cabac.bytestream_end - h->cabac.bytestream);
if (ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 4) {
av_log(h->s.avctx, AV_LOG_ERROR,
- "error while decoding MB %d %d, bytestream (%td)\n",
+ "error while decoding MB %d %d, bytestream (%" PRIdPTR ")\n",
s->mb_x, s->mb_y,
h->cabac.bytestream_end - h->cabac.bytestream);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x,
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 5fbda48..a4f9093 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1542,7 +1542,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
*unescaped_buf_ptr = s->buffer;
*unescaped_buf_size = dst - s->buffer;
- av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
+ av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %" PRIdPTR " bytes\n",
(buf_end - *buf_ptr) - (dst - s->buffer));
} else if (start_code == SOS && s->ls) {
const uint8_t *src = *buf_ptr;
@@ -1620,7 +1620,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
start_code, unescaped_buf_size, buf_size);
return AVERROR_INVALIDDATA;
} else {
- av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
+ av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%" PRIdPTR "\n",
start_code, buf_end - buf_ptr);
init_get_bits(&s->gb, unescaped_buf_ptr, unescaped_buf_size * 8);
@@ -1791,7 +1791,7 @@ the_end:
dst -= s->linesize[s->upscale_v];
}
}
- av_log(avctx, AV_LOG_DEBUG, "decode frame unused %td bytes\n",
+ av_log(avctx, AV_LOG_DEBUG, "decode frame unused %" PRIdPTR " bytes\n",
buf_end - buf_ptr);
// return buf_end - buf_ptr;
return buf_ptr - buf;
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 1bf857e..94cd2ad 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2323,7 +2323,7 @@ static int decode_chunks(AVCodecContext *avctx,
input_size = buf_end - buf_ptr;
if (avctx->debug & FF_DEBUG_STARTCODE) {
- av_log(avctx, AV_LOG_DEBUG, "%3X at %td left %d\n", start_code, buf_ptr-buf, input_size);
+ av_log(avctx, AV_LOG_DEBUG, "%3X at %" PRIdPTR " left %d\n", start_code, buf_ptr-buf, input_size);
}
/* prepare data for next start code */
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 0a4f1cd..d2032f0 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -143,7 +143,7 @@ static int zmbv_decode_xor_8(ZmbvContext *c)
prev += c->width * c->bh;
}
if (src - c->decomp_buf != c->decomp_len)
- av_log(c->avctx, AV_LOG_ERROR, "Used %ti of %i bytes\n",
+ av_log(c->avctx, AV_LOG_ERROR, "Used %" PRIiPTR " of %i bytes\n",
src-c->decomp_buf, c->decomp_len);
return 0;
}
@@ -217,7 +217,7 @@ static int zmbv_decode_xor_16(ZmbvContext *c)
prev += c->width * c->bh;
}
if (src - c->decomp_buf != c->decomp_len)
- av_log(c->avctx, AV_LOG_ERROR, "Used %ti of %i bytes\n",
+ av_log(c->avctx, AV_LOG_ERROR, "Used %" PRIiPTR " of %i bytes\n",
src-c->decomp_buf, c->decomp_len);
return 0;
}
@@ -375,7 +375,7 @@ static int zmbv_decode_xor_32(ZmbvContext *c)
prev += c->width * c->bh;
}
if (src - c->decomp_buf != c->decomp_len)
- av_log(c->avctx, AV_LOG_ERROR, "Used %ti of %i bytes\n",
+ av_log(c->avctx, AV_LOG_ERROR, "Used %" PRIiPTR " of %i bytes\n",
src-c->decomp_buf, c->decomp_len);
return 0;
}
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 38eb4b0..540f3cd 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -136,7 +136,7 @@ ff_vorbis_comment(AVFormatContext * as, AVDictionary **m, const uint8_t *buf, in
}
if (p != end)
- av_log(as, AV_LOG_INFO, "%ti bytes of comment header remain\n", end-p);
+ av_log(as, AV_LOG_INFO, "%" PRIiPTR " bytes of comment header remain\n", end-p);
if (n > 0)
av_log(as, AV_LOG_INFO,
"truncated comment header, %i comments not found\n", n);
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index 2457f66..67d269b 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -254,7 +254,7 @@ parse_packed_headers(const uint8_t * packed_headers,
if (packed_headers_end - packed_headers < 9) {
av_log(codec, AV_LOG_ERROR,
- "Invalid %td byte packed header.",
+ "Invalid %" PRIdPTR " byte packed header.",
packed_headers_end - packed_headers);
return AVERROR_INVALIDDATA;
}
@@ -276,7 +276,7 @@ parse_packed_headers(const uint8_t * packed_headers,
if (packed_headers_end - packed_headers != length ||
length1 > length || length2 > length - length1) {
av_log(codec, AV_LOG_ERROR,
- "Bad packed header lengths (%d,%d,%td,%d)\n", length1,
+ "Bad packed header lengths (%d,%d,%" PRIdPTR ",%d)\n", length1,
length2, packed_headers_end - packed_headers, length);
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 48dfb86..cfcc635 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -211,7 +211,7 @@ static char *extradata2psets(AVCodecContext *c)
p++;
}
if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) {
- av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
+ av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %" PRIdPTR " %" PRIdPTR "!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
av_free(psets);
return NULL;
--
1.7.8.6
More information about the ffmpeg-devel
mailing list