Browse Source

Add a comment in the SVG exporter to explain buffer size

tags/v0.99.beta20
Sam Hocevar 3 years ago
parent
commit
a15ba999d5
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      caca/codec/export.c

+ 7
- 1
caca/codec/export.c View File

@@ -863,7 +863,13 @@ static void *export_svg(caca_canvas_t const *cv, size_t *bytes)
char *data, *cur;
int x, y;

/* 200 is arbitrary but should be ok */
/* Use 200 as a safety value for character information size
*
* Worst case for background, 68 chars:
* <rect style="fill:#fff" x="65535" y="65535" width="6" height="10"/>\n
* Worst case for foreground, 97 chars:
* <text style="fill:#fff" font-weight="bold" font-style="italic" x="65535" y="65535">xxxxxx</text>\n
*/
*bytes = strlen(svg_header) + 128 + cv->width * cv->height * 200;
cur = data = malloc(*bytes);



Loading…
Cancel
Save