提交 c2e84c46 编写于 作者: D david.eger@gmail.com

Fix two issues with GetHOCRText():

+ make it not seg-fault if called without calling SetInputName().
+ make it not leak memory (thank you valgrind)

http://code.google.com/p/tesseract-ocr/issues/detail?id=463



git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@699 d0cd1f9f-072b-0410-8dd7-cf729c803f20
上级 75a9a8fa
......@@ -950,7 +950,7 @@ char* TessBaseAPI::GetHOCRText(int page_number) {
hocr_str.add_str_int("<div class='ocr_page' id='page_", page_id);
hocr_str += "' title='image \"";
hocr_str += *input_file_;
hocr_str += input_file_ ? *input_file_ : "unknown";
hocr_str.add_str_int("\"; bbox ", rect_left_);
hocr_str.add_str_int(" ", rect_top_);
hocr_str.add_str_int(" ", rect_width_);
......@@ -1013,6 +1013,7 @@ char* TessBaseAPI::GetHOCRText(int page_number) {
hocr_str += grapheme;
}
}
delete []grapheme;
res_it->Next(RIL_SYMBOL);
} while (!res_it->Empty(RIL_BLOCK) && !res_it->IsAtBeginningOf(RIL_WORD));
if (italic) hocr_str += "</em>";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册