[FFmpeg-cvslog] lavf: more correct printf format specifiers

Diego Biurrun git at videolan.org
Tue Mar 11 21:12:06 CET 2014


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Mon Mar 10 15:35:59 2014 +0100| [d92024f18fa3d69937cb2575f3a8bf973df02430] | committer: Diego Biurrun

lavf: more correct printf format specifiers

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d92024f18fa3d69937cb2575f3a8bf973df02430
---

 libavformat/apetag.c         |    6 ++++--
 libavformat/asfdec.c         |    8 +++++---
 libavformat/avidec.c         |    4 ++--
 libavformat/bink.c           |   10 +++++++---
 libavformat/cafdec.c         |    5 ++++-
 libavformat/crcenc.c         |    4 +++-
 libavformat/dfa.c            |    7 +++++--
 libavformat/dxa.c            |    5 ++++-
 libavformat/electronicarts.c |    8 +++++---
 libavformat/framecrcenc.c    |    4 +++-
 libavformat/gxf.c            |    6 +++++-
 libavformat/hnm.c            |   11 +++++++----
 libavformat/iff.c            |    4 +++-
 libavformat/lxfdec.c         |    9 ++++++---
 libavformat/matroskadec.c    |    3 ++-
 libavformat/mov.c            |    7 ++++---
 libavformat/mvi.c            |    5 ++++-
 libavformat/mxfdec.c         |   13 ++++++++-----
 libavformat/omadec.c         |    8 +++++---
 libavformat/rmdec.c          |    4 +++-
 libavformat/rpl.c            |    4 ++--
 libavformat/smacker.c        |    8 ++++++--
 libavformat/smjpegdec.c      |    8 +++++---
 libavformat/spdifenc.c       |    8 +++++---
 libavformat/wtv.c            |    6 ++++--
 libavformat/xmv.c            |    6 +++---
 26 files changed, 114 insertions(+), 57 deletions(-)

diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index d4be91c..22884ef 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
 #include "avformat.h"
@@ -147,14 +149,14 @@ int64_t ff_ape_parse_tag(AVFormatContext *s)
     }
 
     if (tag_bytes > file_size - APE_TAG_FOOTER_BYTES) {
-        av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes);
+        av_log(s, AV_LOG_ERROR, "Invalid tag size %"PRIu32".\n", tag_bytes);
         return 0;
     }
     tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;
 
     fields = avio_rl32(pb);    /* number of fields */
     if (fields > 65536) {
-        av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields);
+        av_log(s, AV_LOG_ERROR, "Too many tag fields (%"PRIu32")\n", fields);
         return 0;
     }
 
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 28a403a..85e800d 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/attributes.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
@@ -921,13 +923,13 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
     // the following checks prevent overflows and infinite loops
     if (!packet_length || packet_length >= (1U << 29)) {
         av_log(s, AV_LOG_ERROR,
-               "invalid packet_length %d at:%"PRId64"\n",
+               "invalid packet_length %"PRIu32" at:%"PRId64"\n",
                packet_length, avio_tell(pb));
         return -1;
     }
     if (padsize >= packet_length) {
         av_log(s, AV_LOG_ERROR,
-               "invalid padsize %d at:%"PRId64"\n", padsize, avio_tell(pb));
+               "invalid padsize %"PRIu32" at:%"PRId64"\n", padsize, avio_tell(pb));
         return -1;
     }
 
@@ -946,7 +948,7 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
     if (rsize > packet_length - padsize) {
         asf->packet_size_left = 0;
         av_log(s, AV_LOG_ERROR,
-               "invalid packet header length %d for pktlen %d-%d at %"PRId64"\n",
+               "invalid packet header length %d for pktlen %"PRIu32"-%"PRIu32" at %"PRId64"\n",
                rsize, packet_length, padsize, avio_tell(pb));
         return -1;
     }
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 6f80d21..f48c441 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -19,7 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <stdint.h>
+#include <inttypes.h>
 
 #include "libavutil/avstring.h"
 #include "libavutil/bswap.h"
@@ -525,7 +525,7 @@ static int avi_read_header(AVFormatContext *s)
             ast->rate  = avio_rl32(pb);
             if (!(ast->scale && ast->rate)) {
                 av_log(s, AV_LOG_WARNING,
-                       "scale/rate is %u/%u which is invalid. "
+                       "scale/rate is %"PRIu32"/%"PRIu32" which is invalid. "
                        "(This file has been generated by broken software.)\n",
                        ast->scale,
                        ast->rate);
diff --git a/libavformat/bink.c b/libavformat/bink.c
index f093e7c..4d2a735 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -28,6 +28,8 @@
  *  http://wiki.multimedia.cx/index.php?title=Bink_Container
  */
 
+#include <inttypes.h>
+
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
@@ -108,7 +110,9 @@ static int read_header(AVFormatContext *s)
     fps_num = avio_rl32(pb);
     fps_den = avio_rl32(pb);
     if (fps_num == 0 || fps_den == 0) {
-        av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den);
+        av_log(s, AV_LOG_ERROR,
+               "invalid header: invalid fps (%"PRIu32"/%"PRIu32")\n",
+               fps_num, fps_den);
         return AVERROR(EIO);
     }
     avpriv_set_pts_info(vst, 64, fps_den, fps_num);
@@ -126,7 +130,7 @@ static int read_header(AVFormatContext *s)
 
     if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) {
         av_log(s, AV_LOG_ERROR,
-               "invalid header: more than "AV_STRINGIFY(BINK_MAX_AUDIO_TRACKS)" audio tracks (%d)\n",
+               "invalid header: more than "AV_STRINGIFY(BINK_MAX_AUDIO_TRACKS)" audio tracks (%"PRIu32")\n",
                bink->num_audio_tracks);
         return AVERROR(EIO);
     }
@@ -221,7 +225,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         uint32_t audio_size = avio_rl32(pb);
         if (audio_size > bink->remain_packet_size - 4) {
             av_log(s, AV_LOG_ERROR,
-                   "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n",
+                   "frame %"PRId64": audio size in header (%"PRIu32") > size of packet left (%"PRIu32")\n",
                    bink->video_pts, audio_size, bink->remain_packet_size);
             return AVERROR(EIO);
         }
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 6950eb2..7966225 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -25,6 +25,8 @@
  * Core Audio Format demuxer
  */
 
+#include <inttypes.h>
+
 #include "avformat.h"
 #include "internal.h"
 #include "isom.h"
@@ -289,7 +291,8 @@ static int read_header(AVFormatContext *s)
 
         default:
 #define _(x) ((x) >= ' ' ? (x) : ' ')
