Fix warnings (#216)

This commit is contained in:
vitaut 2015-10-30 07:54:55 -07:00
parent fa88490453
commit 82acd483ae
2 changed files with 4 additions and 2 deletions

View File

@ -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) {

View File

@ -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) {