Commit Graph

3344 Commits

Author SHA1 Message Date
Stefan Weil
cfd72ff31e Fix --print-parameters (regression)
Commit 629ded223c had broken that
functionality.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-09 14:42:48 +02:00
zdenop
0e154ab530
Merge pull request #1768 from stweil/ocl
opencl: Fix crash and clean code a bit
2018-07-08 20:43:37 +02:00
Stefan Weil
88ebfea4b5 opencl: Fix crash and clean code a bit
OpenclDevice::getDeviceSelection crashed when outdated information
was read from file and device.score was not set.

Change also the struct definitions from C to C++ and
eliminate some type casts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-08 18:38:11 +02:00
zdenop
e9cd6024d7
Merge pull request #1767 from stweil/unused
Remove unused macros and fix comments
2018-07-07 21:55:17 +02:00
zdenop
249ca52672
Merge pull request #1766 from stweil/tprintf
Replace tprintf_internal by tprintf and clean tprintf code
2018-07-07 21:55:01 +02:00
Stefan Weil
0d4975933e Replace tprintf_internal by tprintf and clean tprintf code
Commit 4d514d5a60 introduced tprintf_internal
with an additional argument "level" which was removed again in commit
7dc5296fe9.

So we can now restore the original state without tprintf_internal.

Remove also the declaration of debug_window_on (it does not exist since
commit 030aae9896) and make the
configuration parameter debug_file local as it is only used by tprintf.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:47:10 +02:00
Stefan Weil
24bf8c334c Add include statements (needed for following commit)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:46:58 +02:00
Stefan Weil
8bd9567355 Fix some comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:19:01 +02:00
Stefan Weil
44415a706e Remove unused EXTERN macros
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:19:01 +02:00
Stefan Weil
7e80a850ad Remove unused macros
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:19:01 +02:00
Stefan Weil
609edd4600 Add missing include statement
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:19:00 +02:00
Egor Pugin
cfa787d976
Merge pull request #1765 from stweil/includes
Add missing include statements and clean some include statements
2018-07-07 19:59:33 +03:00
Stefan Weil
55f0ca5842 Add missing include statements and clean some include statements
The changes are based on an analysis done with include-what-you-use.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 16:24:53 +02:00
zdenop
71bb9c373b
Merge pull request #1761 from srdg/patch-1
Fixed "Invalid F spec" error while building FullyConnected layer.
2018-07-06 22:11:36 +02:00
zdenop
446453a360
Merge pull request #1762 from stweil/typo
Fix some typos in comments and documentation
2018-07-06 22:11:23 +02:00
Stefan Weil
cdc7db7082 unlvtests: Fix typo in documentation (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 22:02:08 +02:00
Stefan Weil
0eb239ee8b Fix typo in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 22:00:00 +02:00
Soumik Ranjan Dasgupta
001f536c16
Fixed "Invalid F spec" error while building FullyConnected layer.
`int depth = strtol(*str + 1, str, 10);`
`**str` holds the words in the VGSL specification, and `*str` holds a single word, lets say, `Fr64`. Now, the `strtol` function modifies `str` to point to the first character which a non-digit number, and assumes that ` *str+1 ` points to a number (of valid integer format) as a string (automatically skipping all the white spaces, and no other characters), where in reality, it seems to point to `r` in `Fr164`.This is a bad argument, which results in strtol returning 0.
` strtol (*str + 2, str, 10)` should be passed instead.
2018-07-06 23:54:22 +05:30
zdenop
ab1f21768a
Merge pull request #1760 from stweil/cov
Fix several issues reported by Coverity Scan (incomplete constructors)
2018-07-06 18:48:49 +02:00
Stefan Weil
18edac4086 Fix CID 1164623 (Uninitialized scalar field)
Fix it by combining constructor and Init method.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:34:46 +02:00
Stefan Weil
66b71e6b58 Fix CID 1164621 (Uninitialized scalar field)
Format also some comments.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:12:12 +02:00
Stefan Weil
8582ee097c Fix CID 1164618 (Uninitialized scalar field)
Fix it by combining constructor and Init method.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:02:50 +02:00
Stefan Weil
37f82824f5 Fix CID 1164616 (Uninitialized scalar field)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:02:50 +02:00
Stefan Weil
430dc5c0b6 Fix CID 1164612 (Uninitialized scalar field)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:02:50 +02:00
Stefan Weil
19a99450bc Fix CID 1164611 (Uninitialized scalar field)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:02:50 +02:00
Egor Pugin
d16e518343
Merge pull request #1759 from stweil/cov
Fix several issues reported by Coverity Scan (related to untrusted external data)
2018-07-06 17:41:39 +03:00
Stefan Weil
4bb41b8952 Fix CID 1164693 (Untrusted value as argument)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:29 +02:00
Stefan Weil
992031e824 Fix CID 1164702 (Untrusted value as argument)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:29 +02:00
Stefan Weil
c1da5fbac4 Fix CID 1164704 (Untrusted value as argument)
Limit the matrix to UINT16_MAX x UINT16_MAX.

Larger dimensions could also result in an arithmetic overflow
when multiplying the two dimensions.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:29 +02:00
Stefan Weil
8871f4d622 Fix CID 1164686 (Use of untrusted scalar value)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:29 +02:00
Stefan Weil
92e2ad0471 Fix CID 1164703 (Untrusted value as argument)
Wrong file data could give a large value for the number of vector elements
resulting in very large memory allocations.

Limit the allowed data range to UINT16_MAX (65535) elements
which hopefully should be sufficient for all use cases.

Changing the data type of the related member variables from int to
uint32_t allowed removing several type casts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:10 +02:00
Egor Pugin
a078ce02bb
Merge pull request #1756 from stweil/cov
Fix two issues reported by Coverity Scan
2018-07-05 23:10:39 +03:00
Egor Pugin
f2f9bed41d
Merge pull request #1755 from stweil/clean
Remove unused iterator
2018-07-05 23:10:18 +03:00
Stefan Weil
bfe2a79502 Fix CID 1164566 (Dereference after null check)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 22:07:36 +02:00
Stefan Weil
036c72ca2f Fix CID 1164733 (Resource leak)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 22:07:36 +02:00
Stefan Weil
8d60a1849c Remove unused iterator
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 21:20:27 +02:00
Egor Pugin
3ea9cff149
Merge pull request #1752 from stweil/api
API fixes
2018-07-05 17:28:48 +03:00
Egor Pugin
09f4179e89
Merge pull request #1754 from stweil/fix
Fix compiler warnings [-Wmissing-prototypes]
2018-07-05 17:28:36 +03:00
Egor Pugin
023635e811
Merge pull request #1753 from stweil/break
Fix empty statements
2018-07-05 17:24:53 +03:00
Stefan Weil
d2febafdcd Fix compiler warnings [-Wmissing-prototypes]
Add missing include statements, add missing "static" qualifiers or
remove functions which are not used at all.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 16:03:02 +02:00
Stefan Weil
8ad7f049ea Fix empty statements
* Add break in default case to avoid potential problems with
  future case statements following the default case.

* Remove empty statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 15:17:54 +02:00
Stefan Weil
ffb501936c Fix prototype for API function TessBaseGetBlockTextOrientations
The declaration did not match the implementation (BOOL / bool).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 14:49:48 +02:00
Stefan Weil
790b410fd6 Remove unused API function TessBaseAPIDetectOS
It was not declared in capi.h, so external users could not use it anyway.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 14:49:48 +02:00
Egor Pugin
4ca452d9b7
Merge pull request #1750 from stweil/fix
Fix several compiler warnings (clang)
2018-07-05 14:43:03 +03:00
Stefan Weil
f107f116d9 Fix compiler warnings [-Wconditional-uninitialized]
clang warnings:

src/ccstruct/coutln.cpp:231:15: warning:
 variable 'destindex' may be uninitialized when used here [-Wconditional-uninitialized]
src/wordrec/language_model.cpp:1170:27: warning:
 variable 'expected_gap' may be uninitialized when used here [-Wconditional-uninitialized]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 12:07:04 +02:00
Stefan Weil
a74d467e90 Fix compiler warnings [-Wcomma]
clang warnings:

src/api/baseapi.cpp:1642:18: warning:
 possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1642:31: warning:
 possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1642:45: warning:
 possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1652:16: warning:
 possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1652:30: warning:
 possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1662:17: warning:
 possible misuse of comma operator here [-Wcomma]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 12:07:04 +02:00
Stefan Weil
296a836f4e Fix compiler warnings [-Wunused-const-variable]
clang warnings:

src/classify/trainingsampleset.cpp:39:11: warning:
 unused variable 'kMinOutlierSamples' [-Wunused-const-variable]
src/lstm/lstmrecognizer.cpp:45:11: warning:
 unused variable 'kMaxChoices' [-Wunused-const-variable]
src/training/dawg2wordlist.cpp:28:11: warning:
 unused variable 'kDictDebugLevel' [-Wunused-const-variable]
src/training/stringrenderer.cpp:50:21: warning:
 unused variable 'kWordJoiner' [-Wunused-const-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 12:07:04 +02:00
zdenop
d27f5b58f9
Merge pull request #1747 from stweil/fix
Fix syntax errors introduced by last commit (regression)
2018-07-05 07:54:07 +02:00
Stefan Weil
787bde5630 Fix syntax errors introduced by last commit (regression)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 07:34:04 +02:00
zdenop
cf6c79d842
Merge pull request #1746 from stweil/fix
Fix some warnings from clang compiler
2018-07-04 22:09:17 +02:00