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-01-18 03:36:33 +0400
committerStefano Sabatini <stefasab@gmail.com>2012-01-18 03:44:28 +0400
commit140a9afcf284123f3967060c6c7ef8105484bca6 (patch)
tree86235f7ec9e7104825555de1c5c36adec87ded01 /ffprobe.c
parent2c8d37c2fb3367bb3f8aa8a804e65b27a2829dac (diff)
ffprobe: add more safe casts in value_string()
Second attempt at fixing ticket #921.
Diffstat (limited to 'ffprobe.c')
-rw-r--r--ffprobe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ffprobe.c b/ffprobe.c
index ac89694434..a5559a4429 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 : "");
}