Skip to content

Commit

Permalink
Bug#30898701 UPGRADE THE RAPIDJSON LIBRARY [2/2, mac build errors]
Browse files Browse the repository at this point in the history
Building the latest rapidjson fails on OSX with the following
errors (error message is trucated for readability):

  ambiguous conversion for functional-style cast from
  'rapidjson::SizeType' (aka 'unsigned long') to
  'rapidjson::GenericSchemaValidator<rapidjson:: [...]

Resolve this ambiguity by adding explicit casts.

Change-Id: Ib46739de1ab798db86fa8297c6c4dcf19e63967d
  • Loading branch information
Erik Froseth committed Feb 20, 2020
1 parent dd748e9 commit cdb7606
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions extra/rapidjson/include/rapidjson/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -1916,11 +1916,11 @@ class GenericSchemaValidator :

void TooLong(const Ch* str, SizeType length, SizeType expected) {
AddNumberError(SchemaType::GetMaxLengthString(),
ValueType(str, length, GetStateAllocator()).Move(), SValue(expected).Move());
ValueType(str, length, GetStateAllocator()).Move(), SValue(uint64_t{expected}).Move());
}
void TooShort(const Ch* str, SizeType length, SizeType expected) {
AddNumberError(SchemaType::GetMinLengthString(),
ValueType(str, length, GetStateAllocator()).Move(), SValue(expected).Move());
ValueType(str, length, GetStateAllocator()).Move(), SValue(uint64_t{expected}).Move());
}
void DoesNotMatch(const Ch* str, SizeType length) {
currentError_.SetObject();
Expand All @@ -1930,33 +1930,33 @@ class GenericSchemaValidator :

void DisallowedItem(SizeType index) {
currentError_.SetObject();
currentError_.AddMember(GetDisallowedString(), ValueType(index).Move(), GetStateAllocator());
currentError_.AddMember(GetDisallowedString(), ValueType(uint64_t{index}).Move(), GetStateAllocator());
AddCurrentError(SchemaType::GetAdditionalItemsString(), true);
}
void TooFewItems(SizeType actualCount, SizeType expectedCount) {
AddNumberError(SchemaType::GetMinItemsString(),
ValueType(actualCount).Move(), SValue(expectedCount).Move());
ValueType(uint64_t{actualCount}).Move(), SValue(uint64_t{expectedCount}).Move());
}
void TooManyItems(SizeType actualCount, SizeType expectedCount) {
AddNumberError(SchemaType::GetMaxItemsString(),
ValueType(actualCount).Move(), SValue(expectedCount).Move());
ValueType(uint64_t{actualCount}).Move(), SValue(uint64_t{expectedCount}).Move());
}
void DuplicateItems(SizeType index1, SizeType index2) {
ValueType duplicates(kArrayType);
duplicates.PushBack(index1, GetStateAllocator());
duplicates.PushBack(index2, GetStateAllocator());
duplicates.PushBack(uint64_t{index1}, GetStateAllocator());
duplicates.PushBack(uint64_t{index2}, GetStateAllocator());
currentError_.SetObject();
currentError_.AddMember(GetDuplicatesString(), duplicates, GetStateAllocator());
AddCurrentError(SchemaType::GetUniqueItemsString(), true);
}

void TooManyProperties(SizeType actualCount, SizeType expectedCount) {
AddNumberError(SchemaType::GetMaxPropertiesString(),
ValueType(actualCount).Move(), SValue(expectedCount).Move());
ValueType(uint64_t{actualCount}).Move(), SValue(uint64_t{expectedCount}).Move());
}
void TooFewProperties(SizeType actualCount, SizeType expectedCount) {
AddNumberError(SchemaType::GetMinPropertiesString(),
ValueType(actualCount).Move(), SValue(expectedCount).Move());
ValueType(uint64_t{actualCount}).Move(), SValue(uint64_t{expectedCount}).Move());
}
void StartMissingProperties() {
currentError_.SetArray();
Expand Down

0 comments on commit cdb7606

Please sign in to comment.