Commit Graph

1531 Commits

Author SHA1 Message Date
Stefan Weil
f1d3a3b7c3 api/tesseractmain: Fix memory leak caused by exit()
When exit() is called from ParseArgs(), no destructors are executed
for the auto variables vars_vec and vars_values.

Making both variables static fixes the memory leaks, because now the
destructors are always executed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 20:20:24 +02:00
Stefan Weil
53c572b47a ccutils/params: Fix memory leak for static variable global_params
It is possible to avoid the dynamic memory allocation here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 20:20:24 +02:00
Stefan Weil
c7339c32fc viewer/svutil: Fix resource leak
Coverity report:

CID 1164526 (#1 of 1): Resource leak in object (CTOR_DTOR_LEAK)
2. alloc_fn: Calling allocation function socket.

The previous stream_ must be closed before opening a new one.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 16:24:34 +02:00
Stefan Weil
b1f03cb697 classify/adaptmatch: Fix memory leak
Coverity report:

CID 1340280 (#1 of 1): Resource leak (RESOURCE_LEAK)
7. leaked_storage: Variable FloatFeatures going out of scope leaks the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 16:12:31 +02:00
Stefan Weil
a351dae29b ccutil/tessdatamanager: Fix resource leak
Coverity report:

CID 1340278 (#1 of 1): Resource leak (RESOURCE_LEAK)
11. leaked_storage: Variable output_file going out of scope leaks the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 16:00:57 +02:00
Stefan Weil
1327551b49 classify/mastertraining: Fix memory leaks
Coverity report:

CID 1164739 (#1 of 1): Resource leak (RESOURCE_LEAK)
18. leaked_storage: Variable frag going out of scope leaks the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 13:50:42 +02:00
Stefan Weil
963b935e80 classify/adaptmatch: Fix memory leak
Coverity report:

CID 1164738 (#1 of 1): Resource leak (RESOURCE_LEAK)
7. leaked_storage: Variable sample going out of scope leaks the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 13:42:18 +02:00
Stefan Weil
bf334e0477 ccmain/paragraphs: Fix memory leak
Coverity report:

CID 1164737 (#1 of 1): Resource leak (RESOURCE_LEAK)
49. leaked_storage: Variable p going out of scope leaks the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 13:37:03 +02:00
Stefan Weil
aa945bb371 ccstruct/polyblk: Fix memory leak
Coverity report:

CID 1164730 (#1 of 1): Resource leak (RESOURCE_LEAK)
4. leaked_storage: Variable lines going out of scope leaks the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 13:26:24 +02:00
Stefan Weil
c12757b53e viewer/svutil: Fix memory leak
Coverity report:

CID 1164728 (#1 of 1): Resource leak (RESOURCE_LEAK)
33. leaked_storage: Variable argv going out of scope leaks the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-24 13:25:45 +02:00
Jim O'Regan
3458e7c981 helper script to generate dawg input files from text 2016-10-17 19:04:29 +01:00
Egor Pugin
37f568dcbd Update appveyor.yml 2016-10-16 21:33:54 +03:00
Egor Pugin
69b1a38426 Merge pull request #439 from stweil/warning
training: Remove unnecessary const qualifiers
2016-10-11 17:23:20 +03:00
Egor Pugin
f9ce278cbb Turn off macos travis build as it fails during bootstrap. 2016-10-11 17:21:52 +03:00
Stefan Weil
34af6155eb training: Remove unnecessary const qualifiers
This fixes several gcc warnings:

warning:
 type qualifiers ignored on function return type [-Wignored-qualifiers]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-08 11:28:22 +02:00
Egor Pugin
4b6e7af2c5 Update .travis.yml 2016-10-07 10:11:43 +03:00
Zdenko Podobný
54fafc4e2e improve multipage tiff processing (jbreiden patch from 2016-03-29) 2016-10-06 11:13:42 +02:00
Egor Pugin
57d28b2643 Update cppan.yml 2016-09-29 14:26:41 +03:00
Egor Pugin
5dac6f6656 Update cppan.yml 2016-09-29 12:24:18 +03:00
Egor Pugin
8d6dbb133b Tesseract is now tested with CPPAN on appveyor. 2016-09-26 13:12:59 +03:00
Zdenko Podobný
c943fc1a33 sets justification for ParagraphInfo; fixes #429 2016-09-18 20:31:45 +02:00
zdenop
a75ab450a8 Merge pull request #420 from stweil/warnings
Remove some unused constants
2016-09-08 19:56:56 +02:00
Stefan Weil
a5b61e2b35 ccmain: Remove unused constants
In osdetect.cpp, a local definition of kMinCredibleResolution was
identical to a global one, so the local one could be removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-06 21:49:27 +02:00
Stefan Weil
fcd5f7d2a4 textord: Remove unused constants
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-06 21:49:27 +02:00
Stefan Weil
d40b28f47d textord: Remove unused constants
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-06 21:49:26 +02:00
Stefan Weil
db2a8e9f85 api: Remove unused constant kBytesPerBlob
This fixes a compiler warning:

api/baseapi.cpp:1743:11: warning:
 unused variable 'kBytesPerBlob' [-Wunused-const-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-06 21:49:26 +02:00
Stefan Weil
5bce3f7d87 classify: Remove unused constant kMinPCLengthIncrease
This fixes a compiler warning:

classify/intfeaturemap.cpp:33:14: warning:
 unused variable 'kMinPCLengthIncrease' [-Wunused-const-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-06 21:49:16 +02:00
Egor Pugin
193032a778 Update CMakeLists.txt 2016-09-05 18:10:56 +03:00
zdenop
01c364d287 Merge pull request #415 from stweil/warnings
Remove unneeded 'struct' from TessBaseAPI::GetHOCRText (issue #414)
2016-09-05 17:07:28 +02:00
Stefan Weil
caffb3133b Remove unneeded 'struct' from TessBaseAPI::GetHOCRText (issue #414)
It conflicts with a previous 'class' declaration for ETEXT_DESC:

include/tesseract/baseapi.h:594:21:
 Struct 'ETEXT_DESC' was previously declared as a class

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-05 13:17:13 +02:00
Zdenko Podobný
a6871a8c91 remove install-langs - fix #376 2016-09-01 19:21:30 +02:00
Zdenko Podobný
61032d9b14 set fonts_dir to system default font location. Fixes #409 2016-09-01 18:27:00 +02:00
Zdenko Podobný
916897da1b print text2image info to stdout instead of strerr 2016-09-01 13:38:06 +02:00
zdenop
94e21c3ded add info OSD data file is need too 2016-09-01 12:30:47 +02:00
zdenop
b14f7353ab you do not need download all tessdata repository 2016-08-31 20:54:43 +02:00
zdenop
77af7cfa66 Merge pull request #406 from stweil/windows
vs2010: Fix implementation of strcasestr
2016-08-31 15:26:06 +02:00
Stefan Weil
4708ea3b42 vs2010: Fix implementation of strcasestr
A haystack which is shorter than the needle resulted in negative value
for length_haystack which was forced to a very large unsigned value.

The resulting buffer overflow while reading the haystack would crash
text2image when it was called with a short font name.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-31 14:48:07 +02:00
zdenop
2660647007 Merge pull request #404 from stweil/warnings
configure: Don't use -Wno-uninitialized for debug builds
2016-08-30 15:44:45 +02:00
Stefan Weil
fdf950babf configure: Don't use -Wno-uninitialized for debug builds
There is no good reason to suppress useful compiler warnings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-30 15:36:18 +02:00
zdenop
7f8bd11c59 Merge pull request #402 from stweil/windows
fileio: Replace assert with tprintf() and exit(1)
2016-08-30 08:38:21 +02:00
Stefan Weil
6ec1a0a09b fileio: Replace assert with tprintf() and exit(1)
Assertions are good for programming errors, but not for wrong user input.

The new code no longer needs File::ReadFileToStringOrDie, so remove that
method.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-30 07:13:56 +02:00
zdenop
d093ed40cc Merge pull request #401 from stweil/windows
tlog: Remove unused macro TLOG_FATAL
2016-08-29 21:02:06 +02:00
Stefan Weil
1950fec7a2 tlog: Remove unused macro TLOG_FATAL
The implementation was also wrong because it did not use __VA_ARGS__.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-29 19:11:01 +02:00
zdenop
a1a4575f4b Merge pull request #6 from jimregan/gcode_issue1316
Issue 1316: The traineddata file must be closed after it was opened
2016-08-29 17:31:48 +02:00
zdenop
0497dc0e3e Merge pull request #17 from tesseract-ocr/gcode_issue1351
Issue 1351: OpenCL build - kernel_ThresholdRectToPix() not accounting for padding bits in the output pix?!
2016-08-29 17:28:42 +02:00
zdenop
3e5323705a Merge pull request #400 from stweil/windows
ccutil: Fix and simplify implementation of variadic macro
2016-08-29 17:27:33 +02:00
Stefan Weil
1274874e90 ccutil: Fix and simplify implementation of variadic macro
The implementation for MS C did not pass the variable arguments to
tprintf.

The standard is supported since C99 / C++11, so one implementation
is sufficient.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-29 08:15:00 +02:00
zdenop
b000dd22f4 Merge pull request #398 from stweil/windows
text2image: Add linefeed to error message
2016-08-28 21:43:41 +02:00
Stefan Weil
3420acabe5 text2image: Add linefeed to error message
This changes the error message for a missing font from

  Could not find font named Times New Roman.Please correct --font arg.

(missing space after first sentence) to

  Could not find font named Times New Roman.
  Please correct --font arg.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-28 21:33:52 +02:00
zdenop
a1f0f36ddc Merge pull request #397 from stweil/warnings
stringrenderer: Fix compiler warning (-Wwrite-strings)
2016-08-28 15:52:35 +02:00