mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-23 02:24:09 +08:00
ccutil: Fix some signed/unsigned compiler warnings
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
97048fe3e4
commit
e1d7a21559
@ -123,7 +123,7 @@ void IndexMapBiDi::Setup() {
|
||||
}
|
||||
compact_map_.clear();
|
||||
compact_map_.resize(compact_size, -1);
|
||||
for (int i = 0; i < sparse_map_.size(); ++i) {
|
||||
for (size_t i = 0; i < sparse_map_.size(); ++i) {
|
||||
if (sparse_map_[i] >= 0) {
|
||||
compact_map_[sparse_map_[i]] = i;
|
||||
}
|
||||
@ -187,7 +187,7 @@ void IndexMapBiDi::CompleteMerges() {
|
||||
// Re-generate the compact_map leaving holes for unused indices.
|
||||
compact_map_.clear();
|
||||
compact_map_.resize(compact_size, -1);
|
||||
for (int i = 0; i < sparse_map_.size(); ++i) {
|
||||
for (size_t i = 0; i < sparse_map_.size(); ++i) {
|
||||
if (sparse_map_[i] >= 0) {
|
||||
if (compact_map_[sparse_map_[i]] == -1) {
|
||||
compact_map_[sparse_map_[i]] = i;
|
||||
@ -198,7 +198,7 @@ void IndexMapBiDi::CompleteMerges() {
|
||||
// index went to in the compacted map.
|
||||
std::vector<int32_t> tmp_compact_map(compact_size, -1);
|
||||
compact_size = 0;
|
||||
for (int i = 0; i < compact_map_.size(); ++i) {
|
||||
for (size_t i = 0; i < compact_map_.size(); ++i) {
|
||||
if (compact_map_[i] >= 0) {
|
||||
tmp_compact_map[i] = compact_size;
|
||||
compact_map_[compact_size++] = compact_map_[i];
|
||||
@ -222,7 +222,7 @@ bool IndexMapBiDi::Serialize(FILE *fp) const {
|
||||
// then each additional sparse entry needs to be stored.
|
||||
// Normally we store only the compact map to save space.
|
||||
std::vector<int32_t> remaining_pairs;
|
||||
for (int i = 0; i < sparse_map_.size(); ++i) {
|
||||
for (size_t i = 0; i < sparse_map_.size(); ++i) {
|
||||
if (sparse_map_[i] >= 0 && compact_map_[sparse_map_[i]] != i) {
|
||||
remaining_pairs.push_back(i);
|
||||
remaining_pairs.push_back(sparse_map_[i]);
|
||||
@ -243,10 +243,10 @@ bool IndexMapBiDi::DeSerialize(bool swap, FILE *fp) {
|
||||
}
|
||||
sparse_map_.clear();
|
||||
sparse_map_.resize(sparse_size_, -1);
|
||||
for (int i = 0; i < compact_map_.size(); ++i) {
|
||||
for (size_t i = 0; i < compact_map_.size(); ++i) {
|
||||
sparse_map_[compact_map_[i]] = i;
|
||||
}
|
||||
for (int i = 0; i < remaining_pairs.size(); ++i) {
|
||||
for (size_t i = 0; i < remaining_pairs.size(); ++i) {
|
||||
int sparse_index = remaining_pairs[i++];
|
||||
sparse_map_[sparse_index] = remaining_pairs[i];
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ static bool DecodeRadicalLine(std::string &radical_data_line, RSMap *radical_map
|
||||
// is unlikely to want to use it again.
|
||||
static bool DecodeRadicalTable(std::string &radical_data, RSMap *radical_map) {
|
||||
std::vector<std::string> lines = split(radical_data, '\n');
|
||||
for (int i = 0; i < lines.size(); ++i) {
|
||||
for (unsigned i = 0; i < lines.size(); ++i) {
|
||||
if (!DecodeRadicalLine(lines[i], radical_map)) {
|
||||
tprintf("Invalid format in radical table at line %d: %s\n", i, lines[i].c_str());
|
||||
return false;
|
||||
@ -265,7 +265,7 @@ void UnicharCompress::DefragmentCodeValues(int encoded_null) {
|
||||
}
|
||||
// Compute offsets based on code use.
|
||||
int offset = 0;
|
||||
for (int i = 0; i < offsets.size(); ++i) {
|
||||
for (unsigned i = 0; i < offsets.size(); ++i) {
|
||||
// If not used, decrement everything above here.
|
||||
// We are moving encoded_null to the end, so it is not "used".
|
||||
if (offsets[i] == 0 || i == encoded_null) {
|
||||
@ -338,7 +338,7 @@ bool UnicharCompress::DeSerialize(TFile *fp) {
|
||||
// See the class comment above for details.
|
||||
std::string UnicharCompress::GetEncodingAsString(const UNICHARSET &unicharset) const {
|
||||
std::string encoding;
|
||||
for (int c = 0; c < encoder_.size(); ++c) {
|
||||
for (unsigned c = 0; c < encoder_.size(); ++c) {
|
||||
const RecodedCharID &code = encoder_[c];
|
||||
if (0 < c && c < SPECIAL_UNICHAR_CODES_COUNT && code == encoder_[c - 1]) {
|
||||
// Don't show the duplicate entry.
|
||||
|
@ -883,7 +883,7 @@ void UNICHARSET::post_load_setup() {
|
||||
int x_height_alphas = 0;
|
||||
int cap_height_alphas = 0;
|
||||
top_bottom_set_ = false;
|
||||
for (UNICHAR_ID id = 0; id < unichars.size(); ++id) {
|
||||
for (unsigned id = 0; id < unichars.size(); ++id) {
|
||||
int min_bottom = 0;
|
||||
int max_bottom = UINT8_MAX;
|
||||
int min_top = 0;
|
||||
@ -1012,7 +1012,7 @@ bool UNICHARSET::AnyRepeatedUnicodes() const {
|
||||
if (has_special_codes()) {
|
||||
start_id = SPECIAL_UNICHAR_CODES_COUNT;
|
||||
}
|
||||
for (int id = start_id; id < unichars.size(); ++id) {
|
||||
for (unsigned id = start_id; id < unichars.size(); ++id) {
|
||||
// Convert to unicodes.
|
||||
std::vector<char32> unicodes = UNICHAR::UTF8ToUTF32(get_normed_unichar(id));
|
||||
for (size_t u = 1; u < unicodes.size(); ++u) {
|
||||
|
Loading…
Reference in New Issue
Block a user