From b0a4e5f9e765dc601a62f87cf3510ac381c3c4c6 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 31 May 2011 21:23:45 +0200 Subject: [PATCH] Employ correct printf format specifiers, mostly in debug output. --- libavfilter/vsrc_movie.c | 2 +- libavformat/ape.c | 54 ++++++++++++++++++++++------------------ libavformat/mxfdec.c | 8 +++--- libavformat/r3d.c | 13 +++++----- 4 files changed, 42 insertions(+), 35 deletions(-) diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c index 5e15524e61..a26787d561 100644 --- a/libavfilter/vsrc_movie.c +++ b/libavfilter/vsrc_movie.c @@ -152,7 +152,7 @@ static int movie_init(AVFilterContext *ctx) movie->w = movie->codec_ctx->width; movie->h = movie->codec_ctx->height; - av_log(ctx, AV_LOG_INFO, "seek_point:%lld format_name:%s file_name:%s stream_index:%d\n", + av_log(ctx, AV_LOG_INFO, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n", movie->seek_point, movie->format_name, movie->file_name, movie->stream_index); diff --git a/libavformat/ape.c b/libavformat/ape.c index 0bc7737fde..d7c1447b01 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -101,14 +101,14 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx) av_log(s, AV_LOG_DEBUG, "Descriptor Block:\n\n"); av_log(s, AV_LOG_DEBUG, "magic = \"%c%c%c%c\"\n", ape_ctx->magic[0], ape_ctx->magic[1], ape_ctx->magic[2], ape_ctx->magic[3]); - av_log(s, AV_LOG_DEBUG, "fileversion = %d\n", ape_ctx->fileversion); - av_log(s, AV_LOG_DEBUG, "descriptorlength = %d\n", ape_ctx->descriptorlength); - av_log(s, AV_LOG_DEBUG, "headerlength = %d\n", ape_ctx->headerlength); - av_log(s, AV_LOG_DEBUG, "seektablelength = %d\n", ape_ctx->seektablelength); - av_log(s, AV_LOG_DEBUG, "wavheaderlength = %d\n", ape_ctx->wavheaderlength); - av_log(s, AV_LOG_DEBUG, "audiodatalength = %d\n", ape_ctx->audiodatalength); - av_log(s, AV_LOG_DEBUG, "audiodatalength_high = %d\n", ape_ctx->audiodatalength_high); - av_log(s, AV_LOG_DEBUG, "wavtaillength = %d\n", ape_ctx->wavtaillength); + av_log(s, AV_LOG_DEBUG, "fileversion = %"PRId16"\n", ape_ctx->fileversion); + av_log(s, AV_LOG_DEBUG, "descriptorlength = %"PRIu32"\n", ape_ctx->descriptorlength); + av_log(s, AV_LOG_DEBUG, "headerlength = %"PRIu32"\n", ape_ctx->headerlength); + av_log(s, AV_LOG_DEBUG, "seektablelength = %"PRIu32"\n", ape_ctx->seektablelength); + av_log(s, AV_LOG_DEBUG, "wavheaderlength = %"PRIu32"\n", ape_ctx->wavheaderlength); + av_log(s, AV_LOG_DEBUG, "audiodatalength = %"PRIu32"\n", ape_ctx->audiodatalength); + av_log(s, AV_LOG_DEBUG, "audiodatalength_high = %"PRIu32"\n", ape_ctx->audiodatalength_high); + av_log(s, AV_LOG_DEBUG, "wavtaillength = %"PRIu32"\n", ape_ctx->wavtaillength); av_log(s, AV_LOG_DEBUG, "md5 = "); for (i = 0; i < 16; i++) av_log(s, AV_LOG_DEBUG, "%02x", ape_ctx->md5[i]); @@ -116,14 +116,14 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx) av_log(s, AV_LOG_DEBUG, "\nHeader Block:\n\n"); - av_log(s, AV_LOG_DEBUG, "compressiontype = %d\n", ape_ctx->compressiontype); - av_log(s, AV_LOG_DEBUG, "formatflags = %d\n", ape_ctx->formatflags); - av_log(s, AV_LOG_DEBUG, "blocksperframe = %d\n", ape_ctx->blocksperframe); - av_log(s, AV_LOG_DEBUG, "finalframeblocks = %d\n", ape_ctx->finalframeblocks); - av_log(s, AV_LOG_DEBUG, "totalframes = %d\n", ape_ctx->totalframes); - av_log(s, AV_LOG_DEBUG, "bps = %d\n", ape_ctx->bps); - av_log(s, AV_LOG_DEBUG, "channels = %d\n", ape_ctx->channels); - av_log(s, AV_LOG_DEBUG, "samplerate = %d\n", ape_ctx->samplerate); + av_log(s, AV_LOG_DEBUG, "compressiontype = %"PRIu16"\n", ape_ctx->compressiontype); + av_log(s, AV_LOG_DEBUG, "formatflags = %"PRIu16"\n", ape_ctx->formatflags); + av_log(s, AV_LOG_DEBUG, "blocksperframe = %"PRIu32"\n", ape_ctx->blocksperframe); + av_log(s, AV_LOG_DEBUG, "finalframeblocks = %"PRIu32"\n", ape_ctx->finalframeblocks); + av_log(s, AV_LOG_DEBUG, "totalframes = %"PRIu32"\n", ape_ctx->totalframes); + av_log(s, AV_LOG_DEBUG, "bps = %"PRIu16"\n", ape_ctx->bps); + av_log(s, AV_LOG_DEBUG, "channels = %"PRIu16"\n", ape_ctx->channels); + av_log(s, AV_LOG_DEBUG, "samplerate = %"PRIu32"\n", ape_ctx->samplerate); av_log(s, AV_LOG_DEBUG, "\nSeektable\n\n"); if ((ape_ctx->seektablelength / sizeof(uint32_t)) != ape_ctx->totalframes) { @@ -140,12 +140,14 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx) av_log(s, AV_LOG_DEBUG, "\nFrames\n\n"); for (i = 0; i < ape_ctx->totalframes; i++) - av_log(s, AV_LOG_DEBUG, "%8d %8lld %8d (%d samples)\n", i, ape_ctx->frames[i].pos, ape_ctx->frames[i].size, ape_ctx->frames[i].nblocks); + av_log(s, AV_LOG_DEBUG, "%8d %8"PRId64" %8d (%d samples)\n", i, + ape_ctx->frames[i].pos, ape_ctx->frames[i].size, + ape_ctx->frames[i].nblocks); av_log(s, AV_LOG_DEBUG, "\nCalculated information:\n\n"); - av_log(s, AV_LOG_DEBUG, "junklength = %d\n", ape_ctx->junklength); - av_log(s, AV_LOG_DEBUG, "firstframe = %d\n", ape_ctx->firstframe); - av_log(s, AV_LOG_DEBUG, "totalsamples = %d\n", ape_ctx->totalsamples); + av_log(s, AV_LOG_DEBUG, "junklength = %"PRIu32"\n", ape_ctx->junklength); + av_log(s, AV_LOG_DEBUG, "firstframe = %"PRIu32"\n", ape_ctx->firstframe); + av_log(s, AV_LOG_DEBUG, "totalsamples = %"PRIu32"\n", ape_ctx->totalsamples); #endif } @@ -169,7 +171,8 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) ape->fileversion = avio_rl16(pb); if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) { - av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10); + av_log(s, AV_LOG_ERROR, "Unsupported file version - %"PRId16".%02"PRId16"\n", + ape->fileversion / 1000, (ape->fileversion % 1000) / 10); return -1; } @@ -247,11 +250,12 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) return AVERROR(EINVAL); } if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ - av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes); + av_log(s, AV_LOG_ERROR, "Too many frames: %"PRIu32"\n", + ape->totalframes); return -1; } if (ape->seektablelength && (ape->seektablelength / sizeof(*ape->seektable)) < ape->totalframes) { - av_log(s, AV_LOG_ERROR, "Number of seek entries is less than number of frames: %d vs. %d\n", + av_log(s, AV_LOG_ERROR, "Number of seek entries is less than number of frames: %ld vs. %"PRIu32"\n", ape->seektablelength / sizeof(*ape->seektable), ape->totalframes); return AVERROR_INVALIDDATA; } @@ -301,7 +305,9 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) avio_seek(pb, 0, SEEK_SET); } - av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype); + av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %"PRIu16"\n", + ape->fileversion / 1000, (ape->fileversion % 1000) / 10, + ape->compressiontype); /* now we are ready: build format streams */ st = av_new_stream(s, 0); diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 39c7feada0..82daa2a002 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -309,7 +309,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) if (klv_read_packet(&klv, s->pb) < 0) return -1; PRINT_KEY(s, "read packet", klv.key); - av_dlog(s, "size %lld offset %#llx\n", klv.length, klv.offset); + av_dlog(s, "size %"PRIu64" offset %#"PRIx64"\n", klv.length, klv.offset); if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) { int res = mxf_decrypt_triplet(s, pkt, &klv); if (res < 0) { @@ -522,8 +522,8 @@ static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int case 0x3F06: av_dlog(NULL, "IndexSID %d\n", avio_rb32(pb)); break; case 0x3F07: av_dlog(NULL, "BodySID %d\n", avio_rb32(pb)); break; case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", avio_rb32(pb), avio_rb32(pb)); break; - case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", avio_rb64(pb)); break; - case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", avio_rb64(pb)); break; + case 0x3F0C: av_dlog(NULL, "IndexStartPosition %"PRIu64"\n", avio_rb64(pb)); break; + case 0x3F0D: av_dlog(NULL, "IndexDuration %"PRIu64"\n", avio_rb64(pb)); break; } return 0; } @@ -920,7 +920,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (klv_read_packet(&klv, s->pb) < 0) return -1; PRINT_KEY(s, "read header", klv.key); - av_dlog(s, "size %lld offset %#llx\n", klv.length, klv.offset); + av_dlog(s, "size %"PRIu64" offset %#"PRIx64"\n", klv.length, klv.offset); if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || IS_KLV_KEY(klv.key, mxf_essence_element_key)) { /* FIXME avoid seek */ diff --git a/libavformat/r3d.c b/libavformat/r3d.c index e815fda930..1b5dc1972a 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -43,7 +43,7 @@ static int read_atom(AVFormatContext *s, Atom *atom) if (atom->size < 8) return -1; atom->tag = avio_rl32(s->pb); - av_dlog(s, "atom %d %.4s offset %#llx\n", + av_dlog(s, "atom %u %.4s offset %#"PRIx64"\n", atom->size, (char*)&atom->tag, atom->offset); return atom->size; } @@ -131,7 +131,7 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom) if (st->codec->time_base.den) st->duration = (uint64_t)r3d->video_offsets_count* st->time_base.den*st->codec->time_base.num/st->codec->time_base.den; - av_dlog(s, "duration %lld\n", st->duration); + av_dlog(s, "duration %"PRId64"\n", st->duration); return 0; } @@ -176,7 +176,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) } s->data_offset = avio_tell(s->pb); - av_dlog(s, "data offset %#llx\n", s->data_offset); + av_dlog(s, "data offset %#"PRIx64"\n", s->data_offset); if (!s->pb->seekable) return 0; // find REOB/REOF/REOS to load index @@ -255,7 +255,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) if (st->codec->time_base.den) pkt->duration = (uint64_t)st->time_base.den* st->codec->time_base.num/st->codec->time_base.den; - av_dlog(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration); + av_dlog(s, "pkt dts %"PRId64" duration %d\n", pkt->dts, pkt->duration); return 0; } @@ -299,7 +299,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) pkt->stream_index = 1; pkt->dts = dts; pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate); - av_dlog(s, "pkt dts %lld duration %d samples %d sample rate %d\n", + av_dlog(s, "pkt dts %"PRId64" duration %d samples %d sample rate %d\n", pkt->dts, pkt->duration, samples, st->codec->sample_rate); return 0; @@ -356,7 +356,8 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i frame_num = sample_time*st->codec->time_base.den/ ((int64_t)st->codec->time_base.num*st->time_base.den); - av_dlog(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time); + av_dlog(s, "seek frame num %d timestamp %"PRId64"\n", + frame_num, sample_time); if (frame_num < r3d->video_offsets_count) { avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET);