mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge branch 'remove_moar_booooost' into 'master'
Remove boost:: constructs See merge request OpenMW/openmw!1948
This commit is contained in:
commit
1712a8779c
@ -31,7 +31,6 @@
|
||||
|
||||
#include <lz4frame.h>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include <boost/iostreams/filtering_streambuf.hpp>
|
||||
#include <boost/iostreams/copy.hpp>
|
||||
@ -89,19 +88,19 @@ void CompressedBSAFile::getBZString(std::string& str, std::istream& filestream)
|
||||
char size = 0;
|
||||
filestream.read(&size, 1);
|
||||
|
||||
boost::scoped_array<char> buf(new char[size]);
|
||||
filestream.read(buf.get(), size);
|
||||
auto buf = std::vector<char>(size);
|
||||
filestream.read(buf.data(), size);
|
||||
|
||||
if (buf[size - 1] != 0)
|
||||
{
|
||||
str.assign(buf.get(), size);
|
||||
str.assign(buf.data(), size);
|
||||
if (str.size() != ((size_t)size)) {
|
||||
fail("getBZString string size mismatch");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
str.assign(buf.get(), size - 1); // don't copy null terminator
|
||||
str.assign(buf.data(), size - 1); // don't copy null terminator
|
||||
if (str.size() != ((size_t)size - 1)) {
|
||||
fail("getBZString string size mismatch (null terminator)");
|
||||
}
|
||||
@ -384,12 +383,12 @@ Files::IStreamPtr CompressedBSAFile::getFile(const FileRecord& fileRecord)
|
||||
}
|
||||
else // SSE: lz4
|
||||
{
|
||||
boost::scoped_array<char> buffer(new char[size]);
|
||||
fileStream->read(buffer.get(), size);
|
||||
auto buffer = std::vector<char>(size);
|
||||
fileStream->read(buffer.data(), size);
|
||||
LZ4F_decompressionContext_t context = nullptr;
|
||||
LZ4F_createDecompressionContext(&context, LZ4F_VERSION);
|
||||
LZ4F_decompressOptions_t options = {};
|
||||
LZ4F_errorCode_t errorCode = LZ4F_decompress(context, memoryStreamPtr->getRawData(), &uncompressedSize, buffer.get(), &size, &options);
|
||||
LZ4F_errorCode_t errorCode = LZ4F_decompress(context, memoryStreamPtr->getRawData(), &uncompressedSize, buffer.data(), &size, &options);
|
||||
if (LZ4F_isError(errorCode))
|
||||
fail("LZ4 decompression error (file " + mFilename + "): " + LZ4F_getErrorName(errorCode));
|
||||
errorCode = LZ4F_freeDecompressionContext(context);
|
||||
|
@ -46,9 +46,9 @@
|
||||
#endif
|
||||
#include <boost/iostreams/filtering_streambuf.hpp>
|
||||
#include <boost/iostreams/copy.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <components/bsa/memorystream.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include "formid.hpp"
|
||||
|
||||
@ -559,14 +559,14 @@ void Reader::updateModIndices(const std::vector<std::string>& files)
|
||||
std::unordered_map<std::string, size_t> fileIndex;
|
||||
|
||||
for (size_t i = 0; i < files.size(); ++i) // ATTENTION: assumes current file is not included
|
||||
fileIndex[boost::to_lower_copy<std::string>(files[i])] = i;
|
||||
fileIndex[Misc::StringUtils::lowerCase(files[i])] = i;
|
||||
|
||||
mCtx.parentFileIndices.resize(mHeader.mMaster.size());
|
||||
for (unsigned int i = 0; i < mHeader.mMaster.size(); ++i)
|
||||
{
|
||||
// locate the position of the dependency in already loaded files
|
||||
std::unordered_map<std::string, size_t>::const_iterator it
|
||||
= fileIndex.find(boost::to_lower_copy<std::string>(mHeader.mMaster[i].name));
|
||||
= fileIndex.find(Misc::StringUtils::lowerCase(mHeader.mMaster[i].name));
|
||||
|
||||
if (it != fileIndex.end())
|
||||
mCtx.parentFileIndices[i] = (std::uint32_t)((it->second << 24) & 0xff000000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user