Skip to content

Commit 6ff0b56

Browse files
committed
More fixes BOOL8 -> bool
1 parent 6f580ba commit 6ff0b56

29 files changed

+244
-248
lines changed

src/ccmain/adaptions.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
#endif
3838

3939
namespace tesseract {
40-
BOOL8 Tesseract::word_adaptable( //should we adapt?
41-
WERD_RES *word,
42-
uint16_t mode) {
40+
bool Tesseract::word_adaptable( //should we adapt?
41+
WERD_RES* word,
42+
uint16_t mode) {
4343
if (tessedit_adaption_debug) {
4444
tprintf("Running word_adaptable() for %s rating %.4f certainty %.4f\n",
4545
word->best_choice == nullptr ? "" :
@@ -65,7 +65,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
6565
*/
6666
if (mode == 0) {
6767
if (tessedit_adaption_debug) tprintf("adaption disabled\n");
68-
return FALSE;
68+
return false;
6969
}
7070

7171
if (flags.bit (ADAPTABLE_WERD)) {
@@ -83,7 +83,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
8383
}
8484

8585
if (!status) { // If not set then
86-
return FALSE; // ignore other checks
86+
return false; // ignore other checks
8787
}
8888

8989
if (flags.bit (CHECK_DAWGS) &&
@@ -92,24 +92,24 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
9292
(word->best_choice->permuter () != USER_DAWG_PERM) &&
9393
(word->best_choice->permuter () != NUMBER_PERM)) {
9494
if (tessedit_adaption_debug) tprintf("word not in dawgs\n");
95-
return FALSE;
95+
return false;
9696
}
9797

9898
if (flags.bit (CHECK_ONE_ELL_CONFLICT) && one_ell_conflict (word, false)) {
9999
if (tessedit_adaption_debug) tprintf("word has ell conflict\n");
100-
return FALSE;
100+
return false;
101101
}
102102

103103
if (flags.bit (CHECK_SPACES) &&
104104
(strchr(word->best_choice->unichar_string().string(), ' ') != nullptr)) {
105105
if (tessedit_adaption_debug) tprintf("word contains spaces\n");
106-
return FALSE;
106+
return false;
107107
}
108108

109109
if (flags.bit (CHECK_AMBIG_WERD) &&
110110
word->best_choice->dangerous_ambig_found()) {
111111
if (tessedit_adaption_debug) tprintf("word is ambiguous\n");
112-
return FALSE;
112+
return false;
113113
}
114114

115115
if (tessedit_adaption_debug) {

src/ccmain/control.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void Tesseract::recog_pseudo_word(PAGE_RES* page_res,
8080
*
8181
* @param pr_it the page results iterator
8282
*/
83-
BOOL8 Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
83+
bool Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
8484
int16_t char_qual;
8585
int16_t good_char_qual;
8686

@@ -101,7 +101,7 @@ BOOL8 Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
101101
word_blob_quality(word_res, pr_it->row()->row),
102102
word_outline_errs(word_res), char_qual, good_char_qual);
103103
}
104-
return TRUE;
104+
return true;
105105
}
106106

107107
// Helper function to check for a target word and handle it appropriately.

src/ccmain/docqual.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
304304
prev_word_rejected &&
305305
page_res_it.prev_row() == page_res_it.row() &&
306306
word->word->space() == 1)
307-
word->reject_spaces = TRUE;
307+
word->reject_spaces = true;
308308
word->reject_map.rej_word_block_rej();
309309
}
310310
prev_word_rejected = rej_word;
@@ -375,7 +375,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
375375
prev_word_rejected &&
376376
page_res_it.prev_row() == page_res_it.row() &&
377377
word->word->space () == 1)
378-
word->reject_spaces = TRUE;
378+
word->reject_spaces = true;
379379
word->reject_map.rej_word_row_rej();
380380
}
381381
prev_word_rejected = rej_word;
@@ -411,7 +411,7 @@ void reject_whole_page(PAGE_RES_IT &page_res_it) {
411411
page_res_it.forward ();
412412
}
413413
//whole page is rejected
414-
page_res_it.page_res->rejected = TRUE;
414+
page_res_it.page_res->rejected = true;
415415
}
416416

417417
namespace tesseract {
@@ -501,8 +501,8 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
501501
}
502502

503503

504-
BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
505-
GARBAGE_LEVEL garbage_level) {
504+
bool Tesseract::terrible_word_crunch(WERD_RES* word,
505+
GARBAGE_LEVEL garbage_level) {
506506
float rating_per_ch;
507507
int adjusted_len;
508508
int crunch_mode = 0;
@@ -533,15 +533,15 @@ BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
533533
tprintf ("Terrible_word_crunch (%d) on \"%s\"\n",
534534
crunch_mode, word->best_choice->unichar_string().string());
535535
}
536-
return TRUE;
536+
return true;
537537
}
538538
else
539-
return FALSE;
539+
return false;
540540
}
541541