-            av_log(s, AV_LOG_WARNING, "skipping CAF chunk: %08X (%c%c%c%c)\n",
+            av_log(s, AV_LOG_WARNING,
+                   "skipping CAF chunk: %08"PRIX32" (%"PRIu8"%"PRIu8"%"PRIu8"%"PRIu8")\n",
                 tag, _(tag>>24), _((tag>>16)&0xFF), _((tag>>8)&0xFF), _(tag&0xFF));
 #undef _
         case MKBETAG('f','r','e','e'):
diff --git a/libavformat/crcenc.c b/libavformat/crcenc.c
index 3b30cc9..925646b 100644
--- a/libavformat/crcenc.c
+++ b/libavformat/crcenc.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/adler32.h"
 #include "avformat.h"
 
@@ -48,7 +50,7 @@ static int crc_write_trailer(struct AVFormatContext *s)
     CRCState *crc = s->priv_data;
     char buf[64];
 
-    snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
+    snprintf(buf, sizeof(buf), "CRC=0x%08"PRIx32"\n", crc->crcval);
     avio_write(s->pb, buf, strlen(buf));
 
     return 0;
diff --git a/libavformat/dfa.c b/libavformat/dfa.c
index fa32d1f..c097d72 100644
--- a/libavformat/dfa.c
+++ b/libavformat/dfa.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -87,12 +89,13 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
             first = 0;
         frame_size = AV_RL32(pkt->data + pkt->size - 8);
         if (frame_size > INT_MAX - 4) {
-            av_log(s, AV_LOG_ERROR, "Too large chunk size: %d\n", frame_size);
+            av_log(s, AV_LOG_ERROR, "Too large chunk size: %"PRIu32"\n", frame_size);
             return AVERROR(EIO);
         }
         if (AV_RL32(pkt->data + pkt->size - 12) == MKTAG('E', 'O', 'F', 'R')) {
             if (frame_size) {
-                av_log(s, AV_LOG_WARNING, "skipping %d bytes of end-of-frame marker chunk\n",
+                av_log(s, AV_LOG_WARNING,
+                       "skipping %"PRIu32" bytes of end-of-frame marker chunk\n",
                        frame_size);
                 avio_skip(pb, frame_size);
             }
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index a1b85fe..78e7290 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -190,7 +192,8 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
             avio_read(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
             size = AV_RB32(buf + 5);
             if(size > 0xFFFFFF){
-                av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
+                av_log(s, AV_LOG_ERROR, "Frame size is too big: %"PRIu32"\n",
+                       size);
                 return -1;
             }
             if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 9d00c2d..879ed97 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -25,6 +25,8 @@
  * by Robin Kay (komadori at gekkou.co.uk)
  */
 
+#include <inttypes.h>
+
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -151,7 +153,7 @@ static int process_audio_header_elements(AVFormatContext *s)
                     break;
                 case 0x8A:
                     av_log(s, AV_LOG_DEBUG,
-                           "element 0x%02x set to 0x%08x\n",
+                           "element 0x%02x set to 0x%08"PRIx32"\n",
                            subbyte, read_arbitrary(pb));
                     av_log(s, AV_LOG_DEBUG, "exited audio subheader\n");
                     in_subheader = 0;
@@ -170,7 +172,7 @@ static int process_audio_header_elements(AVFormatContext *s)
                     break;
                 default:
                     av_log(s, AV_LOG_DEBUG,
-                           "element 0x%02x set to 0x%08x\n",
+                           "element 0x%02x set to 0x%08"PRIx32"\n",
                            subbyte, read_arbitrary(pb));
                     break;
                 }
@@ -182,7 +184,7 @@ static int process_audio_header_elements(AVFormatContext *s)
             break;
         default:
             av_log(s, AV_LOG_DEBUG,
-                   "header element 0x%02x set to 0x%08x\n",
+                   "header element 0x%02x set to 0x%08"PRIx32"\n",
                    byte, read_arbitrary(pb));
             break;
         }
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index dd55c12..4d5483a 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/adler32.h"
 #include "avformat.h"
 #include "internal.h"
@@ -28,7 +30,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     uint32_t crc = av_adler32_update(0, pkt->data, pkt->size);
     char buf[256];
 
-    snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08x\n",
+    snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08"PRIx32"\n",
              pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc);
     avio_write(s->pb, buf, strlen(buf));
     return 0;
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 6feb3c3..1895840 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
 #include "avformat.h"
@@ -259,7 +261,9 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
         return;
     }
     if (map_cnt > 1000) {
-        av_log(s, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt);
+        av_log(s, AV_LOG_ERROR,
+               "too many index entries %"PRIu32" (%"PRIx32")\n",
+               map_cnt, map_cnt);
         map_cnt = 1000;
     }
     if (pkt_len < 4 * map_cnt) {
diff --git a/libavformat/hnm.c b/libavformat/hnm.c
index ee34a14..54ac6c2 100644
--- a/libavformat/hnm.c
+++ b/libavformat/hnm.c
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -149,8 +151,9 @@ static int hnm_read_packet(AVFormatContext *s, AVPacket *pkt)
     avio_skip(pb, 2);
 
     if (chunk_size > hnm->superchunk_remaining) {
-        av_log(s, AV_LOG_ERROR, "invalid chunk size: %u, offset: %u\n",
-               chunk_size, (int) avio_tell(pb));
+        av_log(s, AV_LOG_ERROR,
+               "invalid chunk size: %"PRIu32", offset: %"PRId64"\n",
+               chunk_size, avio_tell(pb));
         avio_skip(pb, hnm->superchunk_remaining - 8);
         hnm->superchunk_remaining = 0;
     }
@@ -172,8 +175,8 @@ static int hnm_read_packet(AVFormatContext *s, AVPacket *pkt)
         break;
 
     default:
-        av_log(s, AV_LOG_WARNING, "unknown chunk found: %d, offset: %d\n",
-               chunk_id, (int) avio_tell(pb));
+        av_log(s, AV_LOG_WARNING, "unknown chunk found: %"PRIu16", offset: %"PRId64"\n",
+               chunk_id, avio_tell(pb));
         avio_skip(pb, chunk_size - 8);
         hnm->superchunk_remaining -= chunk_size;
         break;
diff --git a/libavformat/iff.c b/libavformat/iff.c
index 79f5f16..6be0fb7 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -29,6 +29,8 @@
  * http://wiki.multimedia.cx/index.php?title=IFF
  */
 
+#include <inttypes.h>
+
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
@@ -167,7 +169,7 @@ static int iff_read_header(AVFormatContext *s)
 
         case ID_CMAP:
             if (data_size < 3 || data_size > 768 || data_size % 3) {
-                 av_log(s, AV_LOG_ERROR, "Invalid CMAP chunk size %d\n",
+                 av_log(s, AV_LOG_ERROR, "Invalid CMAP chunk size %"PRIu32"\n",
                         data_size);
                  return AVERROR_INVALIDDATA;
             }
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index 859fc71..192d4b0 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/intreadwrite.h"
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
@@ -128,12 +130,12 @@ static int get_packet_header(AVFormatContext *s)
     version     = bytestream_get_le32(&p);
     header_size = bytestream_get_le32(&p);
     if (version > 1)
-        avpriv_request_sample(s, "Unknown format version %i\n", version);
+        avpriv_request_sample(s, "Unknown format version %"PRIu32"\n", version);
 
     if (header_size < (version ? 72 : 60) ||
         header_size > LXF_MAX_PACKET_HEADER_SIZE ||
         (header_size & 3)) {
-        av_log(s, AV_LOG_ERROR, "Invalid header size 0x%x\n", header_size);
+        av_log(s, AV_LOG_ERROR, "Invalid header size 0x%"PRIx32"\n", header_size);
         return AVERROR_INVALIDDATA;
     }
 
@@ -299,7 +301,8 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
     stream = lxf->packet_type;
 
     if (stream > 1) {
-        av_log(s, AV_LOG_WARNING, "got packet with illegal stream index %u\n", stream);
+        av_log(s, AV_LOG_WARNING,
+               "got packet with illegal stream index %"PRIu32"\n", stream);
         return AVERROR(EAGAIN);
     }
 
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index ba287a6..d82d94c 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -30,6 +30,7 @@
 
 #include "config.h"
 
+#include <inttypes.h>
 #include <stdio.h>
 #if CONFIG_BZLIB
 #include <bzlib.h>
@@ -824,7 +825,7 @@ static int ebml_parse_id(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
         matroska->levels[matroska->num_levels - 1].length == 0xffffffffffffff)
         return 0;  // we reached the end of an unknown size cluster
     if (!syntax[i].id && id != EBML_ID_VOID && id != EBML_ID_CRC32) {
-        av_log(matroska->ctx, AV_LOG_INFO, "Unknown entry 0x%X\n", id);
+        av_log(matroska->ctx, AV_LOG_INFO, "Unknown entry 0x%"PRIX32"\n", id);
         if (matroska->ctx->error_recognition & AV_EF_EXPLODE)
             return AVERROR_INVALIDDATA;
     }
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6f72ce8..6375847 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -23,6 +23,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
 #include <limits.h>
 #include <stdint.h>
 
@@ -650,7 +651,7 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type);
     av_dict_set(&c->fc->metadata, "major_brand", type, 0);
     minor_ver = avio_rb32(pb); /* minor version */
-    snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver);
+    snprintf(minor_ver_str, sizeof(minor_ver_str), "%"PRIu32"", minor_ver);
     av_dict_set(&c->fc->metadata, "minor_version", minor_ver_str, 0);
 
     comp_brand_size = atom.size - 8;
