[FFmpeg-cvslog] avprobe: improve formatting
Luca Barbato
git at videolan.org
Sat May 26 22:41:51 CEST 2012
ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Fri May 25 11:47:06 2012 -0700| [beb33fca697e4a7ecfe1661d0699a0d55f23f03a] | committer: Luca Barbato
avprobe: improve formatting
Do not use decimals if not needed.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=beb33fca697e4a7ecfe1661d0699a0d55f23f03a
---
avprobe.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/avprobe.c b/avprobe.c
index 6182875..5df6937 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -90,11 +90,12 @@ static char *value_string(char *buf, int buf_size, double val, const char *unit)
val /= pow(10, index * 3);
prefix_string = decimal_unit_prefixes[index];
}
-
- snprintf(buf, buf_size, "%.3f %s%s", val, prefix_string,
+ snprintf(buf, buf_size, "%.*f%s%s",
+ index ? 3 : 0, val,
+ prefix_string,
show_value_unit ? unit : "");
} else {
- snprintf(buf, buf_size, "%f %s", val, show_value_unit ? unit : "");
+ snprintf(buf, buf_size, "%f%s", val, show_value_unit ? unit : "");
}
return buf;
More information about the ffmpeg-cvslog
mailing list