summaryrefslogtreecommitdiff
path: root/avprobe.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-05-25 11:47:06 -0700
committerLuca Barbato <lu_zero@gentoo.org>2012-05-25 14:20:34 -0700
commitbeb33fca697e4a7ecfe1661d0699a0d55f23f03a (patch)
tree8b5a39c986a0659d200774e611597423e9288e1e /avprobe.c
parentc6eeb9b7b6bbf5d0f507cad522ed5a4f929de14f (diff)
avprobe: improve formatting
Do not use decimals if not needed.
Diffstat (limited to 'avprobe.c')
-rw-r--r--avprobe.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/avprobe.c b/avprobe.c
index 6182875d91..5df6937db5 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;