diff --git a/src/ccutil/indexmapbidi.cpp b/src/ccutil/indexmapbidi.cpp index baf3a4475..8460ff6be 100644 --- a/src/ccutil/indexmapbidi.cpp +++ b/src/ccutil/indexmapbidi.cpp @@ -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 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 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]; } diff --git a/src/ccutil/unicharcompress.cpp b/src/ccutil/unicharcompress.cpp index 9cb1e48e7..2c0ad5079 100644 --- a/src/ccutil/unicharcompress.cpp +++ b/src/ccutil/unicharcompress.cpp @@ -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 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. diff --git a/src/ccutil/unicharset.cpp b/src/ccutil/unicharset.cpp index 0aa313224..cf64b18c6 100644 --- a/src/ccutil/unicharset.cpp +++ b/src/ccutil/unicharset.cpp @@ -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 unicodes = UNICHAR::UTF8ToUTF32(get_normed_unichar(id)); for (size_t u = 1; u < unicodes.size(); ++u) {