Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several compiler warnings (clang) #1750

Merged
merged 3 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/ccstruct/coutln.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions src/classify/trainingsampleset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions src/lstm/lstmrecognizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions src/training/dawg2wordlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/training/stringrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/wordrec/language_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down