Commit Graph

84 Commits

Author SHA1 Message Date
zdenop
27f0f2ecea MSVS support inttypes.h from VS 2015 2019-04-23 20:45:14 +02:00
Stefan Weil
72c874140e Modernize code by replacing C type casts
This was done using clang-tidy.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-07 09:04:51 +02:00
Stefan Weil
d35a6f2de5 Modernize code (clang-tidy check modernize-deprecated-headers)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-05 08:29:00 +02:00
Stefan Weil
20d5eedd45 Modernize code (clang-tidy check modernize-loop-convert)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-05 08:29:00 +02:00
Egor Pugin
af7cc1ce4c Fix windows build. 2019-04-01 22:38:01 +03:00
Stefan Weil
802f42e821 Remove BOOL8, TRUE, FALSE from host.h
Remove unneeded include statements for host.h, add required ones and
update the comments for the remaining include statements.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-31 18:27:20 +02:00
Stefan Weil
30ee3afc29 textord: Replace TRUE, FALSE by true, false and use bool instead of BOOL8
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-31 17:55:20 +02:00
Stefan Weil
664811a869 Replace BOOL8, TRUE, FALSE by bool, true, false
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-31 17:28:28 +02:00
Stefan Weil
a0fd90583b Modernize C++ code using auto
The modifications were done using this command:

    run-clang-tidy-8.py -header-filter='.*' -checks='-*,modernize-use-auto' -fix

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-26 07:55:08 +01:00
Stefan Weil
36f768853a Modernize C++ code using override
The modifications were done using this command:

    run-clang-tidy-8.py -header-filter='.*' -checks='-*,modernize-use-override' -fix

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-26 07:37:52 +01:00
Stefan Weil
ee2f9bf7bf Remove old comments in file headers
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-16 10:55:00 +01:00
Stefan Weil
2cbe723d03 Fix doxygen comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-02-20 21:11:38 +01:00
Stefan Weil
b3bd23edb7 Remove whitespace at line endings
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-02-19 13:53:31 +01:00
Stefan Weil
d42413dd17 OpenCL: Remove PERF_COUNT framework
It was rarely used, but added a lot of code and an unconditional
dependency on openclwrapper.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-02-09 10:58:15 +01:00
Stefan Weil
0fae848b58 OpenCL: Add comments to users of openclwrapper.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-09 12:11:00 +01:00
Stefan Weil
81ab302d52 FPRow: Remove three unused methods
This fixes warnings from the Intel compiler:

    src/textord/cjkpitch.cpp(319): warning #177:
      function "<unnamed>::FPRow::good_gaps" was declared but never referenced
    src/textord/cjkpitch.cpp(383): warning #177:
      function "<unnamed>::FPRow::is_bad" was declared but never referenced
    src/textord/cjkpitch.cpp(387): warning #177:
      function "<unnamed>::FPRow::is_unknown" was declared but never referenced

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-12-08 16:43:52 +01:00
Stefan Weil
404f9cd147 SimpleStats: Remove unused method
This fixes a warning from the Intel compiler:

    src/textord/cjkpitch.cpp(79): warning #177:
      function "<unnamed>::SimpleStats::maximum" was declared
      but never referenced

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-12-08 16:39:46 +01:00
chrismamo1
30be5aaaac fix a couple minor compiler warnings 2018-10-30 18:00:32 -06:00
Stefan Weil
7ebbb7370a ColPartition: Fix CID 1164543 (Division or modulo by float zero)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-22 22:14:15 +02:00
Stefan Weil
e3658bbc78 C_OUTLINE_FRAG: Add declaration for copy constructor
It does not need an implementation as it is currently not used.

This fixes a warning from LGTM:

    No matching copy constructor in class C_OUTLINE_FRAG.
    It is good practice to match a copy assignment operator
    with a copy constructor.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-18 15:31:45 +02:00
Stefan Weil
d86d520fd0 Remove tab character in source files
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 11:31:10 +02:00
Stefan Weil
7f911ac5e0 Fix integer overflow in overlap calculation
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-09 16:43:31 +02:00
Stefan Weil
0f3206d5fe Format code (replace ( xxx ) by (xxx))
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-29 08:21:25 +02:00
Stefan Weil
63f87cac90 Simplify boolean expressions
Remove "? true : false" which is not needed for boolean expressions.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-29 08:21:14 +02:00
DevelopAlex
f69af96dbe
Only print "Merging rows..." in debug mode
Only print "Merging rows..." if textord_debug_blob==true (like all the other debug messages).
Otherwise, there are a lot of "Merging rows..." messages in console output.
2018-09-24 11:43:47 +02:00
Zdenko Podobný
5d22fdfeed replace deprecated C++ headers (reported by clan-tidy) - partially supersedes PR #1605 2018-09-18 18:51:11 +02:00
Jeff Breidenbach
c98391d3d7 fix #1192 bbox as the entire page 2018-09-18 08:09:11 +02:00
Stefan Weil
4fa2a34577 EquationDetectBase: Define virtual destructor in .cpp file
This fixes compiler warnings from clang:

