Skip to content

Commit

Permalink
Modernize C++ code using bool literals
Browse files Browse the repository at this point in the history
The modifications were done using this command:

    run-clang-tidy-8.py -header-filter='.*' -checks='-*,modernize-use-bool-literals' -fix

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Mar 26, 2019
1 parent a0fd905 commit ed01167
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ccmain/paragraphs.cpp
Expand Up @@ -2444,7 +2444,7 @@ static void InitializeRowInfo(bool after_recognition,
info->rword_likely_starts_idea = false;
info->rword_likely_ends_idea = false;
info->has_leaders = false;
info->ltr = 1;
info->ltr = true;

if (!after_recognition) {
InitializeTextAndBoxesPreRecognition(it, info);
Expand Down
8 changes: 4 additions & 4 deletions src/dict/dawg.h
Expand Up @@ -88,10 +88,10 @@ enum DawgType {
#define REFFORMAT "%" PRId64

static const bool kDawgSuccessors[DAWG_TYPE_COUNT][DAWG_TYPE_COUNT] = {
{ 0, 1, 1, 0 }, // for DAWG_TYPE_PUNCTUATION
{ 1, 0, 0, 0 }, // for DAWG_TYPE_WORD
{ 1, 0, 0, 0 }, // for DAWG_TYPE_NUMBER
{ 0, 0, 0, 0 }, // for DAWG_TYPE_PATTERN
{ false, true, true, false }, // for DAWG_TYPE_PUNCTUATION
{ true, false, false, false }, // for DAWG_TYPE_WORD
{ true, false, false, false }, // for DAWG_TYPE_NUMBER
{ false, false, false, false }, // for DAWG_TYPE_PATTERN
};

static const char kWildcard[] = "*";
Expand Down
4 changes: 2 additions & 2 deletions src/dict/trie.cpp
Expand Up @@ -514,7 +514,7 @@ SquishedDawg *Trie::trie_to_dawg() {
print_all("Before reduction:", MAX_NODE_EDGES_DISPLAY);
}
auto reduced_nodes = new bool[nodes_.size()];
for (int i = 0; i < nodes_.size(); i++) reduced_nodes[i] = 0;
for (int i = 0; i < nodes_.size(); i++) reduced_nodes[i] = false;
this->reduce_node_input(0, reduced_nodes);
delete[] reduced_nodes;

Expand Down Expand Up @@ -634,7 +634,7 @@ bool Trie::reduce_lettered_edges(EDGE_INDEX edge_index,
end_of_word_from_edge_rec(edge_rec) &&
can_be_eliminated(next_edge_rec) &&
eliminate_redundant_edges(node, edge_rec, next_edge_rec)) {
reduced_nodes[next_node_from_edge_rec(edge_rec)] = 0;
reduced_nodes[next_node_from_edge_rec(edge_rec)] = false;
did_something = true;
KillEdge(&(*backward_edges)[j]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/viewer/scrollview.cpp
Expand Up @@ -94,7 +94,7 @@ void* ScrollView::MessageReceiver(void* a) {
// This is the main loop which iterates until the server is dead (strlen = -1).
// It basically parses for 3 different messagetypes and then distributes the
// events accordingly.
while (1) {
while (true) {
// The new event we create.
auto* cur = new SVEvent;
// The ID of the corresponding window.
Expand Down

0 comments on commit ed01167

Please sign in to comment.