Commit Graph

4732 Commits

Author SHA1 Message Date
Raf Schietekat
b4cf46697f Issue #529: inside main() use return rather than exit 2017-05-13 18:02:00 +02:00
Raf Schietekat
9a5ed19cf6 Issue #529: cleanup 2017-05-13 18:01:45 +02:00
Stefan Weil
84396707a8 Fix crash if output file could not be opened
This error case results in fout_ == nullptr.
Closing a nullptr file is not allowed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-13 17:27:07 +02:00
Stefan Weil
db8750e94e Remove unused method TessdataManager::LoadFileLater
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-13 13:14:47 +02:00
Stefan Weil
65b839e1aa Remove unused method TessdataManager::OverwriteEntry
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-13 13:14:47 +02:00
zdenop
6bebe71749 Merge pull request #910 from stweil/opt
Fix GenericVector and optimize some code which used GenericVector::init_to_size
2017-05-13 12:53:40 +02:00
zdenop
29f3de9be1 Merge pull request #914 from stweil/clean
Clean code
2017-05-13 12:45:57 +02:00
zdenop
4e93259a80 Merge pull request #912 from stweil/leak
main: Fix two memory leaks and fix order of destructor calls
2017-05-13 12:44:38 +02:00
zdenop
81ad09ba97 Merge pull request #913 from stephengroat/patch-1
test brew HEAD installs
2017-05-13 12:42:09 +02:00
Stefan Weil
5dc4af62fb baseapi: Simplify code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-13 12:14:29 +02:00
Stefan Weil
69296f8d18 Clean method UNICHARSET::add_script
It increased the script_table too early, so the last element was never
used.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-13 11:53:43 +02:00
Stefan Weil
78142593d2 Fix order of destructor calls for DawgCache and TessBaseAPI
TessBaseAPI must release its cache use before DawgCache is destroyed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-13 11:35:30 +02:00
Stephen
b4b14061ff shouldn't rely on different install 2017-05-12 14:14:08 -07:00
Stephen
14baca38b1 test brew installs but allow failures 2017-05-12 14:02:39 -07:00
Stefan Weil
f37f858c99 main: Fix two memory leaks
When Tesseract terminates by calling the exit function,
the destructor of any local auto variable is not called.

Fix two cases by using static variables.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-12 21:15:52 +02:00
zdenop
af212af89f Merge pull request #909 from stweil/include
ccutil: Remove unneeded include statement
2017-05-12 16:22:24 +02:00
Stefan Weil
3a67ff930e Optimize code by replacing init_to_size with resize_no_init
There is no need to initialize memory with a fixed value which is
overwritten in the next step.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-12 14:34:55 +02:00
Stefan Weil
bb2348bbbe genericvector: Fix and optimize function LoadDataFromFile
It's not necessary to initialize the vector with 0,
because the initial values are read from file.

Fix also an assertion when trying to read an empty file.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-12 14:15:54 +02:00
Stefan Weil
80f51c3758 ccutil: Remove unneeded include statement
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-12 14:11:21 +02:00
zdenop
21e739ca2e Merge pull request #907 from stweil/no-tiff
Remove most libtiff dependencies
2017-05-12 12:49:36 +02:00
Stefan Weil
5e3665c6ae Remove most libtiff dependencies
libtiff is no longer needed for OpenCL, so remove that dependency.