src/textord/equationdetectbase.h:32:7: warning:
 'EquationDetectBase' has no out-of-line virtual method definitions;
 its vtable will be emitted in every translation unit [-Wweak-vtables]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-04 13:14:29 +02:00
Stefan Weil
f29a949649 BlobGrid: Define virtual destructor in .cpp file
This fixes compiler warnings from clang:

src/textord/blobgrid.h:33:7: warning:
 'BlobGrid' has no out-of-line virtual method definitions;
 its vtable will be emitted in every translation unit [-Wweak-vtables]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-04 13:12:29 +02:00
Stefan Weil
b3206d94b5 GridBase: Define virtual destructor in .cpp file
This fixes compiler warnings from clang:

src/textord/bbgrid.h:53:7: warning:
 'GridBase' has no out-of-line virtual method definitions;
 its vtable will be emitted in every translation unit [-Wweak-vtables]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-04 13:11:35 +02:00
Stefan Weil
677198e399 AlignedBlob: Define virtual destructor in .cpp file
This fixes compiler warnings from clang:

src/textord/alignedblob.h:81:7: warning:
 'AlignedBlob' has no out-of-line virtual method definitions;
 its vtable will be emitted in every translation unit [-Wweak-vtables]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-04 13:10:44 +02:00
Stefan Weil
c635cdf5d5 Do not define or use macro __UNIX__
Either it was not needed, or it could be replaced by checking
for not _WIN32.

This fixes a compiler warning from clang:

src/ccutil/platform.h:41:9: warning:
 macro name is a reserved identifier [-Wreserved-id-macro]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-04 07:34:11 +02:00
Stefan Weil
08e25d41b7 textord/cjkpitch: Fix mismatch between format string and argument
size_t would require a different format string. Here an unsigned int
is sufficient in both cases, so use that.

This error was found by lgtm, see
https://lgtm.com/projects/g/tesseract-ocr/tesseract/.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-03 12:17:47 +02:00
Stefan Weil
2cc7839af7 textord/makerow.cpp: Fix compiler warnings
Compiler warnings from clang:

src/textord/makerow.cpp:2579:36: warning:
 cast from 'const void *' to 'BLOBNBOX **' drops const qualifier [-Wcast-qual]
src/textord/makerow.cpp:2581:36: warning:
 cast from 'const void *' to 'BLOBNBOX **' drops const qualifier [-Wcast-qual]
src/textord/makerow.cpp:2601:31: warning:
 cast from 'const void *' to 'TO_ROW **' drops const qualifier [-Wcast-qual]
src/textord/makerow.cpp:2603:31: warning:
 cast from 'const void *' to 'TO_ROW **' drops const qualifier [-Wcast-qual]
src/textord/makerow.cpp:2623:31: warning:
 cast from 'const void *' to 'TO_ROW **' drops const qualifier [-Wcast-qual]
src/textord/makerow.cpp:2625:31: warning:
 cast from 'const void *' to 'TO_ROW **' drops const qualifier [-Wcast-qual]

Warning from lgtm:

Local variable 'blob' hides a parameter of the same name.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-03 12:05:56 +02:00
Stefan Weil
69a111a739 Clean use of qsort function sort_floats
It is only used in textord/topitch.cpp, so move it into that file.

Remove also the inline attribute as it has not effect here and
update the type casts to fix some compiler warnings from clang.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-31 23:17:27 +02:00
Stefan Weil
ac17663015 Fix CID 1395113 ('Constant' variable guards dead code)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-22 13:55:37 +02:00
Stefan Weil
641237495a Fix typo in comments and variable name
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-14 16:20:27 +02:00
Stefan Weil
95ed924d81 Fix typo in function name
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-14 16:20:27 +02:00
Stefan Weil
6a0f8e8c07 ColPartition: Rename median_size_ -> median_height_
This implements a TODO. Rename also some related items.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-03 08:46:38 +02:00
zdenop
d22ca6bb06
Merge pull request #1817 from noahmetzger/winfix
Fix issue detected by Coverity Scan
2018-08-01 16:55:56 +02:00
Noah Metzger
65997bed16 Fix issue detected by Coverity Scan
CID: 1340285 (Division or modulo by zero)

Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2018-08-01 15:56:19 +02:00
Stefan Weil
6a28cce96b Fix whitespace issues
* Remove whitespace (blanks, tabs, cr) at line endings

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-01 13:19:52 +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
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
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
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
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
bdf09f40b1 Fix compiler warnings [-Wzero-as-null-pointer-constant]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 20:40:56 +02:00
Stefan Weil
faae87beaa Replace FLOAT32 by float data type
On most systems float is the IEEE 754 single-precision binary
floating-point format (32 bits). Tesseract does not support other systems.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-02 13:29:39 +02:00