@@ -1441,7 +1442,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
             avio_rb16(pb); /* reserved */
             dref_id = avio_rb16(pb);
         } else {
-            av_log(c->fc, AV_LOG_ERROR, "invalid size %d in stsd\n", size);
+            av_log(c->fc, AV_LOG_ERROR, "invalid size %"PRIu32" in stsd\n", size);
             return AVERROR_INVALIDDATA;
         }
 
@@ -1454,7 +1455,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
 
         id = mov_codec_id(st, format);
 
-        av_dlog(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,
+        av_dlog(c->fc, "size=%"PRIu32" 4CC= %"PRIu8"%"PRIu8"%"PRIu8"%"PRIu8" codec_type=%d\n", size,
                 (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
                 (format >> 24) & 0xff, st->codec->codec_type);
 
diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index 69b0aed..03a1f40 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "internal.h"
@@ -95,7 +97,8 @@ static int read_header(AVFormatContext *s)
 
     mvi->audio_frame_size   = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count;
     if (mvi->audio_frame_size <= 1 << MVI_FRAC_BITS - 1) {
-        av_log(s, AV_LOG_ERROR, "Invalid audio_data_size (%d) or frames_count (%d)\n",
+        av_log(s, AV_LOG_ERROR,
+               "Invalid audio_data_size (%"PRIu32") or frames_count (%u)\n",
                mvi->audio_data_size, frames_count);
         return AVERROR_INVALIDDATA;
     }
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index d6e2155..734c50a 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -43,7 +43,7 @@
  * Only tracks with associated descriptors will be decoded. "Highly Desirable" SMPTE 377M D.1
  */
 
-#include <stdint.h>
+#include <inttypes.h>
 
 #include "libavutil/aes.h"
 #include "libavutil/mathematics.h"
@@ -526,7 +526,7 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
             /* only nag once */
             if (!mxf->op)
                 av_log(mxf->fc, AV_LOG_WARNING,
-                       "\"OPAtom\" with %u ECs - assuming %s\n",
+                       "\"OPAtom\" with %"PRIu32" ECs - assuming %s\n",
                        nb_essence_containers,
                        op == OP1a ? "OP1a" : "OPAtom");
 
@@ -539,14 +539,15 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
     }
 
     if (partition->kag_size <= 0 || partition->kag_size > (1 << 20)) {
-        av_log(mxf->fc, AV_LOG_WARNING, "invalid KAGSize %i - guessing ", partition->kag_size);
+        av_log(mxf->fc, AV_LOG_WARNING, "invalid KAGSize %"PRId32" - guessing ",
+               partition->kag_size);
 
         if (mxf->op == OPSonyOpt)
             partition->kag_size = 512;
         else
             partition->kag_size = 1;
 
-        av_log(mxf->fc, AV_LOG_WARNING, "%i\n", partition->kag_size);
+        av_log(mxf->fc, AV_LOG_WARNING, "%"PRId32"\n", partition->kag_size);
     }
 
     return 0;
@@ -2296,7 +2297,9 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
             AVCodecContext *codec;
 
             if (index < 0) {
-                av_log(s, AV_LOG_ERROR, "error getting stream index %d\n", AV_RB32(klv.key+12));
+                av_log(s, AV_LOG_ERROR,
+                       "error getting stream index %"PRIu32"\n",
+                       AV_RB32(klv.key + 12));
                 goto skip;
             }
 
diff --git a/libavformat/omadec.c b/libavformat/omadec.c
index 6c27458..9d9c726 100644
--- a/libavformat/omadec.c
+++ b/libavformat/omadec.c
@@ -40,6 +40,8 @@
  * Supported decoders: ATRAC3, ATRAC3+, MP3, LPCM
  */
 
+#include <inttypes.h>
+
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "internal.h"
@@ -219,7 +221,7 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
 
     if (geob->datasize < 64) {
         av_log(s, AV_LOG_ERROR,
-               "Invalid GEOB data size: %u\n", geob->datasize);
+               "Invalid GEOB data size: %"PRIu32"\n", geob->datasize);
         return AVERROR_INVALIDDATA;
     }
 
@@ -243,7 +245,7 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
         return AVERROR_INVALIDDATA;
     }
     oc->rid = AV_RB32(&gdata[OMA_ENC_HEADER_SIZE + 28]);
