[FFmpeg-cvslog] ffprobe: in value_string(), do not print trailing space in case of no suffix

Stefano Sabatini git at videolan.org
Wed Aug 17 10:31:26 CEST 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Wed Aug 17 00:34:15 2011 +0200| [7c94740b84f95f4a1e3a70884dc1928ce3bc2570] | committer: Stefano Sabatini

ffprobe: in value_string(), do not print trailing space in case of no suffix

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c94740b84f95f4a1e3a70884dc1928ce3bc2570
---

 ffprobe.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index f857311..4ef9902 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -83,9 +83,11 @@ static char *value_string(char *buf, int buf_size, double val, const char *unit)
             prefix_string = decimal_unit_prefixes[index];
         }
 
-        snprintf(buf, buf_size, "%.3f %s%s", val, prefix_string, show_value_unit ? unit : "");
+        snprintf(buf, buf_size, "%.3f%s%s%s", val, prefix_string || show_value_unit ? " " : "",
+                 prefix_string, show_value_unit ? unit : "");
     } else {
-        snprintf(buf, buf_size, "%f %s", val, show_value_unit ? unit : "");
+        snprintf(buf, buf_size, "%f%s%s", val, show_value_unit ? " " : "",
+                 show_value_unit ? unit : "");
     }
 
     return buf;



More information about the ffmpeg-cvslog mailing list