Skip to content

Commit c4d8f27

Browse files
stweilzdenop
authored andcommitted
Fix compiler warning (-Wchar-subscript) (#1259)
ccstruct/seam.cpp:66:26: warning: array subscript has type 'char' [-Wchar-subscripts] Fix it by using an unsigned index and use the same type for related values. Signed-off-by: Stefan Weil <[email protected]>
1 parent 000d027 commit c4d8f27

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ccstruct/seam.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void SEAM::CombineWith(const SEAM& other) {
6262
location_ += other.location_;
6363
location_ /= 2;
6464

65-
for (int s = 0; s < other.num_splits_ && num_splits_ < kMaxNumSplits; ++s)
65+
for (uint8_t s = 0; s < other.num_splits_ && num_splits_ < kMaxNumSplits; ++s)
6666
splits_[num_splits_++] = other.splits_[s];
6767
}
6868

ccstruct/seam.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class SEAM {
178178

179179
private:
180180
// Maximum number of splits that a SEAM can hold.
181-
static const int kMaxNumSplits = 3;
181+
static const uint8_t kMaxNumSplits = 3;
182182
// Priority of this split. Lower is better.
183183
float priority_;
184184
// Position of the middle of the seam.
@@ -189,7 +189,7 @@ class SEAM {
189189
inT8 widthp_;
190190
inT8 widthn_;
191191
// Number of splits_ that are used.
192-
inT8 num_splits_;
192+
uint8_t num_splits_;
193193
// Set of pairs of points that are the ends of each split in the SEAM.
194194
SPLIT splits_[kMaxNumSplits];
195195
};

0 commit comments

Comments
 (0)