It is still suggested for Windows to redirect warning messages
from the tesseract executable to the console.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-12 10:15:35 +02:00
zdenop
2b373d1cca Merge pull request #896 from rfschtkt/toomanywarnings
Too many warnings!
2017-05-12 08:46:12 +02:00
Raf Schietekat
8dad542f77 Fewer g++ -Wunused-variable warnings 2017-05-11 23:36:05 +02:00
Raf Schietekat
7f382df5ec Fewer g++ -Wsign-compare warnings (cont.) 2017-05-11 23:14:52 +02:00
Raf Schietekat
c335508e84 Fewer g++ -Wsign-compare warnings 2017-05-11 23:14:52 +02:00
Raf Schietekat
1bd561d431 Fewer g++ -Wmaybe-uninitialized warnings 2017-05-11 23:14:52 +02:00
zdenop
da3c462f45 Merge pull request #906 from stweil/casts
Remove some type casts
2017-05-11 21:27:01 +02:00
Stefan Weil
7831a35dbb ccutil: Simplify code (removes type cast)
There is no need for an intermediate variable char_buffer.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 20:10:17 +02:00
Stefan Weil
8c75d26657 Remove unneeded type casts when using Leptonica macro GET_DATA_BYTE
The first parameter is casted to an unsigned byte by Leptonica,
so we don't need additional type casts in Tesseract code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 20:08:27 +02:00
zdenop
8b65bb3ae7 Merge pull request #905 from stweil/formatstring
Replace Tesseract's format macros by standard macros and fix some related issues
2017-05-11 19:41:51 +02:00
Stefan Weil
121a7c6489 ccstruct: Fix non portable and wrong format strings
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 19:32:51 +02:00
Stefan Weil
9abbc4c6f3 ccstruct: Fix wrong format string
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 19:32:51 +02:00
Stefan Weil
0c88b72909 training: Fix format error and some compiler warnings
The size() method returns a size_type value which is an unsigned type.
As there is no portable format string for that type, a type cast is needed.

Fix also several signed / unsigned mismatches which resulted in compiler
warnings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 19:32:51 +02:00
Stefan Weil
9266f01857 Remove macros which are no longer needed
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 19:32:51 +02:00
Stefan Weil
ef1d9600b1 Use standard macros for format strings
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 19:32:51 +02:00
Stefan Weil
f2252fdadc Introduce standard macros for format specifiers
There exist standard macro definitions for the printf format specifiers.
MS Visual Studio does not support that standard (at least not in older
versions), so local definitions are needed there.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 19:30:49 +02:00
zdenop
2008dafa73 Merge pull request #904 from stweil/rangecheck
Improve index range check
2017-05-11 16:09:33 +02:00
zdenop
64994a2707 Merge pull request #900 from rfschtkt/cast
Reviewed uses of reinterpret_cast
2017-05-11 16:08:12 +02:00
zdenop
9b998a7e0d Merge pull request #897 from rfschtkt/RAII
RAII
2017-05-11 16:06:44 +02:00
Stefan Weil
c273f85092 Improve index range check
A wrong array index must raise an assertion instead of printing an
error message and continuing program execution.

Remove also some float operations which are not needed because the
blob_box coordinates are of type int16_t.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 11:55:07 +02:00
zdenop
7a99a41fcf Merge pull request #903 from stweil/formatstring
Fix wrong format string
2017-05-11 11:28:50 +02:00
Stefan Weil
3cccae69e5 Fix wrong format string
The local variable intval is of type int.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-05-11 09:06:02 +02:00
Raf Schietekat
190584fec7 RAII: PB_LINE_IT::get_line(): was leaked inside POLY_BLOCK::fill() 2017-05-11 02:02:37 +02:00
Raf Schietekat
8aa0a2dd48 RAII: *::GetUNLVText() 2017-05-11 02:02:37 +02:00
Raf Schietekat
1dab23916f RAII: *::GetBoxText() 2017-05-11 02:02:37 +02:00
Raf Schietekat
b7b68a65dd RAII: *::GetTSVText() 2017-05-11 02:02:37 +02:00
Raf Schietekat
a1fff874b4 RAII: *::GetHOCRText() 2017-05-11 02:02:37 +02:00
Raf Schietekat
986970d6ca RAII: pdfrenderer.cpp: pdftext 2017-05-11 02:02:37 +02:00
Raf Schietekat
3c6e18ecf9 RAII: pdfrenderer.cpp: buffer 2017-05-11 02:02:37 +02:00
Raf Schietekat
936ca00c44 RAII: pdfrenderer.cpp: cidtogidmap 2017-05-11 02:02:37 +02:00