[FFmpeg-cvslog] ffprobe: add more safe casts in value_string()
Stefano Sabatini
git at videolan.org
Wed Jan 18 00:45:39 CET 2012
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Wed Jan 18 00:36:33 2012 +0100| [140a9afcf284123f3967060c6c7ef8105484bca6] | committer: Stefano Sabatini
ffprobe: add more safe casts in value_string()
Second attempt at fixing ticket #921.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=140a9afcf284123f3967060c6c7ef8105484bca6
---
ffprobe.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ffprobe.c b/ffprobe.c
index ac89694..a5559a4 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -119,15 +119,15 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv)
prefix_string = decimal_unit_prefixes[index];
}
- if (show_float || vald != (int)vald) l = snprintf(buf, buf_size, "%.3f", vald);
- else l = snprintf(buf, buf_size, "%lld", (long long int)vald);
+ if (show_float || vald != (long long int)vald) l = snprintf(buf, buf_size, "%.3f", 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 {
int l;
if (show_float) 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", show_value_unit ? " " : "",
show_value_unit ? uv.unit : "");
}
More information about the ffmpeg-cvslog
mailing list