浏览代码

* "Fixed" infinite loop in ANSI+UTF8 importer, probably totally wrong, but like to be bashed.

tags/v0.99.beta14
Jean-Yves Lamoureux jylam 19 年前
父节点
当前提交
f7cd9f1b27
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. +0
    -1
      DotNet/test.cs
  2. +6
    -1
      cucul/import.c

+ 0
- 1
DotNet/test.cs 查看文件

@@ -57,7 +57,6 @@ class Test {
Console.WriteLine("Render time : {0}", kk.getDisplayTime()-startTime); Console.WriteLine("Render time : {0}", kk.getDisplayTime()-startTime);
} }



/* Force deletion of our instance for fun */ /* Force deletion of our instance for fun */
qq.Dispose(); qq.Dispose();
} }


+ 6
- 1
cucul/import.c 查看文件

@@ -406,6 +406,11 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size,
if(utf8) if(utf8)
{ {
unsigned int bytes; unsigned int bytes;
/* Probably a wrong thing */
if(((char const *)(buffer + i))[0] == 0)
{
goto end;
}
ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes); ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes);
wch = cucul_utf32_is_fullwidth(ch) ? 2 : 1; wch = cucul_utf32_is_fullwidth(ch) ? 2 : 1;
skip += bytes - 1; skip += bytes - 1;
@@ -439,7 +444,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size,
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT); cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT);
cucul_set_canvas_size(cv, width, height = y); cucul_set_canvas_size(cv, width, height = y);
} }
end:
return cv; return cv;
} }




正在加载...
取消
保存