Browse Source

tiff/doubles2str: factor out component_len

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n1.0
Michael Niedermayer 13 years ago
parent
commit
0196bc6f14
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      libavcodec/tiff.c

+ 3
- 2
libavcodec/tiff.c View File

@@ -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';


Loading…
Cancel
Save