File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,8 @@ class Reader
94
94
*
95
95
* @param archive The shared pointer to the Archive object.
96
96
*/
97
- explicit DEPRECATED Reader (const std::shared_ptr<zim::Archive> archive);
97
+ explicit DEPRECATED Reader (const std::shared_ptr<zim::Archive> archive)
98
+ : Reader(archive, true ) {};
98
99
#ifndef _WIN32
99
100
explicit DEPRECATED Reader (int fd);
100
101
DEPRECATED Reader (int fd, zim::offset_type offset, zim::size_type size);
@@ -490,6 +491,15 @@ class Reader
490
491
491
492
private:
492
493
std::map<const std::string, unsigned int > parseCounterMetadata () const ;
494
+
495
+ // Reader is deprecated, so we've marked the constructor as deprecated.
496
+ // But we still need to construct the reader (in our deprecated code)
497
+ // To avoid warning because we use deprecated function, we create a
498
+ // constructor not deprecated. The `bool marker` is unused, it sole purpose
499
+ // is to change the signature to have a different constructor.
500
+ // This one is not deprecated and we must use it in our private code.
501
+ Reader (const std::shared_ptr<zim::Archive> archive, bool marker);
502
+ friend class Library ;
493
503
};
494
504
}
495
505
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ std::shared_ptr<Reader> Library::getReaderById(const std::string& id)
219
219
if ( !archive )
220
220
return nullptr ;
221
221
222
- const auto reader = make_shared< Reader> (archive);
222
+ const shared_ptr<Reader> reader ( new Reader (archive, true ) );
223
223
std::lock_guard<std::mutex> lock (m_mutex);
224
224
m_readers[id] = reader;
225
225
return reader;
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ Reader::Reader(const string zimFilePath)
52
52
srand (time (nullptr ));
53
53
}
54
54
55
- Reader::Reader (const std::shared_ptr<zim::Archive> archive)
55
+ Reader::Reader (const std::shared_ptr<zim::Archive> archive, bool _marker )
56
56
: zimArchive(archive),
57
57
zimFilePath(archive->getFilename ())
58
58
{}
You can’t perform that action at this time.
0 commit comments