mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
RAII: *::GetUNLVText()
This commit is contained in:
parent
1dab23916f
commit
8aa0a2dd48
@ -1757,8 +1757,8 @@ const int kLatinChs[] = {
|
||||
|
||||
/**
|
||||
* The recognized text is returned as a char* which is coded
|
||||
* as UNLV format Latin-1 with specific reject and suspect codes
|
||||
* and must be freed with the delete [] operator.
|
||||
* as UNLV format Latin-1 with specific reject and suspect codes.
|
||||
* Returned string must be freed with the delete [] operator.
|
||||
*/
|
||||
char* TessBaseAPI::GetUNLVText() {
|
||||
if (tesseract_ == NULL ||
|
||||
|
@ -621,8 +621,8 @@ class TESS_API TessBaseAPI {
|
||||
|
||||
/**
|
||||
* The recognized text is returned as a char* which is coded
|
||||
* as UNLV format Latin-1 with specific reject and suspect codes
|
||||
* and must be freed with the delete [] operator.
|
||||
* as UNLV format Latin-1 with specific reject and suspect codes.
|
||||
* Returned string must be freed with the delete [] operator.
|
||||
*/
|
||||
char* GetUNLVText();
|
||||
|
||||
|
@ -234,11 +234,10 @@ TessUnlvRenderer::TessUnlvRenderer(const char *outputbase)
|
||||
}
|
||||
|
||||
bool TessUnlvRenderer::AddImageHandler(TessBaseAPI* api) {
|
||||
char* unlv = api->GetUNLVText();
|
||||
const std::unique_ptr<const char[]> unlv(api->GetUNLVText());
|
||||
if (unlv == NULL) return false;
|
||||
|
||||
AppendString(unlv);
|
||||
delete[] unlv;
|
||||
AppendString(unlv.get());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user