-    av_log(s, AV_LOG_DEBUG, "RID: %.8x\n", oc->rid);
+    av_log(s, AV_LOG_DEBUG, "RID: %.8"PRIx32"\n", oc->rid);
 
     memcpy(oc->iv, &header[0x58], 8);
     hex_log(s, AV_LOG_DEBUG, "IV", oc->iv, 8);
@@ -372,7 +374,7 @@ static int oma_read_header(AVFormatContext *s)
         channel_id = (codec_params >> 10) & 7;
         if (!channel_id) {
             av_log(s, AV_LOG_ERROR,
-                   "Invalid ATRAC-X channel id: %d\n", channel_id);
+                   "Invalid ATRAC-X channel id: %"PRIu32"\n", channel_id);
             return AVERROR_INVALIDDATA;
         }
         st->codec->channel_layout = ff_oma_chid_to_native_layout[channel_id - 1];
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index d61f569..487e74f 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/internal.h"
@@ -269,7 +271,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
         case DEINT_ID_VBRF:
             break;
         default:
-            av_log(NULL,0,"Unknown interleaver %X\n", ast->deint_id);
+            av_log(NULL, 0 ,"Unknown interleaver %"PRIX32"\n", ast->deint_id);
             return AVERROR_INVALIDDATA;
         }
 
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index 0b22d8a..b72b8d0 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -19,7 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <stdint.h>
+#include <inttypes.h>
 #include <stdlib.h>
 
 #include "libavutil/avstring.h"
