mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Proper conversion from shared_ptr<bsa::MemoryinputStream> to shared_ptr<std::istream>
This commit is contained in:
parent
b9a7514278
commit
e502819246
1 changed files with 4 additions and 5 deletions
|
@ -353,13 +353,12 @@ Files::IStreamPtr TES4BSAFile::getFile(const FileRecord& fileRecord) {
|
||||||
inputStreamBuf.push(boost::iostreams::zlib_decompressor());
|
inputStreamBuf.push(boost::iostreams::zlib_decompressor());
|
||||||
inputStreamBuf.push(*fileStream);
|
inputStreamBuf.push(*fileStream);
|
||||||
|
|
||||||
std::shared_ptr<std::vector<char> > bufferVec = std::make_shared<std::vector<char>>(uncompressedSize);
|
std::shared_ptr<Bsa::MemoryInputStream> memoryStreamPtr = std::make_shared<MemoryInputStream>(uncompressedSize);
|
||||||
Bsa::MemoryInputStream* result = new MemoryInputStream(uncompressedSize);
|
|
||||||
|
|
||||||
boost::iostreams::basic_array_sink<char> sr(result->getRawData(), uncompressedSize);
|
boost::iostreams::basic_array_sink<char> sr(memoryStreamPtr->getRawData(), uncompressedSize);
|
||||||
boost::iostreams::copy(inputStreamBuf, sr);
|
boost::iostreams::copy(inputStreamBuf, sr);
|
||||||
std::istream* pPtr = (std::istream*) result;
|
|
||||||
return std::shared_ptr<std::istream>(pPtr);
|
return std::shared_ptr<std::istream>(memoryStreamPtr, (std::istream*)memoryStreamPtr.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Files::openConstrainedFileStream(mFilename.c_str(), fileRecord.offset, fileRecord.size);
|
return Files::openConstrainedFileStream(mFilename.c_str(), fileRecord.offset, fileRecord.size);
|
||||||
|
|
Loading…
Reference in a new issue