Fix CID 1534943, 1534947, 1534949, 1534955 (Use of auto that causes a copy)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2024-03-09 08:40:01 +01:00
parent 8dfa2dee86
commit bee3b01619

View File

@ -480,8 +480,8 @@ void Tesseract::bigram_correction_pass(PAGE_RES *page_res) {
std::vector<WERD_CHOICE *> overrides_word1;
std::vector<WERD_CHOICE *> overrides_word2;
const auto orig_w1_str = w_prev->best_choice->unichar_string();
const auto orig_w2_str = w->best_choice->unichar_string();
const auto &orig_w1_str = w_prev->best_choice->unichar_string();
const auto &orig_w2_str = w->best_choice->unichar_string();
WERD_CHOICE prev_best(w->uch_set);
{
int w1start, w1end;
@ -555,8 +555,8 @@ void Tesseract::bigram_correction_pass(PAGE_RES *page_res) {
}
continue;
}
const auto new_w1_str = overrides_word1[best_idx]->unichar_string();
const auto new_w2_str = overrides_word2[best_idx]->unichar_string();
const auto &new_w1_str = overrides_word1[best_idx]->unichar_string();
const auto &new_w2_str = overrides_word2[best_idx]->unichar_string();
if (new_w1_str != orig_w1_str) {
w_prev->ReplaceBestChoice(overrides_word1[best_idx]);
}