Skip to content

Commit

Permalink
Bug#34792059 Update rapidjson library [2/2, build errors]
Browse files Browse the repository at this point in the history
1. 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.
This is a port of change Ib46739de1ab798db86fa8297c6c4dcf19e63967d

2. Fix Woverloaded-virtual in My_remote_schema_document_provider by
using rapidjson::IRemoteSchemaDocumentProvider::GetRemoteDocument

Change-Id: Ib644a0d3269c5204591eb664fecbb869b270c9e3
  • Loading branch information
Georgios Psaropoulos committed Dec 1, 2022
1 parent b5e33dd commit 3c8e94a
Show file tree
Hide file tree
Showing 2 changed files with 11 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 @@ -2180,11 +2180,11 @@ class GenericSchemaValidator :

void TooLong(const Ch* str, SizeType length, SizeType expected) {
AddNumberError(kValidateErrorMaxLength,
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(kValidateErrorMinLength,
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 @@ -2194,33 +2194,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(kValidateErrorAdditionalItems, true);
}
void TooFewItems(SizeType actualCount, SizeType expectedCount) {
AddNumberError(kValidateErrorMinItems,
ValueType(actualCount).Move(), SValue(expectedCount).Move());
ValueType(uint64_t{actualCount}).Move(), SValue(uint64_t{expectedCount}).Move());
}
void TooManyItems(SizeType actualCount, SizeType expectedCount) {
AddNumberError(kValidateErrorMaxItems,
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(kValidateErrorUniqueItems, true);
}

void TooManyProperties(SizeType actualCount, SizeType expectedCount) {
AddNumberError(kValidateErrorMaxProperties,
ValueType(actualCount).Move(), SValue(expectedCount).Move());
ValueType(uint64_t{actualCount}).Move(), SValue(uint64_t{expectedCount}).Move());
}
void TooFewProperties(SizeType actualCount, SizeType expectedCount) {
AddNumberError(kValidateErrorMinProperties,
ValueType(actualCount).Move(), SValue(expectedCount).Move());
ValueType(uint64_t{actualCount}).Move(), SValue(uint64_t{expectedCount}).Move());
}
void StartMissingProperties() {
currentError_.SetArray();
Expand Down
2 changes: 2 additions & 0 deletions sql/json_schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class Json_schema_validator {
class My_remote_schema_document_provider
: public rapidjson::IRemoteSchemaDocumentProvider {
public:
using rapidjson::IRemoteSchemaDocumentProvider::GetRemoteDocument;

const rapidjson::SchemaDocument *GetRemoteDocument(
const char *, rapidjson::SizeType) override {
m_used = true;
Expand Down

0 comments on commit 3c8e94a

Please sign in to comment.