Skip to content

Commit

Permalink
More fixes BOOL8 -> bool
Browse files Browse the repository at this point in the history
  • Loading branch information
zamazan4ik committed May 20, 2018
1 parent 6f580ba commit 6ff0b56
Show file tree
Hide file tree
Showing 29 changed files with 244 additions and 248 deletions.
18 changes: 9 additions & 9 deletions src/ccmain/adaptions.cpp
Expand Up @@ -37,9 +37,9 @@
#endif

namespace tesseract {
BOOL8 Tesseract::word_adaptable( //should we adapt?
WERD_RES *word,
uint16_t mode) {
bool Tesseract::word_adaptable( //should we adapt?
WERD_RES* word,
uint16_t mode) {
if (tessedit_adaption_debug) {
tprintf("Running word_adaptable() for %s rating %.4f certainty %.4f\n",
word->best_choice == nullptr ? "" :
Expand All @@ -65,7 +65,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
*/
if (mode == 0) {
if (tessedit_adaption_debug) tprintf("adaption disabled\n");
return FALSE;
return false;
}

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

if (!status) { // If not set then
return FALSE; // ignore other checks
return false; // ignore other checks
}

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

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

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

if (flags.bit (CHECK_AMBIG_WERD) &&
word->best_choice->dangerous_ambig_found()) {
if (tessedit_adaption_debug) tprintf("word is ambiguous\n");
return FALSE;
return false;
}

if (tessedit_adaption_debug) {
Expand Down
4 changes: 2 additions & 2 deletions src/ccmain/control.cpp
Expand Up @@ -80,7 +80,7 @@ void Tesseract::recog_pseudo_word(PAGE_RES* page_res,
*
* @param pr_it the page results iterator
*/
BOOL8 Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
bool Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
int16_t char_qual;
int16_t good_char_qual;

Expand All @@ -101,7 +101,7 @@ BOOL8 Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
word_blob_quality(word_res, pr_it->row()->row),
word_outline_errs(word_res), char_qual, good_char_qual);
}
return TRUE;
return true;
}

// Helper function to check for a target word and handle it appropriately.
Expand Down
22 changes: 11 additions & 11 deletions src/ccmain/docqual.cpp
Expand Up @@ -304,7 +304,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
prev_word_rejected &&
page_res_it.prev_row() == page_res_it.row() &&
word->word->space() == 1)
word->reject_spaces = TRUE;
word->reject_spaces = true;
word->reject_map.rej_word_block_rej();
}
prev_word_rejected = rej_word;
Expand Down Expand Up @@ -375,7 +375,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
prev_word_rejected &&
page_res_it.prev_row() == page_res_it.row() &&
word->word->space () == 1)
word->reject_spaces = TRUE;
word->reject_spaces = true;
word->reject_map.rej_word_row_rej();
}
prev_word_rejected = rej_word;
Expand Down Expand Up @@ -411,7 +411,7 @@ void reject_whole_page(PAGE_RES_IT &page_res_it) {
page_res_it.forward ();
}
//whole page is rejected
page_res_it.page_res->rejected = TRUE;
page_res_it.page_res->rejected = true;
}

namespace tesseract {
Expand Down Expand Up @@ -501,8 +501,8 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
}


BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
GARBAGE_LEVEL garbage_level) {
bool Tesseract::terrible_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level) {
float rating_per_ch;
int adjusted_len;
int crunch_mode = 0;
Expand Down Expand Up @@ -533,15 +533,15 @@ BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
tprintf ("Terrible_word_crunch (%d) on \"%s\"\n",
crunch_mode, word->best_choice->unichar_string().string());
}
return TRUE;
return true;
}
else
return FALSE;
return false;
}

