Merge pull request #1750 from stweil/fix

Fix several compiler warnings (clang)
This commit is contained in:
Egor Pugin 2018-07-05 14:43:03 +03:00 committed by GitHub
commit 4ca452d9b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 22 deletions

View File

@ -456,7 +456,7 @@ void TessBaseAPI::GetAvailableLanguagesAsVector(
}
}
//TODO(amit): Adapt to lstm
//TODO(amit): Adapt to lstm
#ifndef DISABLED_LEGACY_ENGINE
/**
* Init only the lang model component of Tesseract. The only functions
@ -833,8 +833,8 @@ int TessBaseAPI::Recognize(ETEXT_DESC* monitor) {
page_res_ = tesseract_->ApplyBoxes(*input_file_, true, block_list_);
} else if (tesseract_->tessedit_resegment_from_boxes) {
page_res_ = tesseract_->ApplyBoxes(*input_file_, false, block_list_);
} else
#endif // ndef DISABLED_LEGACY_ENGINE
} else
#endif // ndef DISABLED_LEGACY_ENGINE
{
page_res_ = new PAGE_RES(tesseract_->AnyLSTMLang(),
block_list_, &tesseract_->prev_word_best_choice_);
@ -1616,8 +1616,11 @@ char* TessBaseAPI::GetTSVText(int page_number) {
STRING tsv_str("");
int page_num = page_id, block_num = 0, par_num = 0, line_num = 0,
word_num = 0;
int page_num = page_id;
int block_num = 0;
int par_num = 0;
int line_num = 0;
int word_num = 0;
tsv_str.add_str_int("1\t", page_num); // level 1 - page
tsv_str.add_str_int("\t", block_num);
@ -1639,7 +1642,10 @@ char* TessBaseAPI::GetTSVText(int page_number) {
// Add rows for any new block/paragraph/textline.
if (res_it->IsAtBeginningOf(RIL_BLOCK)) {
block_num++, par_num = 0, line_num = 0, word_num = 0;
block_num++;
par_num = 0;
line_num = 0;
word_num = 0;
tsv_str.add_str_int("2\t", page_num); // level 2 - block
tsv_str.add_str_int("\t", block_num);
tsv_str.add_str_int("\t", par_num);
@ -1649,7 +1655,9 @@ char* TessBaseAPI::GetTSVText(int page_number) {
tsv_str += "\t-1\t\n"; // end of row for block
}
if (res_it->IsAtBeginningOf(RIL_PARA)) {
par_num++, line_num = 0, word_num = 0;
par_num++;
line_num = 0;
word_num = 0;
tsv_str.add_str_int("3\t", page_num); // level 3 - paragraph
tsv_str.add_str_int("\t", block_num);
tsv_str.add_str_int("\t", par_num);
@ -1659,7 +1667,8 @@ char* TessBaseAPI::GetTSVText(int page_number) {
tsv_str += "\t-1\t\n"; // end of row for para
}
if (res_it->IsAtBeginningOf(RIL_TEXTLINE)) {
line_num++, word_num = 0;
line_num++;
word_num = 0;
tsv_str.add_str_int("4\t", page_num); // level 4 - line
tsv_str.add_str_int("\t", block_num);
tsv_str.add_str_int("\t", par_num);

View File

@ -141,14 +141,14 @@ int16_t length //length of loop
*/
C_OUTLINE::C_OUTLINE(C_OUTLINE* srcline, FCOORD rotation) : offsets(nullptr) {
TBOX new_box; //easy bounding
int16_t stepindex; //index to step
int16_t dirdiff; //direction change
TBOX new_box; //easy bounding
int16_t stepindex; //index to step
int16_t dirdiff; //direction change
ICOORD pos; //current position
ICOORD prevpos; //previous dest point
ICOORD destpos; //destination point
int16_t destindex; //index to step
int16_t destindex = INT16_MAX; //index to step
DIR128 dir; //coded direction
uint8_t new_step;

View File

@ -35,8 +35,6 @@ const int kSquareLimit = 25;
// Prime numbers for subsampling distances.
const int kPrime1 = 17;
const int kPrime2 = 13;
// Min samples from which to start discarding outliers.
const int kMinOutlierSamples = 5;
TrainingSampleSet::FontClassInfo::FontClassInfo()
: num_raw_samples(0), canonical_sample(-1), canonical_dist(0.0f) {

View File

@ -41,8 +41,6 @@
namespace tesseract {
// Max number of blob choices to return in any given position.
const int kMaxChoices = 4;
// Default ratio between dict and non-dict words.
const double kDictRatio = 2.25;
// Default certainty offset to give the dictionary a chance.

View File

@ -25,8 +25,6 @@
#include "trie.h"
#include "unicharset.h"
const int kDictDebugLevel = 1;
tesseract::Dawg *LoadSquishedDawg(const UNICHARSET &unicharset,
const char *filename) {
const int kDictDebugLevel = 1;

View File

@ -47,7 +47,6 @@ static const int kDefaultOutputResolution = 300;
// recommendation in http://unicode.org/reports/tr14/ to avoid line-breaks at
// hyphens and other non-alpha characters.
static const char* kWordJoinerUTF8 = "\u2060";
static const char32 kWordJoiner = 0x2060;
static bool IsCombiner(int ch) {
const int char_type = u_charType(ch);

View File

@ -1127,7 +1127,7 @@ void LanguageModel::FillConsistencyInfo(
}
if (!word_res->blob_widths.empty()) { // if we have widths/gaps info
bool expected_gap_found = false;
float expected_gap;
float expected_gap = 0.0f;
int temp_gap;
if (fontinfo_id >= 0) { // found a common font
ASSERT_HOST(fontinfo_id < fontinfo_table_->size());
@ -1140,7 +1140,6 @@ void LanguageModel::FillConsistencyInfo(
consistency_info->inconsistent_font = true;
// Get an average of the expected gaps in each font
int num_addends = 0;
expected_gap = 0;
int temp_fid;
for (int i = 0; i < 4; ++i) {
if (i == 0) {
@ -1159,9 +1158,9 @@ void LanguageModel::FillConsistencyInfo(
num_addends++;
}
}
expected_gap_found = (num_addends > 0);
if (num_addends > 0) {
expected_gap /= static_cast<float>(num_addends);
expected_gap_found = true;
}
}
if (expected_gap_found) {