Skip to content

Commit a040bc2

Browse files
committed
Use standard bool instead of BOOL8.
1 parent 6e568b0 commit a040bc2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+981
-1004
lines changed

src/ccmain/adaptions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
9595
return FALSE;
9696
}
9797

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

src/ccmain/control.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ void Tesseract::rejection_passes(PAGE_RES* page_res,
674674
(stats_.doc_good_char_quality /
675675
static_cast<float>(stats_.good_char_count)) : 0.0);
676676
}
677-
BOOL8 good_quality_doc =
677+
bool good_quality_doc =
678678
((page_res->rej_count / static_cast<float>(page_res->char_count)) <=
679679
quality_rej_pc) &&
680680
(stats_.doc_blob_quality / static_cast<float>(page_res->char_count) >=
@@ -1792,20 +1792,20 @@ ACCEPTABLE_WERD_TYPE Tesseract::acceptable_word_string(
17921792
return word_type;
17931793
}
17941794

1795-
BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
1796-
BOOL8 show_map_detail = FALSE;
1795+
bool Tesseract::check_debug_pt(WERD_RES* word, int location) {
1796+
bool show_map_detail = false;
17971797
int16_t i;
17981798

17991799
if (!test_pt)
1800-
return FALSE;
1800+
return false;
18011801

18021802
tessedit_rejection_debug.set_value (FALSE);
18031803
debug_x_ht_level.set_value(0);
18041804

1805-
if (word->word->bounding_box ().contains (FCOORD (test_pt_x, test_pt_y))) {
1805+
if (word->word->bounding_box().contains(FCOORD (test_pt_x, test_pt_y))) {
18061806
if (location < 0)
1807-
return TRUE; // For breakpoint use
1808-
tessedit_rejection_debug.set_value (TRUE);
1807+
return true; // For breakpoint use
1808+
tessedit_rejection_debug.set_value(TRUE);
18091809
debug_x_ht_level.set_value(2);
18101810
tprintf ("\n\nTESTWD::");
18111811
switch (location) {
@@ -1827,7 +1827,7 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
18271827
break;
18281828
case 50:
18291829
tprintf ("classify_word_pass2 - END");
1830-
show_map_detail = TRUE;
1830+
show_map_detail = true;
18311831
break;
18321832
case 60:
18331833
tprintf ("fixspace");
@@ -1849,7 +1849,7 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
18491849
break;
18501850
case 120:
18511851
tprintf ("Write results pass");
1852-
show_map_detail = TRUE;
1852+
show_map_detail = true;
18531853
break;
18541854
}
18551855
if (word->best_choice != nullptr) {
@@ -1868,9 +1868,9 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
18681868
}
18691869
tprintf ("Tess Accepted: %s\n", word->tess_accepted ? "TRUE" : "FALSE");
18701870
tprintf ("Done flag: %s\n\n", word->done ? "TRUE" : "FALSE");
1871-
return TRUE;
1871+
return true;
18721872
} else {
1873-
return FALSE;
1873+
return false;
18741874
}
18751875
}
18761876

src/ccmain/fixspace.cpp

+30-30
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
5555
WERD_RES *word_res;
5656
WERD_RES_LIST fuzzy_space_words;
5757
int16_t new_length;
58-
BOOL8 prevent_null_wd_fixsp; // DON'T process blobless wds
58+
bool prevent_null_wd_fixsp; // DON'T process blobless wds
5959
int32_t word_index; // current word
6060

6161
block_res_it.set_to_list(&page_res->block_res_list);
@@ -108,13 +108,13 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
108108
if (check_debug_pt(word_res, 60))
109109
debug_fix_space_level.set_value(10);
110110
if (word_res->word->cblob_list()->empty())
111-
prevent_null_wd_fixsp = TRUE;
111+
prevent_null_wd_fixsp = true;
112112
word_res = word_res_it_to.forward();
113113
}
114114
if (check_debug_pt(word_res, 60))
115115
debug_fix_space_level.set_value(10);
116116
if (word_res->word->cblob_list()->empty())
117-
prevent_null_wd_fixsp = TRUE;
117+
prevent_null_wd_fixsp = true;
118118
if (prevent_null_wd_fixsp) {
119119
word_res_it_from = word_res_it_to;
120120
} else {
@@ -148,7 +148,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
148148
int16_t best_score;
149149
WERD_RES_LIST current_perm;
150150
int16_t current_score;
151-
BOOL8 improved = FALSE;
151+
bool improved = false;
152152

153153
best_score = eval_word_spacing(best_perm); // default score
154154
dump_words(best_perm, best_score, 1, improved);
@@ -164,7 +164,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
164164
best_perm.clear();
165165
best_perm.deep_copy(&current_perm, &WERD_RES::deep_copy);
166166
best_score = current_score;
167-
improved = TRUE;
167+
improved = true;
168168
}
169169
if (current_score < PERFECT_WERDS)
170170
transform_to_next_perm(current_perm);
@@ -246,15 +246,15 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
246246
int16_t offset;
247247
WERD_RES *word; // current word
248248
int16_t prev_word_score = 0;
249-
BOOL8 prev_word_done = FALSE;
250-
BOOL8 prev_char_1 = FALSE; // prev ch a "1/I/l"?
251-
BOOL8 prev_char_digit = FALSE; // prev ch 2..9 or 0
252-
BOOL8 current_char_1 = FALSE;
253-
BOOL8 current_word_ok_so_far;
249+
bool prev_word_done = false;
250+
bool prev_char_1 = false; // prev ch a "1/I/l"?
251+
bool prev_char_digit = false; // prev ch 2..9 or 0
252+
bool current_char_1 = false;
253+
bool current_word_ok_so_far;
254254
STRING punct_chars = "!\"`',.:;";
255-
BOOL8 prev_char_punct = FALSE;
256-
BOOL8 current_char_punct = FALSE;
257-
BOOL8 word_done = FALSE;
255+
bool prev_char_punct = false;
256+
bool current_char_punct = false;
257+
bool word_done = false;
258258

259259
do {
260260
word = word_res_it.data();
@@ -265,17 +265,17 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
265265
if (prev_word_done)
266266
done_word_count++;
267267
prev_word_score = 0;
268-
prev_char_1 = FALSE;
269-
prev_char_digit = FALSE;
270-
prev_word_done = FALSE;
268+
prev_char_1 = false;
269+
prev_char_digit = false;
270+
prev_word_done = false;
271271
} else {
272272
/*
273273
Can we add the prev word score and potentially count this word?
274274
Yes IF it didn't end in a 1 when the first char of this word is a digit
275275
AND it didn't end in a digit when the first char of this word is a 1
276276
*/
277277
word_len = word->reject_map.length();
278-
current_word_ok_so_far = FALSE;
278+
current_word_ok_so_far = false;
279279
if (!((prev_char_1 && digit_or_numeric_punct(word, 0)) ||
280280
(prev_char_digit && (
281281
(word_done &&
@@ -290,16 +290,16 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
290290
}
291291

292292
if (current_word_ok_so_far) {
293-
prev_word_done = TRUE;
293+
prev_word_done = true;
294294
prev_word_score = word_len;
295295
} else {
296-
prev_word_done = FALSE;
296+
prev_word_done = false;
297297
prev_word_score = 0;
298298
}
299299

300300
/* Add 1 to total score for every joined 1 regardless of context and
301301
rejtn */
302-
for (i = 0, prev_char_1 = FALSE; i < word_len; i++) {
302+
for (i = 0, prev_char_1 = false; i < word_len; i++) {
303303
current_char_1 = word->best_choice->unichar_string()[i] == '1';
304304
if (prev_char_1 || (current_char_1 && (i > 0)))
305305
total_score++;
@@ -309,7 +309,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
309309
/* Add 1 to total score for every joined punctuation regardless of context
310310
and rejtn */
311311
if (tessedit_prefer_joined_punct) {
312-
for (i = 0, offset = 0, prev_char_punct = FALSE; i < word_len;
312+
for (i = 0, offset = 0, prev_char_punct = false; i < word_len;
313313
offset += word->best_choice->unichar_lengths()[i++]) {
314314
current_char_punct =
315315
punct_chars.contains(word->best_choice->unichar_string()[offset]);
@@ -340,7 +340,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
340340
return total_score;
341341
}
342342

343-
BOOL8 Tesseract::digit_or_numeric_punct(WERD_RES *word, int char_position) {
343+
bool Tesseract::digit_or_numeric_punct(WERD_RES *word, int char_position) {
344344
int i;
345345
int offset;
346346

@@ -447,7 +447,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
447447

448448
namespace tesseract {
449449
void Tesseract::dump_words(WERD_RES_LIST &perm, int16_t score,
450-
int16_t mode, BOOL8 improved) {
450+
int16_t mode, bool improved) {
451451
WERD_RES_IT word_res_it(&perm);
452452

453453
if (debug_fix_space_level > 0) {
@@ -500,9 +500,9 @@ void Tesseract::dump_words(WERD_RES_LIST &perm, int16_t score,
500500
}
501501
}
502502

503-
BOOL8 Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
503+
bool Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
504504
if (word->done)
505-
return TRUE;
505+
return true;
506506

507507
/*
508508
Use all the standard pass 2 conditions for mode 5 in set_done() in
@@ -518,9 +518,9 @@ BOOL8 Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
518518
(word->best_choice->permuter() == FREQ_DAWG_PERM) ||
519519
(word->best_choice->permuter() == USER_DAWG_PERM) ||
520520
(word->best_choice->permuter() == NUMBER_PERM))) {
521-
return TRUE;
521+
return true;
522522
} else {
523-
return FALSE;
523+
return false;
524524
}
525525
}
526526

@@ -574,7 +574,7 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
574574
WERD_RES_IT current_perm_it(&current_perm);
575575
WERD_RES *old_word_res;
576576
int16_t current_score;
577-
BOOL8 improved = FALSE;
577+
bool improved = false;
578578

579579
best_score = fp_eval_word_spacing(best_perm); // default score
580580

@@ -597,7 +597,7 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
597597
best_perm.clear();
598598
best_perm.deep_copy(&current_perm, &WERD_RES::deep_copy);
599599
best_score = current_score;
600-
improved = TRUE;
600+
improved = true;
601601
}
602602
if (current_score < PERFECT_WERDS) {
603603
break_noisiest_blob_word(current_perm);
@@ -794,7 +794,7 @@ float Tesseract::blob_noise_score(TBLOB *blob) {
794794

795795
void fixspace_dbg(WERD_RES *word) {
796796
TBOX box = word->word->bounding_box();
797-
BOOL8 show_map_detail = FALSE;
797+
bool show_map_detail = false;
798798
int16_t i;
799799

800800
box.print();

src/ccmain/output.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void Tesseract::output_pass( //Tess output pass //send to api
6565
PAGE_RES_IT &page_res_it,
6666
const TBOX *target_word_box) {
6767
BLOCK_RES *block_of_last_word;
68-
BOOL8 force_eol; //During output
68+
bool force_eol; //During output
6969
BLOCK *nextblock; //block of next word
7070
WERD *nextword; //next word
7171

@@ -123,13 +123,13 @@ void Tesseract::output_pass( //Tess output pass //send to api
123123
* inset list - a list of bounding boxes of reject insets - indexed by the
124124
* reject strings in the epchoice text.
125125
*************************************************************************/
126-
void Tesseract::write_results(PAGE_RES_IT &page_res_it,
126+
void Tesseract::write_results(PAGE_RES_IT& page_res_it,
127127
char newline_type, // type of newline
128-
BOOL8 force_eol) { // override tilde crunch?
128+
bool force_eol) { // override tilde crunch?
129129
WERD_RES *word = page_res_it.word();
130130
const UNICHARSET &uchset = *word->uch_set;
131131
int i;
132-
BOOL8 need_reject = FALSE;
132+
bool need_reject = false;
133133
UNICHAR_ID space = uchset.unichar_to_id(" ");
134134

135135
if ((word->unlv_crunch_mode != CR_NONE ||
@@ -147,7 +147,7 @@ void Tesseract::write_results(PAGE_RES_IT &page_res_it,
147147
!word->word->flag (W_FUZZY_SP)) {
148148
stats_.last_char_was_tilde = false;
149149
}
150-
need_reject = TRUE;
150+
need_reject = true;
151151
}
152152
if ((need_reject && !stats_.last_char_was_tilde) ||
153153
(force_eol && stats_.write_results_empty_block)) {

src/ccmain/pgedit.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,12 @@ void pgeditor_show_point( // display coords
390390
*/
391391

392392
namespace tesseract {
393-
BOOL8 Tesseract::process_cmd_win_event( // UI command semantics
394-
int32_t cmd_event, // which menu item?
395-
char *new_value // any prompt data
396-
) {
393+
bool Tesseract::process_cmd_win_event( // UI command semantics
394+
int32_t cmd_event, // which menu item?
395+
char* new_value // any prompt data
396+
) {
397397
char msg[160];
398-
BOOL8 exit = FALSE;
398+
bool exit = false;
399399

400400
color_mode = CM_RAINBOW;
401401

@@ -535,7 +535,7 @@ BOOL8 Tesseract::process_cmd_win_event( // UI command semantics
535535
do_re_display(&tesseract::Tesseract::word_display);
536536
break;
537537
case QUIT_CMD_EVENT:
538-
exit = TRUE;
538+
exit = true;
539539
ScrollView::Exit();
540540
break;
541541

@@ -759,7 +759,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
759759
WERD* word = word_res->word;
760760
TBOX word_bb; // word bounding box
761761
int word_height; // ht of word BB
762-
BOOL8 displayed_something = FALSE;
762+
bool displayed_something = false;
763763
float shift; // from bot left
764764
C_BLOB_IT c_it; // cblob iterator
765765

@@ -833,13 +833,13 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
833833
c_it.set_to_list(word->cblob_list());
834834
for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward())
835835
c_it.data()->bounding_box().plot(image_win);
836-
displayed_something = TRUE;
836+
displayed_something = true;
837837
}
838838

839839
// display edge steps
840840
if (word->display_flag(DF_EDGE_STEP)) { // edgesteps available
841841
word->plot(image_win); // rainbow colors
842-
displayed_something = TRUE;
842+
displayed_something = true;
843843
}
844844

845845
// display poly approx
@@ -848,7 +848,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
848848
TWERD* tword = TWERD::PolygonalCopy(poly_allow_detailed_fx, word);
849849
tword->plot(image_win);
850850
delete tword;
851-
displayed_something = TRUE;
851+
displayed_something = true;
852852
}
853853

854854
// Display correct text and blamer information.
@@ -898,7 +898,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
898898
blame.string());
899899
}
900900

901-
displayed_something = TRUE;
901+
displayed_something = true;
902902
}
903903

904904
if (!displayed_something) // display BBox anyway

0 commit comments

Comments
 (0)