瀏覽代碼

Add a comment in the SVG exporter to explain buffer size

tags/v0.99.beta20
Sam Hocevar 3 年之前
父節點
當前提交
a15ba999d5
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. +7
    -1
      caca/codec/export.c

+ 7
- 1
caca/codec/export.c 查看文件

@@ -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…
取消
儲存