From 0483443e02d3ea8f97e4b00efdfb4a01a6172d4d Mon Sep 17 00:00:00 2001 From: Esther Wang Date: Wed, 6 Dec 2023 17:39:15 +0800 Subject: [PATCH] Fix hidden overloaded virtual function 'RemoteSchemaDocumentProvider::GetRemoteDocument' and 'SchemaDocumentProvider::GetRemoteDocument' hide the vitual function 'IGenericRemoteSchemaDocumentProvider::GetRemoteDocument'. Add using statement to fix overloaded-virtual warnings. --- test/unittest/schematest.cpp | 39 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/test/unittest/schematest.cpp b/test/unittest/schematest.cpp index dbc467ea3..4f6be6dd1 100644 --- a/test/unittest/schematest.cpp +++ b/test/unittest/schematest.cpp @@ -2155,6 +2155,7 @@ class RemoteSchemaDocumentProvider : public IGenericRemoteSchemaDocumentProvider delete sd_[i]; } + using IGenericRemoteSchemaDocumentProvider::GetRemoteDocument; virtual const SchemaDocumentType* GetRemoteDocument(const char* uri, SizeType length) { //printf("GetRemoteDocument : %s\n", uri); for (size_t i = 0; i < kCount; i++) @@ -2636,26 +2637,28 @@ TEST(SchemaValidator, Ref_internal_multiple_ids) { CrtAllocator::Free(schema); } -TEST(SchemaValidator, Ref_remote_issue1210) { - class SchemaDocumentProvider : public IRemoteSchemaDocumentProvider { - SchemaDocument** collection; +class SchemaDocumentProvider : public IRemoteSchemaDocumentProvider { + SchemaDocument** collection; - // Dummy private copy constructor & assignment operator. - // Function bodies added so that they compile in MSVC 2019. - SchemaDocumentProvider(const SchemaDocumentProvider&) : collection(NULL) { - } - SchemaDocumentProvider& operator=(const SchemaDocumentProvider&) { - return *this; - } + // Dummy private copy constructor & assignment operator. + // Function bodies added so that they compile in MSVC 2019. + SchemaDocumentProvider(const SchemaDocumentProvider&) : collection(NULL) { + } + SchemaDocumentProvider& operator=(const SchemaDocumentProvider&) { + return *this; + } - public: - SchemaDocumentProvider(SchemaDocument** collection) : collection(collection) { } - virtual const SchemaDocument* GetRemoteDocument(const char* uri, SizeType length) { - int i = 0; - while (collection[i] && SchemaDocument::GValue(uri, length) != collection[i]->GetURI()) ++i; - return collection[i]; - } - }; +public: + SchemaDocumentProvider(SchemaDocument** collection) : collection(collection) { } + using IGenericRemoteSchemaDocumentProvider::GetRemoteDocument; + virtual const SchemaDocument* GetRemoteDocument(const char* uri, SizeType length) { + int i = 0; + while (collection[i] && SchemaDocument::GValue(uri, length) != collection[i]->GetURI()) ++i; + return collection[i]; + } +}; + +TEST(SchemaValidator, Ref_remote_issue1210) { SchemaDocument* collection[] = { 0, 0, 0 }; SchemaDocumentProvider provider(collection);