File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -1702,8 +1702,9 @@ const int kMaxBytesPerLine = kNumbersPerBlob * (kBytesPer64BitNumber + 1) + 1 +
1702
1702
1703
1703
/* *
1704
1704
* The recognized text is returned as a char* which is coded
1705
- * as a UTF8 box file and must be freed with the delete [] operator .
1705
+ * as a UTF8 box file.
1706
1706
* page_number is a 0-base page index that will appear in the box file.
1707
+ * Returned string must be freed with the delete [] operator.
1707
1708
*/
1708
1709
char * TessBaseAPI::GetBoxText (int page_number) {
1709
1710
if (tesseract_ == NULL ||
Original file line number Diff line number Diff line change @@ -612,10 +612,10 @@ class TESS_API TessBaseAPI {
612
612
613
613
/* *
614
614
* The recognized text is returned as a char* which is coded in the same
615
- * format as a box file used in training. Returned string must be freed with
616
- * the delete [] operator.
615
+ * format as a box file used in training.
617
616
* Constructs coordinates in the original image - not just the rectangle.
618
617
* page_number is a 0-based page index that will appear in the box file.
618
+ * Returned string must be freed with the delete [] operator.
619
619
*/
620
620
char * GetBoxText (int page_number);
621
621
Original file line number Diff line number Diff line change @@ -251,11 +251,10 @@ TessBoxTextRenderer::TessBoxTextRenderer(const char *outputbase)
251
251
}
252
252
253
253
bool TessBoxTextRenderer::AddImageHandler (TessBaseAPI* api) {
254
- char * text = api->GetBoxText (imagenum ());
254
+ const std::unique_ptr< const char []> text ( api->GetBoxText (imagenum () ));
255
255
if (text == NULL ) return false ;
256
256
257
- AppendString (text);
258
- delete[] text;
257
+ AppendString (text.get ());
259
258
260
259
return true ;
261
260
}
You can’t perform that action at this time.
0 commit comments