@@ -224,7 +224,7 @@ static int rpl_read_header(AVFormatContext *s)
         }
         if (ast->codec->codec_id == AV_CODEC_ID_NONE) {
             av_log(s, AV_LOG_WARNING,
-                   "RPL audio format %i not supported yet!\n",
+                   "RPL audio format %"PRId32" not supported yet!\n",
                    audio_format);
         }
         avpriv_set_pts_info(ast, 32, 1, ast->codec->bit_rate);
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 5af5e50..2fa531b 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -23,6 +23,8 @@
  * Based on http://wiki.multimedia.cx/index.php?title=Smacker
  */
 
+#include <inttypes.h>
+
 #include "libavutil/bswap.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
@@ -139,7 +141,7 @@ static int smacker_read_header(AVFormatContext *s)
     smk->pad = avio_rl32(pb);
     /* setup data */
     if(smk->frames > 0xFFFFFF) {
-        av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames);
+        av_log(s, AV_LOG_ERROR, "Too many frames: %"PRIu32"\n", smk->frames);
         return -1;
     }
     smk->frm_size = av_malloc(smk->frames * 4);
@@ -214,7 +216,9 @@ static int smacker_read_header(AVFormatContext *s)
                                       FF_INPUT_BUFFER_PADDING_SIZE);
     st->codec->extradata_size = smk->treesize + 16;
     if(!st->codec->extradata){
-        av_log(s, AV_LOG_ERROR, "Cannot allocate %i bytes of extradata\n", smk->treesize + 16);
+        av_log(s, AV_LOG_ERROR,
+               "Cannot allocate %"PRIu32" bytes of extradata\n",
+               smk->treesize + 16);
         av_free(smk->frm_size);
         av_free(smk->frm_flags);
         return -1;
diff --git a/libavformat/smjpegdec.c b/libavformat/smjpegdec.c
index 623df71..a9ed28e 100644
--- a/libavformat/smjpegdec.c
+++ b/libavformat/smjpegdec.c
@@ -24,6 +24,8 @@
  * This is a demuxer for Loki SDL Motion JPEG files
  */
 
+#include <inttypes.h>
+
 #include "avformat.h"
 #include "internal.h"
 #include "riff.h"
@@ -52,7 +54,7 @@ static int smjpeg_read_header(AVFormatContext *s)
     avio_skip(pb, 8); // magic
     version = avio_rb32(pb);
     if (version)
-        avpriv_request_sample(s, "Unknown version %d", version);
+        avpriv_request_sample(s, "Unknown version %"PRIu32, version);
 
     duration = avio_rb32(pb); // in msec
 
@@ -124,7 +126,7 @@ static int smjpeg_read_header(AVFormatContext *s)
         case SMJPEG_HEND:
             return 0;
         default:
-            av_log(s, AV_LOG_ERROR, "unknown header %x\n", htype);
+            av_log(s, AV_LOG_ERROR, "unknown header %"PRIx32"\n", htype);
             return AVERROR_INVALIDDATA;
         }
     }
