mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #680 from kiwix/fix_windows_compilation
Add a new private constructor not deprecated for Reader.
This commit is contained in:
commit
2ccea8e370
|
@ -94,7 +94,8 @@ class Reader
|
|||
*
|
||||
* @param archive The shared pointer to the Archive object.
|
||||
*/
|
||||
explicit DEPRECATED Reader(const std::shared_ptr<zim::Archive> archive);
|
||||
explicit DEPRECATED Reader(const std::shared_ptr<zim::Archive> archive)
|
||||
: Reader(archive, true) {};
|
||||
#ifndef _WIN32
|
||||
explicit DEPRECATED Reader(int fd);
|
||||
DEPRECATED Reader(int fd, zim::offset_type offset, zim::size_type size);
|
||||
|
@ -490,6 +491,15 @@ class Reader
|
|||
|
||||
private:
|
||||
std::map<const std::string, unsigned int> parseCounterMetadata() const;
|
||||
|
||||
// Reader is deprecated, so we've marked the constructor as deprecated.
|
||||
// But we still need to construct the reader (in our deprecated code)
|
||||
// To avoid warning because we use deprecated function, we create a
|
||||
// constructor not deprecated. The `bool marker` is unused, it sole purpose
|
||||
// is to change the signature to have a different constructor.
|
||||
// This one is not deprecated and we must use it in our private code.
|
||||
Reader(const std::shared_ptr<zim::Archive> archive, bool marker);
|
||||
friend class Library;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ std::shared_ptr<Reader> Library::getReaderById(const std::string& id)
|
|||
if ( !archive )
|
||||
return nullptr;
|
||||
|
||||
const auto reader = make_shared<Reader>(archive);
|
||||
const shared_ptr<Reader> reader(new Reader(archive, true));
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_readers[id] = reader;
|
||||
return reader;
|
||||
|
|
|
@ -52,7 +52,7 @@ Reader::Reader(const string zimFilePath)
|
|||
srand(time(nullptr));
|
||||
}
|
||||
|
||||
Reader::Reader(const std::shared_ptr<zim::Archive> archive)
|
||||
Reader::Reader(const std::shared_ptr<zim::Archive> archive, bool _marker)
|
||||
: zimArchive(archive),
|
||||
zimFilePath(archive->getFilename())
|
||||
{}
|
||||
|
|
Loading…
Reference in New Issue