Skip to content

Commit

Permalink
Fix warnings (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Oct 30, 2015
1 parent fa88490 commit 82acd48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class BasicArgFormatter : public ArgVisitor<Impl, void> {
typedef typename BasicWriter<Char>::CharPtr CharPtr;
Char fill = internal::CharTraits<Char>::cast(spec_.fill());
CharPtr out = CharPtr();
const int CHAR_WIDTH = 1;
const unsigned CHAR_WIDTH = 1;
if (spec_.width_ > CHAR_WIDTH) {
out = writer_.grow_buffer(spec_.width_);
if (spec_.align_ == ALIGN_RIGHT) {
Expand Down
4 changes: 3 additions & 1 deletion format.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ class BasicStringRef {
int compare(BasicStringRef other) const {
std::size_t size = std::min(size_, other.size_);
int result = std::char_traits<Char>::compare(data_, other.data_, size);
return result != 0 ? result : size_ - other.size_;
if (result == 0)
result = size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1);
return result;
}

friend bool operator==(BasicStringRef lhs, BasicStringRef rhs) {
Expand Down

0 comments on commit 82acd48

Please sign in to comment.