Add pragmas which suppress this warning from gcc or clang:
src/ccutil/universalambigs.h:26:5: warning:
string literal of length 170929 exceeds maximum length 65536 that
C++ compilers are required to support [-Woverlength-strings]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
UnicityTable did not provide the [] operator, so add it for this change.
Suggested-by: Egor Pugin <egor.pugin@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
It crashed when running mftraining because unicharset_size in file
"inttemp" was written with 8 bytes instead of 4 bytes.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
mftraining crashed because the returned value was 1 instead of 0
for the first call of UnicityTable::push_back.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
The old code did not work correctly if FClass->font_set.size() was 0.
It created the FontSet fs with size 1 instead of 0.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This allows removing a reinterpret_cast and fixes a runtime error
with sanitizers:
runtime error: call to function
tesseract::MakePotentialClusters(tesseract::ClusteringContext*, tesseract::CLUSTER*, int)
through pointer to incorrect function type 'void (*)(...)'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
The old code did not work with compiler option `-fsanitize=address,undefined`
and caused apiexample_test to run forever with this error message:
Running main() from unittest/third_party/googletest/googletest/src/gtest_main.cc
[==========] Running 4 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 1 test from EuroText
[ RUN ] EuroText.FastLatinOCR
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/debug/safe_iterator.h:608:
In function:
_Safe_iterator<type-parameter-0-0, type-parameter-0-1,
std::bidirectional_iterator_tag>
&__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<tesseract::ObjectCache<tesseract::Dawg>::ReferenceCount
*,
std::__cxx1998::vector<tesseract::ObjectCache<tesseract::Dawg>::ReferenceCount,
std::allocator<tesseract::ObjectCache<tesseract::Dawg>::ReferenceCount>>>,
[...]
That error message was followed by an endless sequence of newlines.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Fixes: cac116dd11 ("Replace more PointerVector by std::vector [...]")
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity Scan reports "Unnecessary object copies can affect performance"
and suggests using the auto keyword with an &.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Tesseract for FreeBSD was built without support for SSE4.1, AVX,
AVX2 or FMA because it uses a different value for `host_cpu`.
Signed-off-by: Stefan Weil <sw@weilnetz.de>