summaryrefslogtreecommitdiffstats
path: root/ffprobe.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-01-18 00:22:17 +0100
committerStefano Sabatini <stefasab@gmail.com>2012-01-18 00:43:55 +0100
commit2c8d37c2fb3367bb3f8aa8a804e65b27a2829dac (patch)
tree7f7a69182d6c8ca485a84c00f17e22b923f1c47d /ffprobe.c
parent54661219c12905e70ea360b8aab1386438cae99d (diff)
downloadffmpeg-streaming-2c8d37c2fb3367bb3f8aa8a804e65b27a2829dac.zip
ffmpeg-streaming-2c8d37c2fb3367bb3f8aa8a804e65b27a2829dac.tar.gz
ffprobe: use safer type for index variable in value_string()
There is no guarantee that the casted double which is assigned to the variable will be contained in an int (also if it is almost sure for most non-alien architectures).
Diffstat (limited to 'ffprobe.c')
-rw-r--r--ffprobe.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ffprobe.c b/ffprobe.c
index 0731b04..ac89694 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -104,15 +104,16 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv)
snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs);
} else if (use_value_prefix) {
const char *prefix_string;
- int index, l;
+ long long int index;
+ int l;
if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) {
- index = (int) (log(vald)/log(2)) / 10;
+ index = (long long int) (log(vald)/log(2)) / 10;
index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) -1);
vald /= pow(2, index*10);
prefix_string = binary_unit_prefixes[index];
} else {
- index = (int) (log10(vald)) / 3;
+ index = (long long int) (log10(vald)) / 3;
index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) -1);
vald /= pow(10, index*3);
prefix_string = decimal_unit_prefixes[index];
OpenPOWER on IntegriCloud