BOOL8 Tesseract::potential_word_crunch(WERD_RES *word,
GARBAGE_LEVEL garbage_level,
BOOL8 ok_dict_word) {
bool Tesseract::potential_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level,
bool ok_dict_word) {
float rating_per_ch;
int adjusted_len;
const char *str = word->best_choice->unichar_string().string();
Expand Down Expand Up @@ -975,7 +975,7 @@ int16_t Tesseract::failure_count(WERD_RES *word) {
}


BOOL8 Tesseract::noise_outlines(TWERD *word) {
bool Tesseract::noise_outlines(TWERD* word) {
TBOX box; // BB of outline
int16_t outline_count = 0;
int16_t small_outline_count = 0;
Expand Down
14 changes: 7 additions & 7 deletions src/ccmain/fixspace.cpp
Expand Up @@ -184,8 +184,8 @@ void initialise_search(WERD_RES_LIST &src_list, WERD_RES_LIST &new_list) {
src_wd = src_it.data();
if (!src_wd->combination) {
new_wd = WERD_RES::deep_copy(src_wd);
new_wd->combination = FALSE;
new_wd->part_of_combo = FALSE;
new_wd->combination = false;
new_wd->part_of_combo = false;
new_it.add_after_then_move(new_wd);
}
}
Expand Down Expand Up @@ -417,7 +417,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
combo = new WERD_RES(copy_word);
combo->combination = TRUE;
combo->x_height = prev_word->x_height;
prev_word->part_of_combo = TRUE;
prev_word->part_of_combo = true;
prev_word_it.add_before_then_move(combo);
}
combo->word->set_flag(W_EOL, word->word->flag(W_EOL));
Expand All @@ -429,7 +429,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
} else {
// Copy current wd to combo
combo->copy_on(word);
word->part_of_combo = TRUE;
word->part_of_combo = true;
}
combo->done = FALSE;
combo->ClearResults();
Expand Down Expand Up @@ -583,9 +583,9 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
old_word_res = best_perm_it.data();
// Even deep_copy doesn't copy the underlying WERD unless its combination
// flag is true!.
old_word_res->combination = TRUE; // Kludge to force deep copy
old_word_res->combination = true; // Kludge to force deep copy
current_perm_it.add_to_end(WERD_RES::deep_copy(old_word_res));
old_word_res->combination = FALSE; // Undo kludge
old_word_res->combination = false; // Undo kludge

break_noisiest_blob_word(current_perm);

Expand Down Expand Up @@ -671,7 +671,7 @@ void Tesseract::break_noisiest_blob_word(WERD_RES_LIST &words) {
}

WERD_RES* new_word_res = new WERD_RES(new_word);
new_word_res->combination = TRUE;
new_word_res->combination = true;
worst_word_it.add_before_then_move(new_word_res);

word_res->ClearResults();
Expand Down
18 changes: 9 additions & 9 deletions src/ccmain/output.cpp
Expand Up @@ -412,9 +412,9 @@ int16_t Tesseract::count_alphanums(const WERD_CHOICE &word) {
}


BOOL8 Tesseract::acceptable_number_string(const char *s,
const char *lengths) {
BOOL8 prev_digit = FALSE;
bool Tesseract::acceptable_number_string(const char* s,
const char* lengths) {
bool prev_digit = false;

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

for (; *s != '\0'; s += *(lengths++)) {
if (unicharset.get_isdigit(s, *lengths))
prev_digit = TRUE;
prev_digit = true;
else if (prev_digit &&
(*lengths == 1 && ((*s == '.') || (*s == ',') || (*s == '-'))))
prev_digit = FALSE;
prev_digit = false;
else if (prev_digit && *lengths == 1 &&
(*(s + *lengths) == '\0') && ((*s == '%') || (*s == ')')))
return TRUE;
return true;
else if (prev_digit &&
*lengths == 1 && (*s == '%') &&
(*(lengths + 1) == 1 && *(s + *lengths) == ')') &&
(*(s + *lengths + *(lengths + 1)) == '\0'))
return TRUE;
return true;
else
return FALSE;
return false;
}
return TRUE;
return true;
}
} // namespace tesseract
20 changes: 10 additions & 10 deletions src/ccmain/pgedit.cpp
Expand Up @@ -302,7 +302,7 @@ SVMenuNode *Tesseract::build_menu_new() {
* Redisplay page
*/
void Tesseract::do_re_display(
BOOL8 (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it)) {
bool (tesseract::Tesseract::* word_painter)(PAGE_RES_IT* pr_it)) {
int block_count = 1;

image_win->Clear();
Expand Down Expand Up @@ -710,7 +710,7 @@ void show_point(PAGE_RES* page_res, float x, float y) {
#endif // GRAPHICS_DISABLED
namespace tesseract {
#ifndef GRAPHICS_DISABLED
BOOL8 Tesseract:: word_blank_and_set_display(PAGE_RES_IT* pr_it) {
bool Tesseract::word_blank_and_set_display(PAGE_RES_IT* pr_it) {
pr_it->word()->word->bounding_box().plot(image_win, ScrollView::BLACK,
ScrollView::BLACK);
return word_set_display(pr_it);
Expand All @@ -722,7 +722,7 @@ BOOL8 Tesseract:: word_blank_and_set_display(PAGE_RES_IT* pr_it) {
*
* Normalize word and display in word window
*/
BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
bool Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
WERD_RES* word_res = pr_it->word();
if (word_res->chopped_word == nullptr) {
// Setup word normalization parameters.
Expand All @@ -744,7 +744,7 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
color = WERD::NextColor(color);
}
bln_word_window_handle()->Update();
return TRUE;
return true;
}


Expand All @@ -754,7 +754,7 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
*
* Display a word according to its display modes
*/
BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
bool Tesseract::word_display(PAGE_RES_IT* pr_it) {
WERD_RES* word_res = pr_it->word();
WERD* word = word_res->word;
TBOX word_bb; // word bounding box
Expand Down Expand Up @@ -906,7 +906,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
(ScrollView::Color)((int32_t) editor_image_word_bb_color),
(ScrollView::Color)((int32_t)
editor_image_word_bb_color));
return TRUE;
return true;
}
#endif // GRAPHICS_DISABLED

Expand All @@ -915,10 +915,10 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
*
* Dump members to the debug window
*/
BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
bool Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
if (pr_it->block()->block != nullptr) {
tprintf("\nBlock data...\n");
pr_it->block()->block->print(nullptr, FALSE);
pr_it->block()->block->print(nullptr, false);
}
tprintf("\nRow data...\n");
pr_it->row()->row->print(nullptr);
Expand All @@ -930,7 +930,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
tprintf("Current blamer debug: %s\n",
word_res->blamer_bundle->debug().string());
}
return TRUE;
return true;
}

#ifndef GRAPHICS_DISABLED
Expand All @@ -939,7 +939,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
*
* Display word according to current display mode settings
*/
BOOL8 Tesseract::word_set_display(PAGE_RES_IT* pr_it) {
bool Tesseract::word_set_display(PAGE_RES_IT* pr_it) {
WERD* word = pr_it->word()->word;
word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX));
word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT));
Expand Down
8 changes: 4 additions & 4 deletions src/ccmain/reject.cpp
Expand Up @@ -501,17 +501,17 @@ int16_t Tesseract::alpha_count(const char *word,
}


BOOL8 Tesseract::word_contains_non_1_digit(const char *word,
const char *word_lengths) {
bool Tesseract::word_contains_non_1_digit(const char* word,
const char* word_lengths) {
int16_t i;
int16_t offset;

for (i = 0, offset = 0; word[offset] != '\0'; offset += word_lengths[i++]) {
if (unicharset.get_isdigit (word + offset, word_lengths[i]) &&
(word_lengths[i] != 1 || word[offset] != '1'))
return TRUE;
return true;
}
return FALSE;
return false;
}

/*************************************************************************
Expand Down

0 comments on commit 6ff0b56

Please sign in to comment.