Commit 0196bc6f authored by Michael Niedermayer's avatar Michael Niedermayer

tiff/doubles2str: factor out component_len

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 07108caf
...@@ -207,14 +207,15 @@ static char *doubles2str(double *dp, int count, const char *sep) ...@@ -207,14 +207,15 @@ static char *doubles2str(double *dp, int count, const char *sep)
{ {
int i; int i;
char *ap, *ap0; char *ap, *ap0;
int component_len = 15 + strlen(sep);
if (!sep) sep = ", "; if (!sep) sep = ", ";
ap = av_malloc((15 + strlen(sep)) * count); ap = av_malloc(component_len * count);
if (!ap) if (!ap)
return NULL; return NULL;
ap0 = ap; ap0 = ap;
ap[0] = '\0'; ap[0] = '\0';
for (i = 0; i < count; i++) { 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; ap += l;
} }
ap0[strlen(ap0) - strlen(sep)] = '\0'; ap0[strlen(ap0) - strlen(sep)] = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment