@@ -171,7 +171,6 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor, int32_t word_count, PAGE_R
171171void Tesseract::fix_fuzzy_space_list (WERD_RES_LIST &best_perm, ROW *row, BLOCK *block) {
172172 int16_t best_score;
173173 WERD_RES_LIST current_perm;
174- int16_t current_score;
175174 bool improved = false ;
176175
177176 best_score = eval_word_spacing (best_perm); // default score
@@ -183,7 +182,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK *
183182
184183 while ((best_score != PERFECT_WERDS) && !current_perm.empty ()) {
185184 match_current_words (current_perm, row, block);
186- current_score = eval_word_spacing (current_perm);
185+ int16_t current_score = eval_word_spacing (current_perm);
187186 dump_words (current_perm, current_score, 2 , improved);
188187 if (current_score > best_score) {
189188 best_perm.clear ();
@@ -201,11 +200,10 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK *
201200void initialise_search (WERD_RES_LIST &src_list, WERD_RES_LIST &new_list) {
202201 WERD_RES_IT src_it (&src_list);
203202 WERD_RES_IT new_it (&new_list);
204- WERD_RES *src_wd;
205203 WERD_RES *new_wd;
206204
207205 for (src_it.mark_cycle_pt (); !src_it.cycled_list (); src_it.forward ()) {
208- src_wd = src_it.data ();
206+ WERD_RES * src_wd = src_it.data ();
209207 if (!src_wd->combination ) {
210208 new_wd = WERD_RES::deep_copy (src_wd);
211209 new_wd->combination = false ;
@@ -393,8 +391,6 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
393391 WERD_RES_IT prev_word_it (&words);
394392 WERD_RES *word;
395393 WERD_RES *prev_word;
396- WERD_RES *combo;
397- WERD *copy_word;
398394 int16_t prev_right = -INT16_MAX;
399395 TBOX box;
400396 int16_t gap;
@@ -425,12 +421,13 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
425421 gap = box.left () - prev_right;
426422 if (gap <= min_gap) {
427423 prev_word = prev_word_it.data ();
424+ WERD_RES *combo;
428425 if (prev_word->combination ) {
429426 combo = prev_word;
430427 } else {
431428 /* Make a new combination and insert before
432429 * the first word being joined. */
433- copy_word = new WERD;
430+ auto * copy_word = new WERD;
434431 *copy_word = *(prev_word->word );
435432 // deep copy
436433 combo = new WERD_RES (copy_word);
@@ -546,7 +543,6 @@ void Tesseract::fix_sp_fp_word(WERD_RES_IT &word_res_it, ROW *row, BLOCK *block)
546543 WERD_RES *word_res;
547544 WERD_RES_LIST sub_word_list;
548545 WERD_RES_IT sub_word_list_it (&sub_word_list);
549- int16_t blob_index;
550546 int16_t new_length;
551547 float junk;
552548
@@ -556,7 +552,7 @@ void Tesseract::fix_sp_fp_word(WERD_RES_IT &word_res_it, ROW *row, BLOCK *block)
556552 return ;
557553 }
558554
559- blob_index = worst_noise_blob (word_res, &junk);
555+ auto blob_index = worst_noise_blob (word_res, &junk);
560556 if (blob_index < 0 ) {
561557 return ;
562558 }
@@ -623,7 +619,6 @@ void Tesseract::break_noisiest_blob_word(WERD_RES_LIST &words) {
623619 WERD_RES_IT worst_word_it;
624620 float worst_noise_score = 9999 ;
625621 int worst_blob_index = -1 ; // Noisiest blob of noisiest wd
626- int blob_index; // of wds noisiest blob
627622 float noise_score; // of wds noisiest blob
628623 WERD_RES *word_res;
629624 C_BLOB_IT blob_it;
@@ -636,7 +631,7 @@ void Tesseract::break_noisiest_blob_word(WERD_RES_LIST &words) {
636631 int16_t i;
637632
638633 for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ()) {
639- blob_index = worst_noise_blob (word_it.data (), &noise_score);
634+ auto blob_index = worst_noise_blob (word_it.data (), &noise_score);
640635 if (blob_index > -1 && worst_noise_score > noise_score) {
641636 worst_noise_score = noise_score;
642637 worst_blob_index = blob_index;
@@ -806,7 +801,6 @@ float Tesseract::blob_noise_score(TBLOB *blob) {
806801void fixspace_dbg (WERD_RES *word) {
807802 TBOX box = word->word ->bounding_box ();
808803 const bool show_map_detail = false ;
809- int16_t i;
810804
811805 box.print ();
812806 tprintf (" \" %s\" " , word->best_choice ->unichar_string ().c_str ());
@@ -816,7 +810,7 @@ void fixspace_dbg(WERD_RES *word) {
816810 tprintf (" \n " );
817811 if (show_map_detail) {
818812 tprintf (" \" %s\"\n " , word->best_choice ->unichar_string ().c_str ());
819- for (i = 0 ; word->best_choice ->unichar_string ()[i] != ' \0 ' ; i++) {
813+ for (unsigned i = 0 ; word->best_choice ->unichar_string ()[i] != ' \0 ' ; i++) {
820814 tprintf (" **** \" %c\" ****\n " , word->best_choice ->unichar_string ()[i]);
821815 word->reject_map [i].full_print (debug_fp);
822816 }
0 commit comments