Module: libav
Branch: master
Commit: beb33fca697e4a7ecfe1661d0699a0d55f23f03a

Author:    Luca Barbato <lu_z...@gentoo.org>
Committer: Luca Barbato <lu_z...@gentoo.org>
Date:      Fri May 25 11:47:06 2012 -0700

avprobe: improve formatting

Do not use decimals if not needed.

---

 avprobe.c |    7 ++++---
 1 files 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;

_______________________________________________
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to