changeset 881:91dcb9da9be6 libavformat

use PRIxN, %zd, %td formats where needed
author mru
date Mon, 12 Dec 2005 01:56:46 +0000
parents 21a5cb38dd5e
children 7a7a6eda769d
files asf.c crc.c matroska.c mov.c nsvdec.c nut.c sierravmd.c utils.c
diffstat 8 files changed, 36 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/asf.c	Sat Dec 10 17:14:24 2005 +0000
+++ b/asf.c	Mon Dec 12 01:56:46 2005 +0000
@@ -430,7 +430,7 @@
     c = get_byte(pb);
     if (c != 0x82) {
         if (!url_feof(pb))
-	    av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%lld\n", c, url_ftell(pb));
+	    av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%"PRId64"\n", c, url_ftell(pb));
     }
     if ((c & 0x0f) == 2) { // always true for now
 	if (get_le16(pb) != 0) {
--- a/crc.c	Sat Dec 10 17:14:24 2005 +0000
+++ b/crc.c	Mon Dec 12 01:56:46 2005 +0000
@@ -94,7 +94,7 @@
     uint32_t crc = update_adler32(0, pkt->data, pkt->size);
     char buf[256];
 
-    snprintf(buf, sizeof(buf), "%d, %Ld, %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
+    snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
     put_buffer(&s->pb, buf, strlen(buf));
     put_flush_packet(&s->pb);
     return 0;
--- a/matroska.c	Sat Dec 10 17:14:24 2005 +0000
+++ b/matroska.c	Mon Dec 12 01:56:46 2005 +0000
@@ -379,7 +379,7 @@
         if (!url_feof(pb)) {
             offset_t pos = url_ftell(pb);
             av_log(matroska->ctx, AV_LOG_ERROR,
-                   "Read error at pos. %llu (0x%llx)\n",
+                   "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
                    pos, pos);
         }
         return AVERROR_IO; /* EOS or actual I/O error */
@@ -393,7 +393,7 @@
     if (read > max_size) {
         offset_t pos = url_ftell(pb) - 1;
         av_log(matroska->ctx, AV_LOG_ERROR,
-               "Invalid EBML number size tag 0x%02x at pos %llu (0x%llx)\n",
+               "Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n",
                (uint8_t) total, pos, pos);
         return AVERROR_INVALIDDATA;
     }
@@ -537,7 +537,7 @@
     if (size < 1 || size > 8) {
         offset_t pos = url_ftell(pb);
         av_log(matroska->ctx, AV_LOG_ERROR,
-               "Invalid uint element size %d at position %lld (0x%llx)\n",
+               "Invalid uint element size %d at position %"PRId64" (0x%"PRIx64")\n",
                 size, pos, pos);
         return AVERROR_INVALIDDATA;
     }
@@ -571,7 +571,7 @@
     if (size < 1 || size > 8) {
         offset_t pos = url_ftell(pb);
         av_log(matroska->ctx, AV_LOG_ERROR,
-               "Invalid sint element size %d at position %lld (0x%llx)\n",
+               "Invalid sint element size %d at position %"PRId64" (0x%"PRIx64")\n",
                 size, pos, pos);
         return AVERROR_INVALIDDATA;
     }
@@ -620,7 +620,7 @@
     } else{
         offset_t pos = url_ftell(pb);
         av_log(matroska->ctx, AV_LOG_ERROR,
-               "Invalid float element size %d at position %llu (0x%llx)\n",
+               "Invalid float element size %d at position %"PRIu64" (0x%"PRIx64")\n",
                size, pos, pos);
         return AVERROR_INVALIDDATA;
     }
@@ -656,7 +656,7 @@
     if (get_buffer(pb, (uint8_t *) *str, size) != size) {
         offset_t pos = url_ftell(pb);
         av_log(matroska->ctx, AV_LOG_ERROR,
-               "Read error at pos. %llu (0x%llx)\n", pos, pos);
+               "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos);
         return AVERROR_IO;
     }
     (*str)[size] = '\0';
@@ -753,7 +753,7 @@
     if (get_buffer(pb, *binary, *size) != *size) {
         offset_t pos = url_ftell(pb);
         av_log(matroska->ctx, AV_LOG_ERROR,
-               "Read error at pos. %llu (0x%llx)\n", pos, pos);
+               "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos);
         return AVERROR_IO;
     }
 
@@ -877,7 +877,7 @@
                     return res;
                 if (num > EBML_VERSION) {
                     av_log(matroska->ctx, AV_LOG_ERROR,
-                           "EBML version %llu (> %d) is not supported\n",
+                           "EBML version %"PRIu64" (> %d) is not supported\n",
                            num, EBML_VERSION);
                     return AVERROR_INVALIDDATA;
                 }
@@ -892,7 +892,7 @@
                     return res;
                 if (num > sizeof(uint64_t)) {
                     av_log(matroska->ctx, AV_LOG_ERROR,
-                           "Integers of size %llu (> %d) not supported\n",
+                           "Integers of size %"PRIu64" (> %zd) not supported\n",
                            num, sizeof(uint64_t));
                     return AVERROR_INVALIDDATA;
                 }
@@ -907,7 +907,7 @@
                     return res;
                 if (num > sizeof(uint32_t)) {
                     av_log(matroska->ctx, AV_LOG_ERROR,
-                           "IDs of size %llu (> %u) not supported\n",
+                           "IDs of size %"PRIu64" (> %zu) not supported\n",
 			    num, sizeof(uint32_t));
                     return AVERROR_INVALIDDATA;
                 }
@@ -1870,7 +1870,7 @@
 
                 if (!seek_id || seek_pos == (uint64_t) -1) {
                     av_log(matroska->ctx, AV_LOG_INFO,
-                           "Incomplete seekhead entry (0x%x/%llu)\n",
+                           "Incomplete seekhead entry (0x%x/%"PRIu64")\n",
                            seek_id, seek_pos);
                     break;
                 }
@@ -1913,7 +1913,7 @@
                         if (id != seek_id) {
                             av_log(matroska->ctx, AV_LOG_INFO,
                                    "We looked for ID=0x%x but got "
-                                   "ID=0x%x (pos=%llu)",
+                                   "ID=0x%x (pos=%"PRIu64")",
                                    seek_id, id, seek_pos +
                                    matroska->segment_start);
                             goto finish;
@@ -2543,7 +2543,7 @@
     uint64_t cluster_time = 0;
 
     av_log(matroska->ctx, AV_LOG_DEBUG,
-           "parsing cluster at %lld\n", url_ftell(&matroska->ctx->pb));
+           "parsing cluster at %"PRId64"\n", url_ftell(&matroska->ctx->pb));
 
     while (res == 0) {
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
--- a/mov.c	Sat Dec 10 17:14:24 2005 +0000
+++ b/mov.c	Mon Dec 12 01:56:46 2005 +0000
@@ -1749,7 +1749,7 @@
     /* check MOV header */
     err = mov_read_default(mov, pb, atom);
     if (err<0 || (!mov->found_moov && !mov->found_mdat)) {
-	av_log(s, AV_LOG_ERROR, "mov: header not found !!! (err:%d, moov:%d, mdat:%d) pos:%lld\n",
+	av_log(s, AV_LOG_ERROR, "mov: header not found !!! (err:%d, moov:%d, mdat:%d) pos:%"PRId64"\n",
 		err, mov->found_moov, mov->found_mdat, url_ftell(pb));
 	return -1;
     }
--- a/nsvdec.c	Sat Dec 10 17:14:24 2005 +0000
+++ b/nsvdec.c	Mon Dec 12 01:56:46 2005 +0000
@@ -236,7 +236,7 @@
     uint32_t v = 0;
     int i;
     
-    PRINT(("%s(), offset = %Ld, state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state));
+    PRINT(("%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state));
     
     //nsv->state = NSV_UNSYNC;
     
@@ -301,7 +301,7 @@
     PRINT(("NSV NSVf file_size %u\n", file_size));
 
     nsv->duration = duration = get_le32(pb); /* in ms */
-    PRINT(("NSV NSVf duration %Ld ms\n", duration));
+    PRINT(("NSV NSVf duration %"PRId64" ms\n", duration));
     // XXX: store it in AVStreams
 
     strings_size = get_le32(pb);
@@ -312,7 +312,7 @@
     if (url_feof(pb))
         return -1;
     
-    PRINT(("NSV got header; filepos %Ld\n", url_ftell(pb)));
+    PRINT(("NSV got header; filepos %"PRId64"\n", url_ftell(pb)));
 
     if (strings_size > 0) {
         char *strings; /* last byte will be '\0' to play safe with str*() */
@@ -355,17 +355,18 @@
     if (url_feof(pb))
         return -1;
     
-    PRINT(("NSV got infos; filepos %Ld\n", url_ftell(pb)));
+    PRINT(("NSV got infos; filepos %"PRId64"\n", url_ftell(pb)));
 
     if (table_entries_used > 0) {
         nsv->index_entries = table_entries_used;
         if((unsigned)table_entries >= UINT_MAX / sizeof(uint32_t))
             return -1;
         nsv->nsvf_index_data = av_malloc(table_entries * sizeof(uint32_t));
-        get_buffer(pb, nsv->nsvf_index_data, table_entries * sizeof(uint32_t));
+#warning "FIXME: Byteswap buffer as needed"
+        get_buffer(pb, (unsigned char *)nsv->nsvf_index_data, table_entries * sizeof(uint32_t));
     }
 
-    PRINT(("NSV got index; filepos %Ld\n", url_ftell(pb)));
+    PRINT(("NSV got index; filepos %"PRId64"\n", url_ftell(pb)));
     
 #ifdef DEBUG_DUMP_INDEX
 #define V(v) ((v<0x20 || v > 127)?'.':v)
--- a/nut.c	Sat Dec 10 17:14:24 2005 +0000
+++ b/nut.c	Mon Dec 12 01:56:46 2005 +0000
@@ -868,7 +868,7 @@
 
     tmp = get_v(bc);
     if (tmp != 2){
-	av_log(s, AV_LOG_ERROR, "bad version (%Ld)\n", tmp);
+	av_log(s, AV_LOG_ERROR, "bad version (%"PRId64")\n", tmp);
         return -1;
     }
     
@@ -1034,7 +1034,7 @@
         if(!id)
             break;
         else if(id >= sizeof(info_table)/sizeof(info_table[0])){
-            av_log(s, AV_LOG_ERROR, "info id is too large %d %d\n", id, sizeof(info_table)/sizeof(info_table[0]));
+            av_log(s, AV_LOG_ERROR, "info id is too large %d %zd\n", id, sizeof(info_table)/sizeof(info_table[0]));
             return -1;
         }
 
@@ -1297,7 +1297,7 @@
                 break;
         default:
 resync:
-av_log(s, AV_LOG_DEBUG, "syncing from %lld\n", nut->packet_start[2]+1);
+av_log(s, AV_LOG_DEBUG, "syncing from %"PRId64"\n", nut->packet_start[2]+1);
             tmp= find_any_startcode(bc, nut->packet_start[2]+1);
             if(tmp==0)
                 return -1;
@@ -1314,7 +1314,7 @@
     int64_t pos, pts;
     uint64_t code;
     int frame_code,step, stream_id, i,size, key_frame;
-av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%lld,%lld)\n", stream_index, *pos_arg, pos_limit);
+av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit);
 
     if(*pos_arg < 0)
         return AV_NOPTS_VALUE;
@@ -1381,7 +1381,7 @@
             return pts;
         default:
 resync:
-av_log(s, AV_LOG_DEBUG, "syncing from %lld\n", nut->packet_start[2]+1);
+av_log(s, AV_LOG_DEBUG, "syncing from %"PRId64"\n", nut->packet_start[2]+1);
             if(!find_any_startcode(bc, nut->packet_start[2]+1))
                 return AV_NOPTS_VALUE;
 
--- a/sierravmd.c	Sat Dec 10 17:14:24 2005 +0000
+++ b/sierravmd.c	Mon Dec 12 01:56:46 2005 +0000
@@ -290,7 +290,7 @@
             pkt->data, pkt->size, vmd->audio_block_align);
 
     }
-av_log(NULL, AV_LOG_INFO, " dispatching %s frame with %d bytes and pts %lld (%0.1f sec)\n",
+av_log(NULL, AV_LOG_INFO, " dispatching %s frame with %d bytes and pts %"PRId64" (%0.1f sec)\n",
   (frame->frame_record[0] == 0x02) ? "video" : "audio",
   frame->frame_size + BYTES_PER_FRAME_RECORD,
   pkt->pts, (float)(pkt->pts / 90000.0));
--- a/utils.c	Sat Dec 10 17:14:24 2005 +0000
+++ b/utils.c	Mon Dec 12 01:56:46 2005 +0000
@@ -1274,7 +1274,7 @@
         return -1;
     
 #ifdef DEBUG_SEEK
-    av_log(s, AV_LOG_DEBUG, "read_seek: %d %lld\n", stream_index, target_ts);
+    av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
 #endif
 
     ts_max=
@@ -1293,7 +1293,7 @@
             pos_min= e->pos;
             ts_min= e->timestamp;
 #ifdef DEBUG_SEEK
-        av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%llx dts_min=%lld\n", 
+        av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n", 
                pos_min,ts_min);
 #endif
         }else{
@@ -1309,7 +1309,7 @@
             ts_max= e->timestamp;
             pos_limit= pos_max - e->min_distance;
 #ifdef DEBUG_SEEK
-        av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%llx pos_limit=0x%llx dts_max=%lld\n", 
+        av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n", 
                pos_max,pos_limit, ts_max);
 #endif
         }
@@ -1350,7 +1350,7 @@
     no_change=0;
     while (pos_min < pos_limit) {
 #ifdef DEBUG_SEEK
-        av_log(s, AV_LOG_DEBUG, "pos_min=0x%llx pos_max=0x%llx dts_min=%lld dts_max=%lld\n", 
+        av_log(s, AV_LOG_DEBUG, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n", 
                pos_min, pos_max,
                ts_min, ts_max);
 #endif
@@ -1380,7 +1380,7 @@
         else
             no_change=0;
 #ifdef DEBUG_SEEK
-av_log(s, AV_LOG_DEBUG, "%Ld %Ld %Ld / %Ld %Ld %Ld target:%Ld limit:%Ld start:%Ld noc:%d\n", pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit, start_pos, no_change);
+av_log(s, AV_LOG_DEBUG, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n", pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit, start_pos, no_change);
 #endif
         assert(ts != AV_NOPTS_VALUE);
         if (target_ts <= ts) {
@@ -1401,7 +1401,7 @@
     ts_min = avif->read_timestamp(s, stream_index, &pos_min, INT64_MAX);
     pos_min++;
     ts_max = avif->read_timestamp(s, stream_index, &pos_min, INT64_MAX);
-    av_log(s, AV_LOG_DEBUG, "pos=0x%llx %lld<=%lld<=%lld\n", 
+    av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n", 
            pos, ts_min, target_ts, ts_max);
 #endif
     /* do the seek */
@@ -2324,7 +2324,7 @@
     }
     
     if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){
-        av_log(NULL, AV_LOG_ERROR, "error, non monotone timestamps %Ld >= %Ld\n", st->cur_dts, pkt->dts);
+        av_log(NULL, AV_LOG_ERROR, "error, non monotone timestamps %"PRId64" >= %"PRId64"\n", st->cur_dts, pkt->dts);
         return -1;
     }
     if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){