542-
BOOL8 Tesseract::potential_word_crunch(WERD_RES *word,
543-
GARBAGE_LEVEL garbage_level,
544-
BOOL8 ok_dict_word) {
542+
bool Tesseract::potential_word_crunch(WERD_RES* word,
543+
GARBAGE_LEVEL garbage_level,
544+
bool ok_dict_word) {
545545
float rating_per_ch;
546546
int adjusted_len;
547547
const char *str = word->best_choice->unichar_string().string();
@@ -975,7 +975,7 @@ int16_t Tesseract::failure_count(WERD_RES *word) {
975975
}
976976

977977

978-
BOOL8 Tesseract::noise_outlines(TWERD *word) {
978+
bool Tesseract::noise_outlines(TWERD* word) {
979979
TBOX box; // BB of outline
980980
int16_t outline_count = 0;
981981
int16_t small_outline_count = 0;

src/ccmain/fixspace.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ void initialise_search(WERD_RES_LIST &src_list, WERD_RES_LIST &new_list) {
184184
src_wd = src_it.data();
185185
if (!src_wd->combination) {
186186
new_wd = WERD_RES::deep_copy(src_wd);
187-
new_wd->combination = FALSE;
188-
new_wd->part_of_combo = FALSE;
187+
new_wd->combination = false;
188+
new_wd->part_of_combo = false;
189189
new_it.add_after_then_move(new_wd);
190190
}
191191
}
@@ -417,7 +417,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
417417
combo = new WERD_RES(copy_word);
418418
combo->combination = TRUE;
419419
combo->x_height = prev_word->x_height;
420-
prev_word->part_of_combo = TRUE;
420+
prev_word->part_of_combo = true;
421421
prev_word_it.add_before_then_move(combo);
422422
}
423423
combo->word->set_flag(W_EOL, word->word->flag(W_EOL));
@@ -429,7 +429,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
429429
} else {
430430
// Copy current wd to combo
431431
combo->copy_on(word);
432-
word->part_of_combo = TRUE;
432+
word->part_of_combo = true;
433433
}
434434
combo->done = FALSE;
435435
combo->ClearResults();
@@ -583,9 +583,9 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
583583
old_word_res = best_perm_it.data();
584584
// Even deep_copy doesn't copy the underlying WERD unless its combination
585585
// flag is true!.
586-
old_word_res->combination = TRUE; // Kludge to force deep copy
586+
old_word_res->combination = true; // Kludge to force deep copy
587587
current_perm_it.add_to_end(WERD_RES::deep_copy(old_word_res));
588-
old_word_res->combination = FALSE; // Undo kludge
588+
old_word_res->combination = false; // Undo kludge
589589

590590
break_noisiest_blob_word(current_perm);
591591

@@ -671,7 +671,7 @@ void Tesseract::break_noisiest_blob_word(WERD_RES_LIST &words) {
671671
}
672672

673673
WERD_RES* new_word_res = new WERD_RES(new_word);
674-
new_word_res->combination = TRUE;
674+
new_word_res->combination = true;
675675
worst_word_it.add_before_then_move(new_word_res);
676676

677677
word_res->ClearResults();

src/ccmain/output.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ int16_t Tesseract::count_alphanums(const WERD_CHOICE &word) {
412412
}
413413

414414

415-
BOOL8 Tesseract::acceptable_number_string(const char *s,
416-
const char *lengths) {
417-
BOOL8 prev_digit = FALSE;
415+
bool Tesseract::acceptable_number_string(const char* s,
416+
const char* lengths) {
417+
bool prev_digit = false;
418418

419419
if (*lengths == 1 && *s == '(')
420420
s++;
@@ -425,21 +425,21 @@ BOOL8 Tesseract::acceptable_number_string(const char *s,
425425

426426
for (; *s != '\0'; s += *(lengths++)) {
427427
if (unicharset.get_isdigit(s, *lengths))
428-
prev_digit = TRUE;
428+
prev_digit = true;
429429
else if (prev_digit &&
430430
(*lengths == 1 && ((*s == '.') || (*s == ',') || (*s == '-'))))
431-
prev_digit = FALSE;
431+
prev_digit = false;
432432
else if (prev_digit && *lengths == 1 &&
433433
(*(s + *lengths) == '\0') && ((*s == '%') || (*s == ')')))
434-
return TRUE;
434+
return true;
435435
else if (prev_digit &&
436436
*lengths == 1 && (*s == '%') &&
437437
(*(lengths + 1) == 1 && *(s + *lengths) == ')') &&
438438
(*(s + *lengths + *(lengths + 1)) == '\0'))
439-
return TRUE;
439+
return true;
440440
else
441-
return FALSE;
441+
return false;
442442
}
443-
return TRUE;
443+
return true;
444444
}
445445
} // namespace tesseract

src/ccmain/pgedit.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ SVMenuNode *Tesseract::build_menu_new() {
302302
* Redisplay page
303303
*/
304304
void Tesseract::do_re_display(
305-
BOOL8 (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it)) {
305+
bool (tesseract::Tesseract::* word_painter)(PAGE_RES_IT* pr_it)) {
306306
int block_count = 1;
307307

308308
image_win->Clear();
@@ -710,7 +710,7 @@ void show_point(PAGE_RES* page_res, float x, float y) {
710710
#endif // GRAPHICS_DISABLED
711711
namespace tesseract {
712712
#ifndef GRAPHICS_DISABLED
713-
BOOL8 Tesseract:: word_blank_and_set_display(PAGE_RES_IT* pr_it) {
713+
bool Tesseract::word_blank_and_set_display(PAGE_RES_IT* pr_it) {
714714
pr_it->word()->word->bounding_box().plot(image_win, ScrollView::BLACK,
715715
ScrollView::BLACK);
716716
return word_set_display(pr_it);
@@ -722,7 +722,7 @@ BOOL8 Tesseract:: word_blank_and_set_display(PAGE_RES_IT* pr_it) {
722722
*
723723
* Normalize word and display in word window
724724
*/
725-
BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
725+
bool Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
726726
WERD_RES* word_res = pr_it->word();
727727
if (word_res->chopped_word == nullptr) {
728728
// Setup word normalization parameters.
@@ -744,7 +744,7 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
744744
color = WERD::NextColor(color);
745745
}
746746
bln_word_window_handle()->Update();
747-
return TRUE;
747+
return true;
748748
}
749749

750750

@@ -754,7 +754,7 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
754754
*
755755
* Display a word according to its display modes
756756
*/
757-
BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
757+
bool Tesseract::word_display(PAGE_RES_IT* pr_it) {
758758
WERD_RES* word_res = pr_it->word();
759759
WERD* word = word_res->word;
760760
TBOX word_bb; // word bounding box
@@ -906,7 +906,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
906906
(ScrollView::Color)((int32_t) editor_image_word_bb_color),
907907
(ScrollView::Color)((int32_t)
908908
editor_image_word_bb_color));
909-
return TRUE;
909+
return true;
910910
}
911911
#endif // GRAPHICS_DISABLED
912912

@@ -915,10 +915,10 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
915915
*
916916
* Dump members to the debug window
917917
*/
918-
BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
918+
bool Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
919919
if (pr_it->block()->block != nullptr) {
920920
tprintf("\nBlock data...\n");
921-
pr_it->block()->block->print(nullptr, FALSE);
921+
pr_it->block()->block->print(nullptr, false);
922922
}
923923
tprintf("\nRow data...\n");
924924
pr_it->row()->row->print(nullptr);
@@ -930,7 +930,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
930930
tprintf("Current blamer debug: %s\n",
931931
word_res->blamer_bundle->debug().string());
932932
}
933-
return TRUE;
933+
return true;
934934
}
935935

936936
#ifndef GRAPHICS_DISABLED
@@ -939,7 +939,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
939939
*
940940
* Display word according to current display mode settings
941941
*/
942-
BOOL8 Tesseract::word_set_display(PAGE_RES_IT* pr_it) {
942+
bool Tesseract::word_set_display(PAGE_RES_IT* pr_it) {
943943
WERD* word = pr_it->word()->word;
944944
word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX));
945945
word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT));

src/ccmain/reject.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -501,17 +501,17 @@ int16_t Tesseract::alpha_count(const char *word,
501501
}
502502

503503

504-
BOOL8 Tesseract::word_contains_non_1_digit(const char *word,
505-
const char *word_lengths) {
504+
bool Tesseract::word_contains_non_1_digit(const char* word,
505+
const char* word_lengths) {
506506
int16_t i;
507507
int16_t offset;
508508

509509
for (i = 0, offset = 0; word[offset] != '\0'; offset += word_lengths[i++]) {
510510
if (unicharset.get_isdigit (word + offset, word_lengths[i]) &&
511511
(word_lengths[i] != 1 || word[offset] != '1'))
512-
return TRUE;
512+
return true;
513513
}
514-
return FALSE;
514+
return false;
515515
}
516516

517517
/*************************************************************************

0 commit comments

Comments
 (0)