From 223f3560270f0cfaf55539532bc3edfd4f1feb22 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 16 Mar 2021 19:01:08 +0100 Subject: [PATCH] Fix alerts reported by LGTM They were caused by recent commits which replaced GenericVector by std::vector. Signed-off-by: Stefan Weil --- src/ccmain/applybox.cpp | 2 +- src/ccmain/equationdetect.cpp | 4 ++-- src/ccmain/paragraphs.cpp | 4 ++-- src/dict/dict.cpp | 2 +- src/textord/baselinedetect.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ccmain/applybox.cpp b/src/ccmain/applybox.cpp index 0f3e7773b..b7bc940b3 100644 --- a/src/ccmain/applybox.cpp +++ b/src/ccmain/applybox.cpp @@ -634,7 +634,7 @@ void Tesseract::SearchForText(const std::vector *choices, in if (choices_pos + length == choices_length && text_index + 1 == target_text.size()) { // This is a complete match. If the rating is good record a new best. if (applybox_debug > 2) { - tprintf("Complete match, rating = %g, best=%g, seglength=%d, best=%d\n", + tprintf("Complete match, rating = %g, best=%g, seglength=%zu, best=%zu\n", rating + choice_rating, *best_rating, segmentation->size(), best_segmentation->size()); } diff --git a/src/ccmain/equationdetect.cpp b/src/ccmain/equationdetect.cpp index 0f5073b50..6cf360784 100644 --- a/src/ccmain/equationdetect.cpp +++ b/src/ccmain/equationdetect.cpp @@ -624,8 +624,8 @@ void EquationDetect::SplitCPHor(ColPartition *part, std::vector // Make a copy of part, and reset parts_splitted. ColPartition *right_part = part->CopyButDontOwnBlobs(); - for (auto part : *parts_splitted) { - delete part; + for (auto data : *parts_splitted) { + delete data; } parts_splitted->clear(); diff --git a/src/ccmain/paragraphs.cpp b/src/ccmain/paragraphs.cpp index 40240ab3d..5f9143e3c 100644 --- a/src/ccmain/paragraphs.cpp +++ b/src/ccmain/paragraphs.cpp @@ -74,7 +74,7 @@ static bool AcceptableRowArgs(int debug_level, int min_num_rows, const char *fun const std::vector *rows, int row_start, int row_end) { if (row_start < 0 || row_end > rows->size() || row_start > row_end) { - tprintf("Invalid arguments rows[%d, %d) while rows is of size %d.\n", row_start, row_end, + tprintf("Invalid arguments rows[%d, %d) while rows is of size %zu.\n", row_start, row_end, rows->size()); return false; } @@ -877,7 +877,7 @@ struct GeometricClassifierState { if (debug_level >= 3) { tprintf( "Geometry: TabStop cluster tolerance = %d; " - "%d left tabs; %d right tabs\n", + "%zu left tabs; %zu right tabs\n", tolerance, left_tabs.size(), right_tabs.size()); } ltr = (*r)[r_start].ri_->ltr; diff --git a/src/dict/dict.cpp b/src/dict/dict.cpp index 122083f5d..f3948ae83 100644 --- a/src/dict/dict.cpp +++ b/src/dict/dict.cpp @@ -400,7 +400,7 @@ int Dict::def_letter_is_okay(void *void_dawg_args, const UNICHARSET &unicharset, if (dawg_debug_level >= 3) { tprintf( "def_letter_is_okay: current unichar=%s word_end=%d" - " num active dawgs=%d\n", + " num active dawgs=%zu\n", getUnicharset().debug_str(unichar_id).c_str(), word_end, dawg_args->active_dawgs->size()); } diff --git a/src/textord/baselinedetect.cpp b/src/textord/baselinedetect.cpp index 44144904c..e272255e6 100644 --- a/src/textord/baselinedetect.cpp +++ b/src/textord/baselinedetect.cpp @@ -629,7 +629,7 @@ bool BaselineBlock::ComputeLineSpacing() { } } if (debug_level_ > 0) { - tprintf("Spacing %g, in %d rows, %d gaps fitted out of %d non-trivial\n", line_spacing_, + tprintf("Spacing %g, in %zu rows, %d gaps fitted out of %d non-trivial\n", line_spacing_, row_positions.size(), fitting_gaps, non_trivial_gaps); } return fitting_gaps > non_trivial_gaps * kMinFittingLinespacings;