Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-09-13 02:44:04 +0400
committerStefano Sabatini <stefasab@gmail.com>2012-09-14 12:42:54 +0400
commit5e99a23b2d0b74048125844521c4bf7d8e07e19d (patch)
tree733e96ddc55c9816d21b647710f432492a3a36ce /ffprobe.c
parente3329474a366de066b25e86f35f5abf9c5a4b7b2 (diff)
ffprobe: avoid potentially lossy long long int -> double cast in value_string()
Previously the cast long long int -> double was always performed (and then the double was converted back to long long int) even when it was avoidable.
Diffstat (limited to 'ffprobe.c')
-rw-r--r--ffprobe.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ffprobe.c b/ffprobe.c
index 06af4c33d0..c9f973d068 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -96,13 +96,14 @@ struct unit_value {
static char *value_string(char *buf, int buf_size, struct unit_value uv)
{
double vald;
+ long long int vali;
int show_float = 0;
if (uv.unit == unit_second_str) {
vald = uv.val.d;
show_float = 1;
} else {
- vald = uv.val.i;
+ vald = vali = uv.val.i;
}
if (uv.unit == unit_second_str && use_value_sexagesimal_format) {
@@ -136,7 +137,7 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv)
if (show_float || (use_value_prefix && vald != (long long int)vald))
snprintf(buf, buf_size, "%f", vald);
else
- snprintf(buf, buf_size, "%lld", (long long int)vald);
+ snprintf(buf, buf_size, "%lld", vali);
av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || show_value_unit ? " " : "",
prefix_string, show_value_unit ? uv.unit : "");
}