diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index 8130b74a7ae01264adde634abd2d09adf9b2b122..11858c7f9763a9fe787bba9a812442fbdb527460 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -383,7 +383,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=%"PTRDIFF_SPECIFIER"\n", q - outbuf); ret = q - outbuf; fail: diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c index 6ff4d9c85ff3df7a14ed62b7e552f4f5d13e84ca..37b5fa9dba859951056e7a2e25e84d9c1f48c9b8 100644 --- a/libavcodec/flac_parser.c +++ b/libavcodec/flac_parser.c @@ -612,7 +612,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 %"PTRDIFF_SPECIFIER"\n", (read_end - read_start) + av_fifo_size(fpc->fifo_buf)); goto handle_error; } diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 1234168a1fc6387e95775093ab1e1239b7c92ee3..da2d911ebc4e11e19a294a82c6bc0d6f1c200042 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -2405,10 +2405,10 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg) return 0; } if (h->cabac.bytestream > h->cabac.bytestream_end + 2 ) - av_log(h->avctx, AV_LOG_DEBUG, "bytestream overread %td\n", h->cabac.bytestream_end - h->cabac.bytestream); + av_log(h->avctx, AV_LOG_DEBUG, "bytestream overread %"PTRDIFF_SPECIFIER"\n", h->cabac.bytestream_end - h->cabac.bytestream); if (ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 4) { av_log(h->avctx, AV_LOG_ERROR, - "error while decoding MB %d %d, bytestream %td\n", + "error while decoding MB %d %d, bytestream %"PTRDIFF_SPECIFIER"\n", h->mb_x, h->mb_y, h->cabac.bytestream_end - h->cabac.bytestream); er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x, diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 5ae540e8576af8222f5ee0feca1ef09292c21648..fbfb7d1e5f07cfa27672bdf97205bda4ef235872 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -782,7 +782,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, return ret; if (ret > sizeof(cblk->data)) { avpriv_request_sample(s->avctx, - "Block with lengthinc greater than %zu", + "Block with lengthinc greater than %"SIZE_SPECIFIER"", sizeof(cblk->data)); return AVERROR_PATCHWELCOME; } diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 869c8fe1153509033cf0c3eb97a644e1a418aa5e..bc0cf96b06494bfec1a16b13b703b0957e129be6 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -158,7 +158,7 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx, width, "g_lag_in_frames:", cfg->g_lag_in_frames); av_log(avctx, level, "rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n" - " %*s%d\n %*s%p(%zu)\n %*s%u\n", + " %*s%d\n %*s%p(%"SIZE_SPECIFIER")\n %*s%u\n", width, "rc_dropframe_thresh:", cfg->rc_dropframe_thresh, width, "rc_resize_allowed:", cfg->rc_resize_allowed, width, "rc_resize_up_thresh:", cfg->rc_resize_up_thresh, @@ -373,7 +373,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, ctx->twopass_stats.buf = av_malloc(ctx->twopass_stats.sz); if (!ctx->twopass_stats.buf) { av_log(avctx, AV_LOG_ERROR, - "Stat buffer alloc (%zu bytes) failed\n", + "Stat buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", ctx->twopass_stats.sz); return AVERROR(ENOMEM); } @@ -616,7 +616,7 @@ static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out, if (!cx_frame->buf) { av_log(avctx, AV_LOG_ERROR, - "Data buffer alloc (%zu bytes) failed\n", + "Data buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", cx_frame->sz); av_free(cx_frame); return AVERROR(ENOMEM); @@ -626,7 +626,7 @@ static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out, cx_frame->buf_alpha = av_malloc(cx_frame->sz_alpha); if (!cx_frame->buf_alpha) { av_log(avctx, AV_LOG_ERROR, - "Data buffer alloc (%zu bytes) failed\n", + "Data buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", cx_frame->sz_alpha); av_free(cx_frame); return AVERROR(ENOMEM); diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index dfe75bf8ca7706c2aef3ab1184c0136be0aeee81..f2f5498f0b07790ce25bc0fbcb617c4d495239bb 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1813,7 +1813,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s, memset(s->buffer + *unescaped_buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n", + av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %"PTRDIFF_SPECIFIER" bytes\n", (buf_end - *buf_ptr) - (dst - s->buffer)); } else if (start_code == SOS && s->ls) { const uint8_t *src = *buf_ptr; @@ -1896,7 +1896,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, start_code, unescaped_buf_size, buf_size); return AVERROR_INVALIDDATA; } - 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=%"PTRDIFF_SPECIFIER"\n", start_code, buf_end - buf_ptr); ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size); @@ -2181,7 +2181,7 @@ the_end: av_dict_copy(avpriv_frame_get_metadatap(data), s->exif_metadata, 0); av_dict_free(&s->exif_metadata); - av_log(avctx, AV_LOG_DEBUG, "decode frame unused %td bytes\n", + av_log(avctx, AV_LOG_DEBUG, "decode frame unused %"PTRDIFF_SPECIFIER" bytes\n", buf_end - buf_ptr); // return buf_end - buf_ptr; return buf_ptr - buf; diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 55448418e1392798e0811a93bfd5e8fa75d47d7c..98a732f111df5468a3b24aadc013254c53bc75cf 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2391,7 +2391,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, input_size = buf_end - buf_ptr; if (avctx->debug & FF_DEBUG_STARTCODE) - av_log(avctx, AV_LOG_DEBUG, "%3"PRIX32" at %td left %d\n", + av_log(avctx, AV_LOG_DEBUG, "%3"PRIX32" at %"PTRDIFF_SPECIFIER" left %d\n", start_code, buf_ptr - buf, input_size); /* prepare data for next start code */ diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 09b48ab8a8e04729a10e70e61cf6c7a661a639c8..cd5c19e1e3fc830b235d01a493a4200fa625b32d 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1045,7 +1045,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) if (s->linesize & (STRIDE_ALIGN-1)) direct = 0; - av_dlog(s->avctx, "%d %d %td %td\n", pic_arg->linesize[0], + av_dlog(s->avctx, "%d %d %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"\n", pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize); if (direct) { diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index b1816b4eea847b4e76580511ad8d4fb82118f483..466c1a9a105687dd56d4cdc7d7e4c2cba6ba0eda 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -927,7 +927,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, samples_offset += s->frame_len; } - av_dlog(s->avctx, "%d %d %d %d outbytes:%td eaten:%d\n", + av_dlog(s->avctx, "%d %d %d %d outbytes:%"PTRDIFF_SPECIFIER" eaten:%d\n", s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len, (int8_t *)samples - (int8_t *)data, avctx->block_align); diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index 71e828771a3c5a771a7eb00718c0eb20aaa108d6..21a9e35c39c44da8d6360130e23c45edf9a98e2f 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -145,7 +145,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 %"PTRDIFF_SPECIFIER" of %i bytes\n", src-c->decomp_buf, c->decomp_len); return 0; } @@ -219,7 +219,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 %"PTRDIFF_SPECIFIER" of %i bytes\n", src-c->decomp_buf, c->decomp_len); return 0; } @@ -377,7 +377,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 %"PTRDIFF_SPECIFIER" of %i bytes\n", src-c->decomp_buf, c->decomp_len); return 0; } diff --git a/libavformat/ape.c b/libavformat/ape.c index b677ba9593ce2d71e99c639a433ae5c8543d3558..d5a786a198914b86fcbf8aebf1b650b8ead91797 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -264,7 +264,7 @@ static int ape_read_header(AVFormatContext * s) } if (ape->seektablelength / sizeof(*ape->seektable) < ape->totalframes) { av_log(s, AV_LOG_ERROR, - "Number of seek entries is less than number of frames: %zu vs. %"PRIu32"\n", + "Number of seek entries is less than number of frames: %"SIZE_SPECIFIER" vs. %"PRIu32"\n", ape->seektablelength / sizeof(*ape->seektable), ape->totalframes); return AVERROR_INVALIDDATA; } diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 4cf8e9bceaf11426f990c539c9c5248193e7af84..fb89e83944be60d9d9ceb19ef217e4109a600d8e 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -327,14 +327,14 @@ static void read_geobtag(AVFormatContext *s, AVIOContext *pb, int taglen, geob_data = av_mallocz(sizeof(ID3v2ExtraMetaGEOB)); if (!geob_data) { - av_log(s, AV_LOG_ERROR, "Failed to alloc %zu bytes\n", + av_log(s, AV_LOG_ERROR, "Failed to alloc %"SIZE_SPECIFIER" bytes\n", sizeof(ID3v2ExtraMetaGEOB)); return; } new_extra = av_mallocz(sizeof(ID3v2ExtraMeta)); if (!new_extra) { - av_log(s, AV_LOG_ERROR, "Failed to alloc %zu bytes\n", + av_log(s, AV_LOG_ERROR, "Failed to alloc %"SIZE_SPECIFIER" bytes\n", sizeof(ID3v2ExtraMeta)); goto fail; } diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c index 482ece403169773a461cf92ee757abef67654583..dac5d9f65392f0799450fd8b2cc1f1356b4fd23b 100644 --- a/libavformat/mmsh.c +++ b/libavformat/mmsh.c @@ -119,7 +119,7 @@ static int read_data_packet(MMSHContext *mmsh, const int len) int res; if (len > sizeof(mms->in_buffer)) { av_log(NULL, AV_LOG_ERROR, - "Data packet length %d exceeds the in_buffer size %zu\n", + "Data packet length %d exceeds the in_buffer size %"SIZE_SPECIFIER"\n", len, sizeof(mms->in_buffer)); return AVERROR(EIO); } @@ -194,7 +194,7 @@ static int get_http_header_data(MMSHContext *mmsh) if (len) { if (len > sizeof(mms->in_buffer)) { av_log(NULL, AV_LOG_ERROR, - "Other packet len = %d exceed the in_buffer size %zu\n", + "Other packet len = %d exceed the in_buffer size %"SIZE_SPECIFIER"\n", len, sizeof(mms->in_buffer)); return AVERROR(EIO); } diff --git a/libavformat/mmst.c b/libavformat/mmst.c index ebef3ef098cd3f4cacb6a70d5be7a0e40c0dc94d..c851187dafb644c941b6c381ae4025a9e0073670 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -284,7 +284,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 12) { av_log(NULL, AV_LOG_ERROR, - "Incoming packet length %d exceeds bufsize %zu\n", + "Incoming packet length %d exceeds bufsize %"SIZE_SPECIFIER"\n", length_remaining, sizeof(mms->in_buffer) - 12); return AVERROR_INVALIDDATA; } @@ -320,7 +320,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 8) { av_log(NULL, AV_LOG_ERROR, - "Data length %d is invalid or too large (max=%zu)\n", + "Data length %d is invalid or too large (max=%"SIZE_SPECIFIER")\n", length_remaining, sizeof(mms->in_buffer)); return AVERROR_INVALIDDATA; } diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index c0898b0abfc128b7aa43107b0871f0d885987e10..75de0bdde59682c6abc1822f219105ca41bc21bf 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -170,7 +170,7 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m, if (p != end) av_log(as, AV_LOG_INFO, - "%ti bytes of comment header remain\n", end - p); + "%"PTRDIFF_SPECIFIER" 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 887a65ed6515bda74560bf3d9947a5aa0052b4b4..43f72a2305dbe71d103d82ce2bc5ef64f83914fe 100644 --- a/libavformat/rtpdec_xiph.c +++ b/libavformat/rtpdec_xiph.c @@ -256,7 +256,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 %"PTRDIFF_SPECIFIER" byte packed header.", packed_headers_end - packed_headers); return AVERROR_INVALIDDATA; } @@ -278,7 +278,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,%"PTRDIFF_SPECIFIER",%d)\n", length1, length2, packed_headers_end - packed_headers, length); return AVERROR_INVALIDDATA; } diff --git a/libavformat/sdp.c b/libavformat/sdp.c index ae2948355de0afdca75d39508aa23ee7dcc337e9..c53de9051718ec8d42ab0635226a4aa2db083d02 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -217,7 +217,7 @@ static char *extradata2psets(AVCodecContext *c) sps_end = r1; } 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 %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n", MAX_PSET_SIZE - (p - psets), r1 - r); av_free(psets); return NULL; diff --git a/libavutil/internal.h b/libavutil/internal.h index c6c0aa8d389e58f786cec87d76a0ccba910c2e1e..e5560ca7aba211de732778cc0ee92686975a7f41 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -231,6 +231,11 @@ void avpriv_request_sample(void *avc, #if HAVE_LIBC_MSVCRT #define avpriv_open ff_open +#define PTRDIFF_SPECIFIER "Id" +#define SIZE_SPECIFIER "Iu" +#else +#define PTRDIFF_SPECIFIER "td" +#define SIZE_SPECIFIER "zu" #endif /**