Skip to content

Commit

Permalink
training: Fix some compiler warnings (signed/unsigned)
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jan 23, 2019
1 parent e4b862d commit 32e9d7c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/training/validate_grapheme.cpp
Expand Up @@ -5,7 +5,7 @@
namespace tesseract {

bool ValidateGrapheme::ConsumeGraphemeIfValid() {
int num_codes = codes_.size();
const unsigned num_codes = codes_.size();
char32 prev_prev_ch = ' ';
char32 prev_ch = ' ';
CharClass prev_cc = CharClass::kWhitespace;
Expand Down
4 changes: 2 additions & 2 deletions src/training/validate_indic.cpp
Expand Up @@ -95,7 +95,7 @@ Validator::CharClass ValidateIndic::UnicodeToCharClass(char32 ch) const {
// representation to make it consistent by adding a ZWNJ if missing from a
// non-linking virama. Returns false with an invalid sequence.
bool ValidateIndic::ConsumeViramaIfValid(IndicPair joiner, bool post_matra) {
int num_codes = codes_.size();
const unsigned num_codes = codes_.size();
if (joiner.first == CharClass::kOther) {
CodeOnlyToOutput();
if (codes_used_ < num_codes &&
Expand Down Expand Up @@ -167,7 +167,7 @@ bool ValidateIndic::ConsumeViramaIfValid(IndicPair joiner, bool post_matra) {
// Helper consumes/copies a series of consonants separated by viramas while
// valid, but not any vowel or other modifiers.
bool ValidateIndic::ConsumeConsonantHeadIfValid() {
const int num_codes = codes_.size();
const unsigned num_codes = codes_.size();
// Consonant aksara
do {
CodeOnlyToOutput();
Expand Down
8 changes: 4 additions & 4 deletions src/training/validate_javanese.cpp
Expand Up @@ -71,7 +71,7 @@ bool ValidateJavanese::ConsumeGraphemeIfValid() {
// representation to make it consistent by adding a ZWNJ if missing from a
// non-linking virama. Returns false with an invalid sequence.
bool ValidateJavanese::ConsumeViramaIfValid(IndicPair joiner, bool post_matra) {
int num_codes = codes_.size();
const unsigned num_codes = codes_.size();
if (joiner.first == CharClass::kOther) {
CodeOnlyToOutput();
if (codes_used_ < num_codes &&
Expand Down Expand Up @@ -143,7 +143,7 @@ bool ValidateJavanese::ConsumeViramaIfValid(IndicPair joiner, bool post_matra) {
// Helper consumes/copies a series of consonants separated by viramas while
// valid, but not any vowel or other modifiers.
bool ValidateJavanese::ConsumeConsonantHeadIfValid() {
const int num_codes = codes_.size();
const unsigned num_codes = codes_.size();
// Consonant aksara
do {
CodeOnlyToOutput();
Expand Down Expand Up @@ -252,8 +252,8 @@ bool ValidateJavanese::ConsumeVowelIfValid() {
// What we have consumed so far is a valid vowel cluster.
return true;
}


Validator::CharClass ValidateJavanese::UnicodeToCharClass(char32 ch) const {
if (ch == kZeroWidthNonJoiner) return CharClass::kZeroWidthNonJoiner;
if (ch == kZeroWidthJoiner) return CharClass::kZeroWidthJoiner;
Expand Down
2 changes: 1 addition & 1 deletion src/training/validate_khmer.cpp
Expand Up @@ -18,7 +18,7 @@ namespace tesseract {
// HC and the {Z|z}M The unicode chapter on Khmer only mentions the joiners in
// the BNF syntax, so who knows what they do.
bool ValidateKhmer::ConsumeGraphemeIfValid() {
int num_codes = codes_.size();
const unsigned num_codes = codes_.size();
if (codes_used_ == num_codes) return false;
if (codes_[codes_used_].first == CharClass::kOther) {
UseMultiCode(1);
Expand Down
4 changes: 2 additions & 2 deletions src/training/validate_myanmar.cpp
Expand Up @@ -11,7 +11,7 @@ namespace tesseract {
// Taken directly from the unicode table 16-3.
// See http://www.unicode.org/versions/Unicode9.0.0/ch16.pdf
bool ValidateMyanmar::ConsumeGraphemeIfValid() {
int num_codes = codes_.size();
const unsigned num_codes = codes_.size();
if (codes_used_ == num_codes) return true;
// Other.
if (IsMyanmarOther(codes_[codes_used_].second)) {
Expand Down Expand Up @@ -61,7 +61,7 @@ Validator::CharClass ValidateMyanmar::UnicodeToCharClass(char32 ch) const {
// Returns true if the end of input is reached.
bool ValidateMyanmar::ConsumeSubscriptIfPresent() {
// Subscript consonant. It appears there can be only one.
int num_codes = codes_.size();
const unsigned num_codes = codes_.size();
if (codes_used_ + 1 < num_codes &&
codes_[codes_used_].second == kMyanmarVirama) {
if (IsMyanmarLetter(codes_[codes_used_ + 1].second)) {
Expand Down
4 changes: 2 additions & 2 deletions src/training/validator.h
Expand Up @@ -235,9 +235,9 @@ class Validator {
// Copied validated unicodes from codes_ that are OK to output.
std::vector<char32> output_;
// The number of elements of codes_ that have been processed so far.
int codes_used_;
unsigned codes_used_;
// The number of elements of output_ that have already been added to parts_.
int output_used_;
unsigned output_used_;
// Log error messages for reasons why text is invalid.
bool report_errors_;
};
Expand Down

0 comments on commit 32e9d7c

Please sign in to comment.