Merge pull request #566 from open-source-parsers/update

std::min<unsigned>, for VS2015

fixes #565
This commit is contained in:
Christopher Dunn 2016-12-21 12:56:14 -06:00 committed by GitHub
commit 81065748e3

View File

@ -303,7 +303,7 @@ bool Value::CZString::operator<(const CZString& other) const {
// Assume both are strings. // Assume both are strings.
unsigned this_len = this->storage_.length_; unsigned this_len = this->storage_.length_;
unsigned other_len = other.storage_.length_; unsigned other_len = other.storage_.length_;
unsigned min_len = std::min(this_len, other_len); unsigned min_len = std::min<unsigned>(this_len, other_len);
JSON_ASSERT(this->cstr_ && other.cstr_); JSON_ASSERT(this->cstr_ && other.cstr_);
int comp = memcmp(this->cstr_, other.cstr_, min_len); int comp = memcmp(this->cstr_, other.cstr_, min_len);
if (comp < 0) return true; if (comp < 0) return true;
@ -566,7 +566,7 @@ bool Value::operator<(const Value& other) const {
char const* other_str; char const* other_str;
decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str); decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
unsigned min_len = std::min(this_len, other_len); unsigned min_len = std::min<unsigned>(this_len, other_len);
JSON_ASSERT(this_str && other_str); JSON_ASSERT(this_str && other_str);
int comp = memcmp(this_str, other_str, min_len); int comp = memcmp(this_str, other_str, min_len);
if (comp < 0) return true; if (comp < 0) return true;