From ea446b1eaef6310a8cd6617f6f2e99cfc682a52d Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 26 Feb 2021 10:56:42 +0100 Subject: [PATCH] Remove blanks at line endings Signed-off-by: Stefan Weil --- .github/workflows/autotools.yml | 10 ++--- .github/workflows/cmake.yml | 42 ++++++++++---------- .github/workflows/sw.yml | 10 ++--- .github/workflows/unittest-disablelegacy.yml | 16 ++++---- .github/workflows/unittest.yml | 14 +++---- .github/workflows/vcpkg.yml | 26 ++++++------ .travis.yml | 5 +-- doc/tesseract.natvis | 6 +-- src/api/hocrrenderer.cpp | 2 +- src/api/tesseractmain.cpp | 8 ++-- src/ccmain/ltrresultiterator.cpp | 2 +- unittest/third_party/utf/rune.c | 10 ++--- unittest/third_party/utf/utf.h | 8 ++-- 13 files changed, 79 insertions(+), 80 deletions(-) diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index b4f258ae..d700c442 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -172,12 +172,12 @@ jobs: if: startsWith(matrix.config.cxx, 'clang') run: | make check - + - name: Make and run Unit Tests (unset LANG needed for g++-8, g++-9, g++-10 on macOS) if: startsWith(matrix.config.cxx, 'g') shell: bash run: | - unset LANG LC_ALL LC_CTYPE + unset LANG LC_ALL LC_CTYPE locale make check @@ -220,7 +220,7 @@ jobs: run: | cat test-suite.log if: always() - + # ============================================================================================ ports: @@ -299,7 +299,7 @@ jobs: tesseract test/testing/hebrew.png - -l heb --oem 1 --tessdata-dir ../tessdata tesseract test/testing/eurotext.tif - -l fra --oem 1 --tessdata-dir ../tessdata_best tesseract test/testing/arabic.tif - -l ara --oem 1 --psm 6 --tessdata-dir ../tessdata - + - name: Run Tesseract basicapitest run: | export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig" @@ -317,4 +317,4 @@ jobs: run: | cat test-suite.log if: always() - \ No newline at end of file + diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 95388f68..acd371c5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -14,40 +14,40 @@ jobs: fail-fast: false matrix: config: - + - { name: macos-10.15-clang-12-cmake, os: macos-10.15, cxx: clang++ } # defualt - { name: macos-10.15-clang-11-cmake, os: macos-10.15, cxx: '$(brew --prefix llvm)/bin/clang++' } #installed - { name: macos-10.15-gcc-8-cmake, os: macos-10.15, cxx: g++-8 } #installed - { name: macos-10.15-gcc-9-cmake, os: macos-10.15, cxx: g++-9 } #installed - { name: macos-10.15-gcc-10-cmake, os: macos-10.15, cxx: g++-10 } #installed - + - { name: ubuntu-18.04-clang-7-cmake, os: ubuntu-18.04, cxx: clang++-7 } - { name: ubuntu-18.04-clang-8-cmake, os: ubuntu-18.04, cxx: clang++-8 } #installed - { name: ubuntu-18.04-clang-9-cmake, os: ubuntu-18.04, cxx: clang++-9 } #installed - { name: ubuntu-18.04-clang-10-cmake, os: ubuntu-18.04, cxx: clang++-10 } - + - { name: ubuntu-18.04-gcc-7-cmake, os: ubuntu-18.04, cxx: g++-7 } #installed - { name: ubuntu-18.04-gcc-8-cmake, os: ubuntu-18.04, cxx: g++-8 } #installed - { name: ubuntu-18.04-gcc-9-cmake, os: ubuntu-18.04, cxx: g++-9 } #installed - { name: ubuntu-18.04-gcc-10-cmake, os: ubuntu-18.04, cxx: g++-10 } #installed - + - { name: ubuntu-20.04-clang-7-cmake, os: ubuntu-20.04, cxx: clang++-7 } - { name: ubuntu-20.04-clang-8-cmake, os: ubuntu-20.04, cxx: clang++-8 } #installed - { name: ubuntu-20.04-clang-9-cmake, os: ubuntu-20.04, cxx: clang++-9 } #installed - { name: ubuntu-20.04-clang-10-cmake, os: ubuntu-20.04, cxx: clang++-10 } #installed - + - { name: ubuntu-20.04-gcc-7-cmake, os: ubuntu-20.04, cxx: g++-7 } #installed - { name: ubuntu-20.04-gcc-8-cmake, os: ubuntu-20.04, cxx: g++-8 } #installed - { name: ubuntu-20.04-gcc-9-cmake, os: ubuntu-20.04, cxx: g++-9 } #installed - { name: ubuntu-20.04-gcc-10-cmake, os: ubuntu-20.04, cxx: g++-10 } #installed - + steps: - name: Install compilers on Linux run: | sudo apt-get install ${{ matrix.config.cxx }} -y if: runner.os == 'Linux' - -# sudo apt-get install libarchive-dev libcurl4-openssl-dev libcurl4 curl -y + +# sudo apt-get install libarchive-dev libcurl4-openssl-dev libcurl4 curl -y - name: Install dependencies on Linux run: | sudo apt-get install autoconf-archive libleptonica-dev -y @@ -66,12 +66,12 @@ jobs: ninja --version cmake --version if: runner.os == 'macOS' - + - name: Checkout Source uses: actions/checkout@v2 with: submodules: recursive - + - name: Configure Tesseract (Linux) run: | mkdir build @@ -102,32 +102,32 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \ -DCMAKE_INSTALL_PREFIX:PATH=inst if: runner.os == 'macOS' - + - name: Build Tesseract run: | cmake --build build --config Release --target install - + - name: Display Tesseract Version run: | build/inst/bin/tesseract -v - + - name: Display Training Tools Version run: | build/inst/bin/lstmtraining -v build/inst/bin/text2image -v - + - name: Download fonts, tessdata and langdata required for tests run: | git clone https://github.com/egorpugin/tessdata tessdata_unittest - cp tessdata_unittest/fonts/* test/testing/ + cp tessdata_unittest/fonts/* test/testing/ mv tessdata_unittest/* ../ - + - name: List languages in different tessdata-dir run: | build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata_best build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata_fast - + - name: Run Tesseract on test images in different languages run: | build/inst/bin/tesseract test/testing/phototest.tif - --oem 1 --tessdata-dir ../tessdata @@ -136,17 +136,17 @@ jobs: build/inst/bin/tesseract test/testing/hebrew.png - -l heb --oem 1 --tessdata-dir ../tessdata build/inst/bin/tesseract test/testing/eurotext.tif - -l fra --oem 1 --tessdata-dir ../tessdata_best build/inst/bin/tesseract test/testing/arabic.tif - -l ara --oem 1 --psm 6 --tessdata-dir ../tessdata - + - name: Build and run basicapitest run: | export "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build/inst/lib/pkgconfig/:$PKG_CONFIG_PATH" cd test - ${{ matrix.config.cxx }} -o basicapitest testing/basicapitest.cpp "-I$GITHUB_WORKSPACE/build/inst/include" "-L$GITHUB_WORKSPACE/build/inst/lib" `pkg-config --cflags --libs tesseract lept ` -pthread -std=c++11 + ${{ matrix.config.cxx }} -o basicapitest testing/basicapitest.cpp "-I$GITHUB_WORKSPACE/build/inst/include" "-L$GITHUB_WORKSPACE/build/inst/lib" `pkg-config --cflags --libs tesseract lept ` -pthread -std=c++11 ./basicapitest - + - name: Display Compiler Version run: | ${{ matrix.config.cxx }} --version - git log -3 --pretty=format:'%h %ad %s | %an' + git log -3 --pretty=format:'%h %ad %s | %an' if: always() diff --git a/.github/workflows/sw.yml b/.github/workflows/sw.yml index 193150e3..e755052c 100644 --- a/.github/workflows/sw.yml +++ b/.github/workflows/sw.yml @@ -15,7 +15,7 @@ jobs: matrix: os: [windows-latest, ubuntu-20.04, macOS-latest] - steps: + steps: - uses: actions/checkout@v2 with: submodules: recursive @@ -31,21 +31,21 @@ jobs: - name: download test data run: git clone https://github.com/egorpugin/tessdata tessdata_unittest - + - name: copy fonts if: matrix.os != 'windows-latest' run: cp tessdata_unittest/fonts/* test/testing/ - + - name: copy fonts if: matrix.os == 'windows-latest' run: Copy-Item -Path "tessdata_unittest\fonts\*" -Destination "test\testing" -Recurse shell: pwsh - + - name: test if: matrix.os != 'windows-latest' run: ./sw -static -shared -config "d,r" test -Dwith-tests=1 "-Dskip-tests=lstm,lstm_recode" continue-on-error: true - + - name: test-nightly if: matrix.os != 'windows-latest' && github.event.schedule=='0 0 * * *' run: ./sw -static -shared -config "d,r" test -Dwith-tests=1 diff --git a/.github/workflows/unittest-disablelegacy.yml b/.github/workflows/unittest-disablelegacy.yml index cc3ab917..a7281209 100644 --- a/.github/workflows/unittest-disablelegacy.yml +++ b/.github/workflows/unittest-disablelegacy.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - + - name: Install dependencies run: | sudo apt-get install autoconf-archive libleptonica-dev libpango1.0-dev -y @@ -34,7 +34,7 @@ jobs: - name: Configure run: | ./configure '--disable-shared' '--disable-legacy' 'CXX=${{ matrix.compiler }}' - + - name: Make and Install Tesseract run: | make -j 8 @@ -44,7 +44,7 @@ jobs: run: | make training -j 8 sudo make install training-install - + - name: Display Version run: | ${{ matrix.compiler }} --version @@ -52,13 +52,13 @@ jobs: lstmtraining -v text2image -v if: success() || failure() - + - name: Download fonts, tessdata and langdata required for tests run: | git clone https://github.com/egorpugin/tessdata tessdata_unittest - cp tessdata_unittest/fonts/* test/testing/ + cp tessdata_unittest/fonts/* test/testing/ mv tessdata_unittest/* ../ - + - name: Run Tesseract on phototest.tif and devatest.png run: | tesseract test/testing/phototest.tif - --tessdata-dir ../tessdata @@ -67,10 +67,10 @@ jobs: - name: Make and run Unit Tests run: | make check -j 4 - + - name: Display Unit Tests Report run: | git log -3 - ${{ matrix.compiler }} --version + ${{ matrix.compiler }} --version cat test-suite.log if: always() diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 7e9b1e27..1a65d3d6 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -38,7 +38,7 @@ jobs: brew install leptonica cairo pango brew install cabextract abseil if: runner.os == 'macOS' - + - name: Setup run: | mkdir -p m4 @@ -68,7 +68,7 @@ jobs: run: | make training -j 8 sudo make training-install - + - name: Display Version run: | ${{ matrix.config.cxx }} --version @@ -76,13 +76,13 @@ jobs: lstmtraining -v text2image -v if: success() || failure() - + - name: Download fonts, tessdata and langdata required for tests run: | git clone https://github.com/egorpugin/tessdata tessdata_unittest - cp tessdata_unittest/fonts/* test/testing/ + cp tessdata_unittest/fonts/* test/testing/ mv tessdata_unittest/* ../ - + - name: Run Tesseract on phototest.tif and devatest.png run: | tesseract test/testing/phototest.tif - --tessdata-dir ../tessdata @@ -91,10 +91,10 @@ jobs: - name: Make and run Unit Tests run: | make check -j 4 - + - name: Display Unit Tests Report run: | cat test-suite.log ${{ matrix.config.cxx }} --version - git log -3 --pretty=format:'%h %ad %s | %an' + git log -3 --pretty=format:'%h %ad %s | %an' if: always() diff --git a/.github/workflows/vcpkg.yml b/.github/workflows/vcpkg.yml index c23fb997..a73e6832 100644 --- a/.github/workflows/vcpkg.yml +++ b/.github/workflows/vcpkg.yml @@ -4,26 +4,26 @@ on: #push: schedule: - cron: 0 23 * * * - -jobs: + +jobs: build: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [windows-2019] - + steps: - name: Checkout Tesseract Source (--head from master branch) uses: actions/checkout@v2 with: submodules: recursive - - name: Visual Studio Setup + - name: Visual Studio Setup shell: cmd run: | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - + - name: Install vcpkg run: | git clone https://github.com/microsoft/vcpkg @@ -33,13 +33,13 @@ jobs: - name: Build and Install Leptonica and image libraries using vcpkg run: | vcpkg/vcpkg install leptonica:x64-windows - + - name: Configure and Build Tesseract (--head from master branch) with cmake run: | - cmake . -B build -DCMAKE_BUILD_TYPE=Release -DSW_BUILD=OFF -DOPENMP_BUILD=OFF -DBUILD_TRAINING_TOOLS=OFF "-DCMAKE_TOOLCHAIN_FILE=${env:GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake" + cmake . -B build -DCMAKE_BUILD_TYPE=Release -DSW_BUILD=OFF -DOPENMP_BUILD=OFF -DBUILD_TRAINING_TOOLS=OFF "-DCMAKE_TOOLCHAIN_FILE=${env:GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake" cmake --build build --config Release --target install - - - name: Display Tesseract Version + + - name: Display Tesseract Version run: | D:\a\tesseract\tesseract\build\bin\Release\tesseract.exe --version @@ -62,17 +62,17 @@ jobs: target_link_libraries(basicapitest libtesseract) EOF cat CMakeLists.txt - + - name: Configure basicapitest run: | cd test cmake . "-DCMAKE_TOOLCHAIN_FILE=${env:GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake" - + - name: Build basicapitest run: | cd test cmake --build . --config Release - + - name: Download tessdata and image files used for tests run: | git clone https://github.com/egorpugin/tessdata tessdata_unittest @@ -91,7 +91,7 @@ jobs: D:\a\tesseract\tesseract\build\bin\Release\tesseract.exe test\testing\hebrew.png - -l heb --oem 1 --tessdata-dir ..\tessdata D:\a\tesseract\tesseract\build\bin\Release\tesseract.exe test\testing\eurotext.tif - -l fra --oem 1 --tessdata-dir ..\tessdata_best D:\a\tesseract\tesseract\build\bin\Release\tesseract.exe test\testing\arabic.tif - -l ara --oem 1 --psm 6 --tessdata-dir ..\tessdata - + - name: List languages in different test tessdata-dir run: | D:\a\tesseract\tesseract\build\bin\Release\tesseract.exe --list-langs --tessdata-dir ..\tessdata diff --git a/.travis.yml b/.travis.yml index 90a44778..96cd0eef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ matrix: ccache: true directories: - $HOME/Library/Caches/Homebrew - before_install: + before_install: - brew install ccache install: - brew install ninja libtiff leptonica libarchive pango cairo icu4c @@ -33,7 +33,7 @@ matrix: -G Ninja \ -DCMAKE_INSTALL_PREFIX:PATH=inst cmake --build build --config Release --target install - + - os: linux dist: bionic addons: @@ -57,4 +57,3 @@ matrix: - cmake .. -DLeptonica_DIR=leptonica-$LEPT_VER/build -DSW_BUILD=OFF - make - sudo make install - \ No newline at end of file diff --git a/doc/tesseract.natvis b/doc/tesseract.natvis index 882163a3..c5b1a771 100644 --- a/doc/tesseract.natvis +++ b/doc/tesseract.natvis @@ -1,4 +1,4 @@ - + {(char*)data_+sizeof(int)*2,s8} @@ -15,7 +15,7 @@ - + {value_} @@ -30,5 +30,5 @@ {value_} - + diff --git a/src/api/hocrrenderer.cpp b/src/api/hocrrenderer.cpp index f4504da9..00ef3b68 100644 --- a/src/api/hocrrenderer.cpp +++ b/src/api/hocrrenderer.cpp @@ -403,7 +403,7 @@ char* TessBaseAPI::GetHOCRText(ETEXT_DESC* monitor, int page_number) { tcnt++; } } - } + } // Close ocrx_word. if (hocr_boxes || lstm_choice_mode > 0) { hocr_str << "\n "; diff --git a/src/api/tesseractmain.cpp b/src/api/tesseractmain.cpp index 35d2f447..7535d40f 100644 --- a/src/api/tesseractmain.cpp +++ b/src/api/tesseractmain.cpp @@ -76,13 +76,13 @@ static void Win32WarningHandler(const char* module, const char* fmt, class AutoWin32ConsoleOutputCP { public: explicit AutoWin32ConsoleOutputCP(UINT codeCP) { - oldCP_ = GetConsoleOutputCP(); + oldCP_ = GetConsoleOutputCP(); SetConsoleOutputCP(codeCP); } - ~AutoWin32ConsoleOutputCP() { - SetConsoleOutputCP(oldCP_); + ~AutoWin32ConsoleOutputCP() { + SetConsoleOutputCP(oldCP_); } - private: + private: UINT oldCP_; }; diff --git a/src/ccmain/ltrresultiterator.cpp b/src/ccmain/ltrresultiterator.cpp index 7d7acd08..80973690 100644 --- a/src/ccmain/ltrresultiterator.cpp +++ b/src/ccmain/ltrresultiterator.cpp @@ -385,7 +385,7 @@ ChoiceIterator::ChoiceIterator(const LTRResultIterator& result_it) { bool lstm_choice_mode = word_res_->tesseract->lstm_choice_mode; rating_coefficient_ = word_res_->tesseract->lstm_rating_coefficient; blanks_before_word_ = result_it.BlanksBeforeWord(); - BLOB_CHOICE_LIST* choices = nullptr; + BLOB_CHOICE_LIST* choices = nullptr; tstep_index_ = &result_it.blob_index_; if (oemLSTM_ && !word_res_->CTC_symbol_choices.empty()) { if (!word_res_->CTC_symbol_choices[0].empty() && diff --git a/unittest/third_party/utf/rune.c b/unittest/third_party/utf/rune.c index 3d860570..af1bafbf 100644 --- a/unittest/third_party/utf/rune.c +++ b/unittest/third_party/utf/rune.c @@ -23,7 +23,7 @@ enum Bit2 = 5, Bit3 = 4, Bit4 = 3, - Bit5 = 2, + Bit5 = 2, T1 = ((1<<(Bit1+1))-1) ^ 0xFF, /* 0000 0000 */ Tx = ((1<<(Bitx+1))-1) ^ 0xFF, /* 1000 0000 */ @@ -46,9 +46,9 @@ enum /* * Modified by Wei-Hwa Huang, Google Inc., on 2004-09-24 - * This is a slower but "safe" version of the old chartorune + * This is a slower but "safe" version of the old chartorune * that works on strings that are not necessarily null-terminated. - * + * * If you know for sure that your string is null-terminated, * chartorune will be a bit faster. * @@ -162,7 +162,7 @@ badlen: /* - * This is the older "unsafe" version, which works fine on + * This is the older "unsafe" version, which works fine on * null-terminated strings. */ int @@ -248,7 +248,7 @@ isvalidcharntorune(const char* str, int length, Rune* rune, int* consumed) { *consumed = charntorune(rune, str, length); return *rune != Runeerror || *consumed == 3; } - + int runetochar(char *str, const Rune *rune) { diff --git a/unittest/third_party/utf/utf.h b/unittest/third_party/utf/utf.h index 06982e58..7d8cf547 100644 --- a/unittest/third_party/utf/utf.h +++ b/unittest/third_party/utf/utf.h @@ -66,7 +66,7 @@ int chartorune(Rune* r, const char* s); // n bytes of s. If the UTF sequence is incomplete within n bytes, // charntorune will set *r to Runeerror and return 0. If it is complete // but not in UTF format, it will set *r to Runeerror and return 1. -// +// // Added 2004-09-24 by Wei-Hwa Huang int charntorune(Rune* r, const char* s, int n); @@ -150,7 +150,7 @@ char* utfecpy(char *s1, char *es1, const char *s2); // These functions are rune-string analogues of the corresponding // functions in strcat (3). -// +// // These routines first appeared in Plan 9. // SEE ALSO // memmove (3) @@ -203,8 +203,8 @@ Rune totitlerune(Rune r); // isupperrune tests for upper case characters, including Unicode // upper case letters and targets of the toupper mapping. islowerrune -// and istitlerune are defined analogously. - +// and istitlerune are defined analogously. + int isupperrune(Rune r); int islowerrune(Rune r); int istitlerune(Rune r);