Skip to content

Commit

Permalink
Fix issue detected by Coverity Scan
Browse files Browse the repository at this point in the history
CID: 1164533 (Logically dead code)

Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
  • Loading branch information
noahmetzger committed Aug 1, 2018
1 parent d4490af commit 2d96c66
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/ccstruct/ratngs.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/ratngs.h
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/wordrec/language_model.cpp
Expand Up @@ -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()) {
Expand Down

0 comments on commit 2d96c66

Please sign in to comment.