[FFmpeg-cvslog] ffprobe: fix printing of unit values which cannot be contained in an int

Stefano Sabatini git at videolan.org
Wed Jan 18 00:09:47 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Wed Jan 18 00:01:07 2012 +0100| [54661219c12905e70ea360b8aab1386438cae99d] | committer: Stefano Sabatini

ffprobe: fix printing of unit values which cannot be contained in an int

Use long long int to contain such values instead of an int, which is
required to contain at least 64 bits, so it is guaranteed to contain also
int64_t values, which are used by some fields.

In particular, should fix trac ticket #921.

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

 ffprobe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index 61c66ae..0731b04 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -77,7 +77,7 @@ void av_noreturn exit_program(int ret)
 }
 
 struct unit_value {
-    union { double d; int i; } val;
+    union { double d; long long int i; } val;
     const char *unit;
 };
 
@@ -119,7 +119,7 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv)
         }
 
         if (show_float || vald != (int)vald) l = snprintf(buf, buf_size, "%.3f", vald);
-        else                                 l = snprintf(buf, buf_size, "%d",   (int)vald);
+        else                                 l = snprintf(buf, buf_size, "%lld", (long long int)vald);
         snprintf(buf+l, buf_size-l, "%s%s%s", prefix_string || show_value_unit ? " " : "",
                  prefix_string, show_value_unit ? uv.unit : "");
     } else {



More information about the ffmpeg-cvslog mailing list