Skip to content

Commit

Permalink
Fix compiler warning (-Wchar-subscript) (#1259)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stweil authored and zdenop committed Jan 8, 2018
1 parent 000d027 commit c4d8f27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ccstruct/seam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void SEAM::CombineWith(const SEAM& other) {
location_ += other.location_;
location_ /= 2;

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

Expand Down
4 changes: 2 additions & 2 deletions ccstruct/seam.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class SEAM {

private:
// Maximum number of splits that a SEAM can hold.
static const int kMaxNumSplits = 3;
static const uint8_t kMaxNumSplits = 3;
// Priority of this split. Lower is better.
float priority_;
// Position of the middle of the seam.
Expand All @@ -189,7 +189,7 @@ class SEAM {
inT8 widthp_;
inT8 widthn_;
// Number of splits_ that are used.
inT8 num_splits_;
uint8_t num_splits_;
// Set of pairs of points that are the ends of each split in the SEAM.
SPLIT splits_[kMaxNumSplits];
};
Expand Down

0 comments on commit c4d8f27

Please sign in to comment.