[FFmpeg-devel] [PATCH]Remove some long long occurences in the libraries

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Jun 4 14:58:39 CEST 2015


Hi!

As requested by the developer documentation, fixes some wrong 
format specifiers and removes a few ugly casts.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c
index 7277345..2931fa3 100644
--- a/libavcodec/cinepakenc.c
+++ b/libavcodec/cinepakenc.c
@@ -327,7 +327,7 @@ static int64_t calculate_mode_score(CinepakEncContext *s, int h, strip_info *inf
                    (info->v4_size ? CHUNK_HEADER_SIZE + info->v4_size * entry_size : 0) +
                    CHUNK_HEADER_SIZE) << 3;
 
-    //av_log(s->avctx, AV_LOG_INFO, "sizes %3i %3i -> %9lli score mb_count %i", info->v1_size, info->v4_size, (long long int)ret, mb_count);
+    //av_log(s->avctx, AV_LOG_INFO, "sizes %3i %3i -> %9"PRId64" score mb_count %i", info->v1_size, info->v4_size, ret, mb_count);
 
 #ifdef CINEPAK_REPORT_SERR
     *serr = 0;
@@ -897,7 +897,7 @@ static int quantize(CinepakEncContext *s, int h, AVPicture *pict,
 // check that we did it right in the beginning of the function
     av_assert0(i >= size); // training set is no smaller than the codebook
 
-    //av_log(s->avctx, AV_LOG_INFO, "isv1 %i size= %i i= %i error %lli\n", v1mode, size, i, (long long int)total_error);
+    //av_log(s->avctx, AV_LOG_INFO, "isv1 %i size= %i i= %i error %"PRId64"\n", v1mode, size, i, total_error);
 
     return size;
 }
@@ -1050,7 +1050,7 @@ static int rd_strip(CinepakEncContext *s, int y, int h, int keyframe, AVPicture
                     }
                 }
 
-                //av_log(s->avctx, AV_LOG_INFO, "%3i %3i score = %lli\n", v1_size, v4_size, (long long int)score);
+                //av_log(s->avctx, AV_LOG_INFO, "%3i %3i score = %"PRId64"\n", v1_size, v4_size, score);
 
                 if(best_size == 0 || score < *best_score) {
 
@@ -1060,10 +1060,10 @@ static int rd_strip(CinepakEncContext *s, int y, int h, int keyframe, AVPicture
 #endif
                     best_size = encode_mode(s, h, scratch_pict, last_pict, &info, s->strip_buf + STRIP_HEADER_SIZE);
 
-                    //av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i, %3i: %18lli %i B", mode, info.v1_size, info.v4_size, (long long int)score, best_size);
+                    //av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i, %3i: %18"PRId64" %i B", mode, info.v1_size, info.v4_size, score, best_size);
                     //av_log(s->avctx, AV_LOG_INFO, "\n");
 #ifdef CINEPAK_REPORT_SERR
-                    av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i, %3i: %18lli %i B\n", mode, v1_size, v4_size, (long long int)serr, best_size);
+                    av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i, %3i: %18"PRId64" %i B\n", mode, v1_size, v4_size, serr, best_size);
 #endif
 
 #ifdef CINEPAKENC_DEBUG
@@ -1224,9 +1224,9 @@ static int rd_frame(CinepakEncContext *s, const AVFrame *frame, int isakeyframe,
             best_serr = serr;
 #endif
             best_size = size + write_cvid_header(s, s->frame_buf, num_strips, size, isakeyframe);
-            //av_log(s->avctx, AV_LOG_INFO, "best number of strips so far: %2i, %12lli, %i B\n", num_strips, (long long int)score, best_size);
+            //av_log(s->avctx, AV_LOG_INFO, "best number of strips so far: %2i, %12"PRId64", %i B\n", num_strips, score, best_size);
 #ifdef CINEPAK_REPORT_SERR
-            av_log(s->avctx, AV_LOG_INFO, "best number of strips so far: %2i, %12lli, %i B\n", num_strips, (long long int)serr, best_size);
+            av_log(s->avctx, AV_LOG_INFO, "best number of strips so far: %2i, %12"PRId64", %i B\n", num_strips, serr, best_size);
 #endif
 
             FFSWAP(AVFrame *, s->best_frame, s->scratch_frame);
diff --git a/libavdevice/iec61883.c b/libavdevice/iec61883.c
index b29aad1..152a9f7 100644
--- a/libavdevice/iec61883.c
+++ b/libavdevice/iec61883.c
@@ -271,7 +271,7 @@ static int iec61883_read_header(AVFormatContext *context)
     }
 
     if (dv->device_guid) {
-        if (sscanf(dv->device_guid, "%llx", (long long unsigned int *)&guid) != 1) {
+        if (sscanf(dv->device_guid, "%"PRIu64, &guid) != 1) {
             av_log(context, AV_LOG_INFO, "Invalid dvguid parameter: %s\n",
                    dv->device_guid);
             goto fail;
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index 4a9a21a..92623ed 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -179,7 +179,7 @@ static size_t av_read(void * h, size_t len, uint8_t * buf) {
     return avio_read(bc, buf, len);
 }
 
-static off_t av_seek(void * h, long long pos, int whence) {
+static off_t av_seek(void * h, int64_t pos, int whence) {
     AVIOContext * bc = h;
     if (whence == SEEK_END) {
         pos = avio_size(bc) + pos;
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 07d7f54..841e0ca 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -377,7 +377,7 @@ static int mp3_read_header(AVFormatContext *s)
         if (!(i&1023))
             ffio_ensure_seekback(s->pb, i + 1024 + 4);
         if (check(s, off + i) >= 0) {
-            av_log(s, AV_LOG_INFO, "Skipping %d bytes of junk at %lld.\n", i, (long long)off);
+            av_log(s, AV_LOG_INFO, "Skipping %d bytes of junk at %"PRId64".\n", i, off);
             avio_seek(s->pb, off + i, SEEK_SET);
             break;
         }
diff --git a/libpostproc/postprocess_template.c b/libpostproc/postprocess_template.c
index c7ad3f0..5694cc5 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -1383,7 +1383,7 @@ DERING_CORE((%0, %1, 8)    ,(%%REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,
 #ifdef DEBUG_DERING_THRESHOLD
                     __asm__ volatile("emms\n\t":);
                     {
-                    static long long numPixels=0;
+                    static uint64_t numPixels=0;
                     if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++;
 //                    if((max-min)<20 || (max-min)*QP<200)
 //                    if((max-min)*QP < 500)


More information about the ffmpeg-devel mailing list