Skip to content

Commit 18f7ab7

Browse files
committed
WERD_RES: Remove comparisons which are constant
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 <[email protected]>
1 parent 238c872 commit 18f7ab7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ccstruct/pageres.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ class WERD_RES : public ELIST_LINK {
363363
blob_index >= best_choice->length())
364364
return nullptr;
365365
UNICHAR_ID id = best_choice->unichar_id(blob_index);
366-
if (id < 0 || id >= uch_set->size() || id == INVALID_UNICHAR_ID)
366+
if (id < 0 || id >= uch_set->size())
367367
return nullptr;
368368
UNICHAR_ID mirrored = uch_set->get_mirror(id);
369-
if (in_rtl_context && mirrored > 0 && mirrored != INVALID_UNICHAR_ID)
369+
if (in_rtl_context && mirrored > 0)
370370
id = mirrored;
371371
return uch_set->id_to_unichar_ext(id);
372372
}
@@ -375,7 +375,7 @@ class WERD_RES : public ELIST_LINK {
375375
if (blob_index < 0 || blob_index >= raw_choice->length())
376376
return nullptr;
377377
UNICHAR_ID id = raw_choice->unichar_id(blob_index);
378-
if (id < 0 || id >= uch_set->size() || id == INVALID_UNICHAR_ID)
378+
if (id < 0 || id >= uch_set->size())
379379
return nullptr;
380380
return uch_set->id_to_unichar(id);
381381
}

0 commit comments

Comments
 (0)