@@ -164,7 +166,7 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
         ret = AVERROR_EOF;
         break;
     default:
-        av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", dtype);
+        av_log(s, AV_LOG_ERROR, "unknown chunk %"PRIx32"\n", dtype);
         ret = AVERROR_INVALIDDATA;
         break;
     }
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index c350f72..f3acf48 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -44,6 +44,8 @@
  *      dependent from data-type (spaces between packets are filled by zeros)
  */
 
+#include <inttypes.h>
+
 #include "avformat.h"
 #include "avio_internal.h"
 #include "spdif.h"
@@ -274,7 +276,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
         av_log(s, AV_LOG_ERROR, "stray DTS-HD frame\n");
         return AVERROR_INVALIDDATA;
     default:
-        av_log(s, AV_LOG_ERROR, "bad DTS syncword 0x%x\n", syncword_dts);
+        av_log(s, AV_LOG_ERROR, "bad DTS syncword 0x%"PRIx32"\n", syncword_dts);
         return AVERROR_INVALIDDATA;
     }
     blocks++;
@@ -369,8 +371,8 @@ static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
         ctx->data_type = IEC61937_MPEG2_AAC_LSF_4096;
         break;
     default:
-        av_log(s, AV_LOG_ERROR, "%i samples in AAC frame not supported\n",
-               hdr.samples);
+        av_log(s, AV_LOG_ERROR,
+               "%"PRIu32" samples in AAC frame not supported\n", hdr.samples);
         return AVERROR(EINVAL);
     }
     //TODO Data type dependent info (LC profile/SBR)
diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index 0c24fd7..c85f374 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -25,6 +25,8 @@
  * @author Peter Ross <pross at xvid.org>
  */
 
+#include <inttypes.h>
+
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/intfloat.h"
@@ -37,7 +39,7 @@
 
 /* Macros for formating GUIDs */
 #define PRI_PRETTY_GUID \
-    "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x"
+    "%08"PRIx32"-%04"PRIx16"-%04"PRIx16"-%02x%02x%02x%02x%02x%02x%02x%02x"
 #define ARG_PRETTY_GUID(g) \
     AV_RL32(g),AV_RL16(g+4),AV_RL16(g+6),g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]
 #define LEN_PRETTY_GUID 34
@@ -501,7 +503,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty
         return;
 
     if (type == 0 && length == 4) {
-        snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb));
+        snprintf(buf, buf_size, "%u", avio_rl32(pb));
     } else if (type == 1) {
         avio_get_str16le(pb, length, buf, buf_size);
         if (!strlen(buf)) {
diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index 2b2fd45..bcb17f8 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -25,7 +25,7 @@
  * Microsoft XMV demuxer
  */
 
-#include <stdint.h>
+#include <inttypes.h>
 
 #include "libavutil/intreadwrite.h"
 
@@ -158,7 +158,7 @@ static int xmv_read_header(AVFormatContext *s)
 
     file_version = avio_rl32(pb);
     if ((file_version != 4) && (file_version != 2))
-        avpriv_request_sample(s, "Uncommon version %d", file_version);
+        avpriv_request_sample(s, "Uncommon version %"PRIu32"", file_version);
 
 
     /* Video track */
@@ -228,7 +228,7 @@ static int xmv_read_header(AVFormatContext *s)
 
         if (!track->channels || !track->sample_rate ||
              track->channels >= UINT16_MAX / XMV_BLOCK_ALIGN_SIZE) {
-            av_log(s, AV_LOG_ERROR, "Invalid parameters for audio track %d.\n",
+            av_log(s, AV_LOG_ERROR, "Invalid parameters for audio track %"PRIu16".\n",
                    audio_track);
             ret = AVERROR_INVALIDDATA;
             goto fail;



More information about the ffmpeg-cvslog mailing list