From 2d96c66126c6b27b18c50308a22f534eeab36842 Mon Sep 17 00:00:00 2001 From: Noah Metzger Date: Wed, 1 Aug 2018 10:27:11 +0200 Subject: [PATCH] Fix issue detected by Coverity Scan CID: 1164533 (Logically dead code) Signed-off-by: Noah Metzger --- src/ccstruct/ratngs.cpp | 7 +------ src/ccstruct/ratngs.h | 2 +- src/wordrec/language_model.cpp | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/ccstruct/ratngs.cpp b/src/ccstruct/ratngs.cpp index 2012d5794..b61cf5529 100644 --- a/src/ccstruct/ratngs.cpp +++ b/src/ccstruct/ratngs.cpp @@ -529,12 +529,7 @@ WERD_CHOICE& WERD_CHOICE::operator=(const WERD_CHOICE& source) { // to get the target positions. If small_caps is true, sub/super are not // considered, but dropcaps are. // NOTE: blobs_list should be the chopped_word blobs. (Fully segemented.) -void WERD_CHOICE::SetScriptPositions(bool small_caps, TWERD* word) { - // Since WERD_CHOICE isn't supposed to depend on a Tesseract, - // we don't have easy access to the flags Tesseract stores. Therefore, debug - // for this module is hard compiled in. - int debug = 0; - +void WERD_CHOICE::SetScriptPositions(bool small_caps, TWERD* word, int debug) { // Initialize to normal. for (int i = 0; i < length_; ++i) script_pos_[i] = tesseract::SP_NORMAL; diff --git a/src/ccstruct/ratngs.h b/src/ccstruct/ratngs.h index 08b0e1092..18b2ac8ce 100644 --- a/src/ccstruct/ratngs.h +++ b/src/ccstruct/ratngs.h @@ -552,7 +552,7 @@ class WERD_CHOICE : public ELIST_LINK { // to get the target positions. If small_caps is true, sub/super are not // considered, but dropcaps are. // NOTE: blobs_list should be the chopped_word blobs. (Fully segemented.) - void SetScriptPositions(bool small_caps, TWERD* word); + void SetScriptPositions(bool small_caps, TWERD* word, int debug = 0); // Sets the script_pos_ member from some source positions with a given length. void SetScriptPositions(const tesseract::ScriptPos* positions, int length); // Sets all the script_pos_ positions to the given position. diff --git a/src/wordrec/language_model.cpp b/src/wordrec/language_model.cpp index 5f11b5c03..cc506a3ee 100644 --- a/src/wordrec/language_model.cpp +++ b/src/wordrec/language_model.cpp @@ -1284,7 +1284,7 @@ void LanguageModel::UpdateBestChoice( return; } if (word_res->chopped_word != nullptr && !word_res->chopped_word->blobs.empty()) - word->SetScriptPositions(false, word_res->chopped_word); + word->SetScriptPositions(false, word_res->chopped_word, language_model_debug_level); // Update and log new raw_choice if needed. if (word_res->raw_choice == nullptr || word->rating() < word_res->raw_choice->rating()) {