Skip to content

Commit

Permalink
WERD_RES: Remove comparisons which are constant
Browse files Browse the repository at this point in the history
This fixes warnings from LGTM:

Comparison is always false because id >= 0.
Comparison is always true because mirrored >= 1.
Comparison is always false because id >= 0.

INVALID_UNICHAR_ID is -1, so the warnings are correct.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 6, 2018
1 parent 238c872 commit 18f7ab7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ccstruct/pageres.h
Expand Up @@ -363,10 +363,10 @@ class WERD_RES : public ELIST_LINK {
blob_index >= best_choice->length())
return nullptr;
UNICHAR_ID id = best_choice->unichar_id(blob_index);
if (id < 0 || id >= uch_set->size() || id == INVALID_UNICHAR_ID)
if (id < 0 || id >= uch_set->size())
return nullptr;
UNICHAR_ID mirrored = uch_set->get_mirror(id);
if (in_rtl_context && mirrored > 0 && mirrored != INVALID_UNICHAR_ID)
if (in_rtl_context && mirrored > 0)
id = mirrored;
return uch_set->id_to_unichar_ext(id);
}
Expand All @@ -375,7 +375,7 @@ class WERD_RES : public ELIST_LINK {
if (blob_index < 0 || blob_index >= raw_choice->length())
return nullptr;
UNICHAR_ID id = raw_choice->unichar_id(blob_index);
if (id < 0 || id >= uch_set->size() || id == INVALID_UNICHAR_ID)
if (id < 0 || id >= uch_set->size())
return nullptr;
return uch_set->id_to_unichar(id);
}
Expand Down

0 comments on commit 18f7ab7

Please sign in to comment.