Commit Graph

73 Commits

Author SHA1 Message Date
Stefan Weil
595346d548 Replace some snprintf by std::to_string and modernize more code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-24 08:01:59 +01:00
Stefan Weil
d4d51910e1 Add braces to single line statements (clang-tidy -checks='-*,google-readability-braces-around-statements')
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-22 09:02:13 +01:00
Stefan Weil
406233f1ae Modernize code (clang-tidy -checks='-*,modernize-use-equals-default')
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-21 21:45:56 +01:00
Stefan Weil
21d9aad594 Replace remaining STRING by std::string in src/viewer and src/wordrec
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-15 09:11:41 +01:00
Egor Pugin
0eb7ba88bf [clang-format] Execute clang format on include and src dirs.
Script:
find include src -type f | sort > all.txt
find include src -type f | grep -v "\.cpp" | grep -v "\.h" | sort > skip.txt
comm -23 all.txt skip.txt | xargs clang-format -i
2021-03-12 22:35:02 +03:00
Stefan Weil
bc69e28de3 Update include statements for external header file allheaders.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-13 10:17:20 +01:00
Egor Pugin
664a718a63 Rename platform.h to export.h. 2021-01-01 00:18:36 +03:00
Egor Pugin
cad8cb31bb Add missing includes. 2020-12-31 17:58:36 +03:00
Egor Pugin
c86325e2f7 Use TESS_API for every public symbol. Public symbol is exported from the library. This also applies to unit test and training symbols. Users will be limited to public api, but set of exported symbols will be wider still.
Remove TESS_LOCAL.
Fix several symbol issues that made visible with these changes.

All build systems must set -fvisibility-hidden for *nix systems.
2020-12-31 16:32:29 +03:00
Stefan Weil
90af3e7b5c Remove strngs.h from public API
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-28 21:03:29 +01:00
Egor Pugin
79a86f2582 Move all tesseract symbols into tesseract namespace. Fix include order in many places. 2020-12-26 00:55:30 +03:00
Stefan Weil
65b11a1e12 Pack class SVMenuNode
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-11-26 17:17:27 +01:00
zdenop
875bd48bd5
Merge pull request #3058 from stweil/scrollview
Disable more code and data with GRAPHICS_DISABLED
2020-07-11 09:11:27 +02:00
Stefan Weil
548a832b98 Use strtok_s for MSVC in class SVNetwork
strtok_s can be used with MSVC as a replacement for strtok_r, so less
special handling is needed in the code and class SVNetwork can be
made smaller by removing member has_content.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-10 17:47:05 +02:00
Stefan Weil
cb3880fb15 Disable more code and data with GRAPHICS_DISABLED
Some runtime parameters which are only relevant with graphics enabled
were now removed from builds when graphics was disabled.

TableFinder::DisplayColSegmentGrid is never used, so remove it completely.

Builds with --disable-graphics significantly reduce the code size and avoid
some function calls which might be important for certain applications:

   text	   data	    bss	    dec	    hex	filename
