[FFmpeg-cvslog] tiff/doubles2str: factor out component_len

Michael Niedermayer git at videolan.org
Sun Sep 9 14:48:46 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep  9 14:40:10 2012 +0200| [0196bc6f140d47ec0dd3e411eaefbba4cd152349] | committer: Michael Niedermayer

tiff/doubles2str: factor out component_len

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/tiff.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 26401b1..b0ffd7b 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -207,14 +207,15 @@ static char *doubles2str(double *dp, int count, const char *sep)
 {
     int i;
     char *ap, *ap0;
+    int component_len = 15 + strlen(sep);
     if (!sep) sep = ", ";
-    ap = av_malloc((15 + strlen(sep)) * count);
+    ap = av_malloc(component_len * count);
     if (!ap)
         return NULL;
     ap0   = ap;
     ap[0] = '\0';
     for (i = 0; i < count; i++) {
-        int l = snprintf(ap, 15 + strlen(sep), "%f%s", dp[i], sep);
+        int l = snprintf(ap, component_len, "%f%s", dp[i], sep);
         ap += l;
     }
     ap0[strlen(ap0) - strlen(sep)] = '\0';



More information about the ffmpeg-cvslog mailing list