From 59de2aaee0154420801f279cc976f0a2cc4b1a15 Mon Sep 17 00:00:00 2001
From: Adam Clarke <aclarke@worldplay.tv>
Date: Tue, 17 Jan 2012 13:00:44 -0800
Subject: [PATCH] correct reporting of +2GB file sizes
---
ffprobe.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ffprobe.c b/ffprobe.c
index 61c66ae..bb1cbb0 100644
|
a
|
b
|
void av_noreturn exit_program(int ret)
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | struct unit_value { |
| 80 | | union { double d; int i; } val; |
| | 80 | union { double d; int64_t i; } val; |
| 81 | 81 | const char *unit; |
| 82 | 82 | }; |
| 83 | 83 | |
| … |
… |
static char *value_string(char *buf, int buf_size, struct unit_value uv)
|
| 104 | 104 | snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs); |
| 105 | 105 | } else if (use_value_prefix) { |
| 106 | 106 | const char *prefix_string; |
| 107 | | int index, l; |
| | 107 | int64_t index, l; |
| 108 | 108 | |
| 109 | 109 | if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) { |
| 110 | | index = (int) (log(vald)/log(2)) / 10; |
| | 110 | index = (int64_t) (log(vald)/log(2)) / 10; |
| 111 | 111 | index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) -1); |
| 112 | 112 | vald /= pow(2, index*10); |
| 113 | 113 | prefix_string = binary_unit_prefixes[index]; |
| 114 | 114 | } else { |
| 115 | | index = (int) (log10(vald)) / 3; |
| | 115 | index = (int64_t) (log10(vald)) / 3; |
| 116 | 116 | index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) -1); |
| 117 | 117 | vald /= pow(10, index*3); |
| 118 | 118 | prefix_string = decimal_unit_prefixes[index]; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | | if (show_float || vald != (int)vald) l = snprintf(buf, buf_size, "%.3f", vald); |
| 122 | | else l = snprintf(buf, buf_size, "%d", (int)vald); |
| | 121 | if (show_float || vald != (int64_t)vald) l = snprintf(buf, buf_size, "%.3f", vald); |
| | 122 | else l = snprintf(buf, buf_size, "%ld", (int64_t)vald); |
| 123 | 123 | snprintf(buf+l, buf_size-l, "%s%s%s", prefix_string || show_value_unit ? " " : "", |
| 124 | 124 | prefix_string, show_value_unit ? uv.unit : ""); |
| 125 | 125 | } else { |
| 126 | 126 | int l; |
| 127 | 127 | |
| 128 | 128 | if (show_float) l = snprintf(buf, buf_size, "%.3f", vald); |
| 129 | | else l = snprintf(buf, buf_size, "%d", (int)vald); |
| | 129 | else l = snprintf(buf, buf_size, "%ld", (int64_t)vald); |
| 130 | 130 | snprintf(buf+l, buf_size-l, "%s%s", show_value_unit ? " " : "", |
| 131 | 131 | show_value_unit ? uv.unit : ""); |
| 132 | 132 | } |