3219230	  41136	  13920	3274286	 31f62e	.libs/libtesseract.so (--disable-graphics, old)
3211347	  40976	  13600	3265923	 31d583	.libs/libtesseract.so (--disable-graphics, new)
3360942	  43656	  15392	3419990	 342f56	.libs/libtesseract.so (default)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-09 11:23:33 +02:00
Stefan Weil
62b085cb8d ScrollView: Remove C API callcpp.{cpp,h}
Use C++ class ScrollView directly instead of using an intermediate C API.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-22 09:14:26 +02:00
Stefan Weil
d6ca7a5298 ScrollView: Fix typo in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-17 16:26:41 +02:00
Stefan Weil
cbd3a21cb2 automake: Flat build for src/viewer and src/wordrec
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-26 16:20:46 +01:00
Egor Pugin
2a37f5dd62 Update includes to use <>. 2019-10-29 14:50:11 +03:00
amitdo
2f8884a64e Fix autotools build 2019-10-28 21:23:58 +02:00
amitdo
e1bae15547 Fix #include path of public headers 2019-10-28 19:10:30 +02:00
Stefan Weil
994ec697d8 Remove member functions STRING::string and StringParam::string
They were redundant because there exist member functions 'c_str' which do the same.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-09-23 08:33:08 +02:00
Stefan Weil
06de3075e0 Fix CID 1164636 (Uninitialized pointer field)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-09-14 17:13:06 +02:00
Stefan Weil
c8cb925813 Remove non portable sleep by std::this_thread::sleep_for
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 16:00:07 +02:00
Stefan Weil
ba0c55adc5 svutil: Remove SVSync::StartThread and SVSync::ExitThread
Both are unused now.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:30:51 +02:00
Stefan Weil
43a281893f scrollview: Replace SVSync::StartThread by std::thread
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:30:51 +02:00
Stefan Weil
13bb4623b1 Use std::lock_guard to protect a code block
This is simpler than using lock() / unlock() explicitly.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 12:01:28 +02:00
Stefan Weil
93427391c1 Replace SVAutoLock by std::lock_guard
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 12:01:28 +02:00
Stefan Weil
36026e3c35 Replace SVMutex by std::mutex
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 12:01:28 +02:00
zhuangzhuang1988
4d4c16bce1 fix start ScrollView.jar failed when lstmtraining 2019-07-03 07:27:50 +02:00
Stefan Weil
a86143a41d Remove some unused functions, constants and variables
This fixes compiler warnings, for example:

    src/ccutil/strngs.cpp:36:11: warning: unused variable 'kMaxDoubleSize' [-Wunused-const-variable]
    src/viewer/svutil.cpp:320:13: warning: unused function 'TessFreeAddrInfo' [-Wunused-function]
    src/ccstruct/werd.cpp:32:19: warning: unused variable 'CANT_SCALE_EDGESTEPS' [-Wunused-const-variable]
    src/textord/bbgrid.cpp:103:10: warning: unused variable 'old_tright' [-Wunused-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-26 11:52:31 +02:00
Stefan Weil
c07bc4e014 Fix Doxygen comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-12 08:55:23 +02:00
zdenop
7a5b9b8fcd ScrollView: remove custom implementation of GetAddrInfo 2019-05-04 15:16:41 +02:00
Zdenko Podobný
80e54e401d fix spelling 2019-04-24 15:35:22 +02:00
Zdenko Podobný
832c257771 remove unused variable 2019-04-24 14:55:35 +02:00
Stefan Weil
b7bc71e987 Fix build for Windows
* winsock2.h is case sensitive, lower case is required for cross build.
* ws2tcpip.h is required for addrinfo.
* FreeAddrInfo conflicts with existing freeaddrinfo, so rename it.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-24 11:24:47 +02:00
zdenop
129fe95390 svutil.cpp: fix windows build 2019-04-23 23:03:28 +02:00
Stefan Weil
3bd61bfae4 svutil: Clean include file
* Remove MIN, MAX macros. They are unused.
* Include windows.h indirectly by including host.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-22 21:51:07 +02:00
zdenop
95a15a7a82 fix cmake&clang build 2019-04-06 15:31:53 +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
Stefan Weil
ed011670c8 Modernize C++ code using bool literals
The modifications were done using this command:

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

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-26 07:58:02 +01: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
8ad0489f0f Remove svpaint.cpp from libtesseract
svpaint is a standalone application (it includes a main function)
and should not be part of the Tesseract library.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-12 12:22:53 +01:00
Stefan Weil
33f6dc2a67 Fix compiler warnings (-Wformat-truncation=)
gcc warnings:

    src/viewer/scrollview.cpp:404:31: warning: ‘%s’ directive output may be
        truncated writing up to 4095 bytes into a region of size between 4084 and 4093 [-Wformat-truncation=]
    src/viewer/scrollview.cpp:572:31: warning: ‘%s’ directive output may be
        truncated writing up to 4095 bytes into a region of size between 4084 and 4093 [-Wformat-truncation=]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-02-09 16:32:20 +01:00
zdenop
cbef2ebe12 implement patches vcpkg tesseract 2018-11-08 21:37:47 +01:00
Stefan Weil
34a89e54db Fix function ScrollViewCommand
The format string which builds the command only takes one or two
string arguments, so the function allocated too much memory and
passed too many arguments to snprintf.

This also fixes a compiler warning (clang).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-21 08:13:16 +02:00
Stefan Weil
b0ace0e850 ScrollView: Optimize local table_colors
It is constant, and the values are in the range 0...255,
so its size can be reduced.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-20 12:05:38 +02:00
Stefan Weil
5fb461a563 SVNetwork: Handle failed socket call (CID 1164597)
This fixes a warning from Coverity Scan.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-16 16:53:24 +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