mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
Fix some compiler warnings
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
fbaac9dc9d
commit
4530763329
@ -61,7 +61,7 @@ bool SEAM::PrepareToInsertSeam(const std::vector<SEAM *> &seams,
|
|||||||
if (!FindBlobWidth(blobs, insert_index, modify)) {
|
if (!FindBlobWidth(blobs, insert_index, modify)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int s = insert_index; s < seams.size(); ++s) {
|
for (unsigned s = insert_index; s < seams.size(); ++s) {
|
||||||
if (!seams[s]->FindBlobWidth(blobs, s + 1, modify)) {
|
if (!seams[s]->FindBlobWidth(blobs, s + 1, modify)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ bool SEAM::FindBlobWidth(const std::vector<TBLOB *> &blobs, int index, bool modi
|
|||||||
const SPLIT &split = splits_[s];
|
const SPLIT &split = splits_[s];
|
||||||
bool found_split = split.ContainedByBlob(*blobs[index]);
|
bool found_split = split.ContainedByBlob(*blobs[index]);
|
||||||
// Look right.
|
// Look right.
|
||||||
for (int b = index + 1; !found_split && b < blobs.size(); ++b) {
|
for (unsigned b = index + 1; !found_split && b < blobs.size(); ++b) {
|
||||||
found_split = split.ContainedByBlob(*blobs[b]);
|
found_split = split.ContainedByBlob(*blobs[b]);
|
||||||
if (found_split && b - index > widthp_ && modify) {
|
if (found_split && b - index > widthp_ && modify) {
|
||||||
widthp_ = b - index;
|
widthp_ = b - index;
|
||||||
@ -158,8 +158,8 @@ void SEAM::Print(const char *label) const {
|
|||||||
void SEAM::PrintSeams(const char *label, const std::vector<SEAM *> &seams) {
|
void SEAM::PrintSeams(const char *label, const std::vector<SEAM *> &seams) {
|
||||||
if (!seams.empty()) {
|
if (!seams.empty()) {
|
||||||
tprintf("%s\n", label);
|
tprintf("%s\n", label);
|
||||||
for (int x = 0; x < seams.size(); ++x) {
|
for (unsigned x = 0; x < seams.size(); ++x) {
|
||||||
tprintf("%2d: ", x);
|
tprintf("%2u: ", x);
|
||||||
seams[x]->Print("");
|
seams[x]->Print("");
|
||||||
}
|
}
|
||||||
tprintf("\n");
|
tprintf("\n");
|
||||||
|
@ -101,7 +101,7 @@ TEST(LangModelTest, AddACharacter) {
|
|||||||
int null2 = trainer2.null_char();
|
int null2 = trainer2.null_char();
|
||||||
EXPECT_EQ(null1 + 1, null2);
|
EXPECT_EQ(null1 + 1, null2);
|
||||||
std::vector<int> labels1_v(labels1.size());
|
std::vector<int> labels1_v(labels1.size());
|
||||||
for (int i = 0; i < labels1.size(); ++i) {
|
for (unsigned i = 0; i < labels1.size(); ++i) {
|
||||||
if (labels1[i] == null1) {
|
if (labels1[i] == null1) {
|
||||||
labels1_v[i] = null2;
|
labels1_v[i] = null2;
|
||||||
} else {
|
} else {
|
||||||
@ -186,7 +186,7 @@ TEST(LangModelTest, AddACharacterHindi) {
|
|||||||
int null2 = trainer2.null_char();
|
int null2 = trainer2.null_char();
|
||||||
EXPECT_EQ(null1 + 1, null2);
|
EXPECT_EQ(null1 + 1, null2);
|
||||||
std::vector<int> labels1_v(labels1.size());
|
std::vector<int> labels1_v(labels1.size());
|
||||||
for (int i = 0; i < labels1.size(); ++i) {
|
for (unsigned i = 0; i < labels1.size(); ++i) {
|
||||||
if (labels1[i] == null1) {
|
if (labels1[i] == null1) {
|
||||||
labels1_v[i] = null2;
|
labels1_v[i] = null2;
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,7 +48,7 @@ TEST_F(LSTMTrainerTest, MapCoder) {
|
|||||||
std::vector<int> mapping =
|
std::vector<int> mapping =
|
||||||
fra_trainer.MapRecoder(deu_trainer.GetUnicharset(), deu_trainer.GetRecoder());
|
fra_trainer.MapRecoder(deu_trainer.GetUnicharset(), deu_trainer.GetRecoder());
|
||||||
std::vector<int> mapped_fra_labels(fra_labels.size(), -1);
|
std::vector<int> mapped_fra_labels(fra_labels.size(), -1);
|
||||||
for (int i = 0; i < fra_labels.size(); ++i) {
|
for (unsigned i = 0; i < fra_labels.size(); ++i) {
|
||||||
mapped_fra_labels[i] = mapping[fra_labels[i]];
|
mapped_fra_labels[i] = mapping[fra_labels[i]];
|
||||||
EXPECT_NE(-1, mapped_fra_labels[i]) << "i=" << i << ", ch=" << kTestStr[i];
|
EXPECT_NE(-1, mapped_fra_labels[i]) << "i=" << i << ", ch=" << kTestStr[i];
|
||||||
EXPECT_EQ(mapped_fra_labels[i], deu_labels[i])
|
EXPECT_EQ(mapped_fra_labels[i], deu_labels[i])
|
||||||
|
@ -126,9 +126,9 @@ protected:
|
|||||||
// Now decode using recoder_.
|
// Now decode using recoder_.
|
||||||
std::string decoded;
|
std::string decoded;
|
||||||
int end = 1;
|
int end = 1;
|
||||||
for (int start = 0; start < labels.size(); start = end) {
|
for (unsigned start = 0; start < labels.size(); start = end) {
|
||||||
RecodedCharID code;
|
RecodedCharID code;
|
||||||
int index = start;
|
unsigned index = start;
|
||||||
int uni_id = INVALID_UNICHAR_ID;
|
int uni_id = INVALID_UNICHAR_ID;
|
||||||
do {
|
do {
|
||||||
code.Set(code.length(), labels[index++]);
|
code.Set(code.length(), labels[index++]);
|
||||||
@ -153,7 +153,7 @@ protected:
|
|||||||
&ratings, &xcoords);
|
&ratings, &xcoords);
|
||||||
std::string u_decoded;
|
std::string u_decoded;
|
||||||
float total_rating = 0.0f;
|
float total_rating = 0.0f;
|
||||||
for (int u = 0; u < unichar_ids.size(); ++u) {
|
for (unsigned u = 0; u < unichar_ids.size(); ++u) {
|
||||||
// To the extent of truth_utf8, we expect decoded to match, but if
|
// To the extent of truth_utf8, we expect decoded to match, but if
|
||||||
// transcription is shorter, that is OK too, as we may just be testing
|
// transcription is shorter, that is OK too, as we may just be testing
|
||||||
// that we get a valid sequence when padded with random data.
|
// that we get a valid sequence when padded with random data.
|
||||||
|
@ -51,14 +51,14 @@ public:
|
|||||||
EXPECT_EQ(3 + (almost_done - second) / add, cell_x_.size());
|
EXPECT_EQ(3 + (almost_done - second) / add, cell_x_.size());
|
||||||
EXPECT_EQ(x_min, cell_x_.at(0));
|
EXPECT_EQ(x_min, cell_x_.at(0));
|
||||||
EXPECT_EQ(x_max, cell_x_.at(cell_x_.size() - 1));
|
EXPECT_EQ(x_max, cell_x_.at(cell_x_.size() - 1));
|
||||||
for (int i = 1; i < cell_x_.size() - 1; ++i) {
|
for (unsigned i = 1; i < cell_x_.size() - 1; ++i) {
|
||||||
EXPECT_EQ(second + add * (i - 1), cell_x_.at(i));
|
EXPECT_EQ(second + add * (i - 1), cell_x_.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExpectSortedX() {
|
void ExpectSortedX() {
|
||||||
EXPECT_GT(cell_x_.size(), 0);
|
EXPECT_GT(cell_x_.size(), 0);
|
||||||
for (int i = 1; i < cell_x_.size(); ++i) {
|
for (unsigned i = 1; i < cell_x_.size(); ++i) {
|
||||||
EXPECT_LT(cell_x_.at(i - 1), cell_x_.at(i));
|
EXPECT_LT(cell_x_.at(i - 1), cell_x_.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,11 @@ protected:
|
|||||||
void ExpectEq(const MathData &other) {
|
void ExpectEq(const MathData &other) {
|
||||||
// Check the data.
|
// Check the data.
|
||||||
EXPECT_EQ(num_squares_, other.num_squares_);
|
EXPECT_EQ(num_squares_, other.num_squares_);
|
||||||
for (int s = 0; s < squares_.size(); ++s) {
|
for (unsigned s = 0; s < squares_.size(); ++s) {
|
||||||
EXPECT_EQ(squares_[s], other.squares_[s]);
|
EXPECT_EQ(squares_[s], other.squares_[s]);
|
||||||
}
|
}
|
||||||
EXPECT_EQ(num_triangles_, other.num_triangles_);
|
EXPECT_EQ(num_triangles_, other.num_triangles_);
|
||||||
for (int s = 0; s < triangles_.size(); ++s) {
|
for (unsigned s = 0; s < triangles_.size(); ++s) {
|
||||||
EXPECT_EQ(triangles_[s], other.triangles_[s]);
|
EXPECT_EQ(triangles_[s], other.triangles_[s]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user