From aeb3733e575a3ca73f48f074ba703f27004306d5 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 29 May 2022 21:16:00 +0200 Subject: [PATCH] Remove boost:: constructs Namely boost::scoped_array and boost::to_lower_copy. --- components/bsa/compressedbsafile.cpp | 15 +++++++-------- components/esm4/reader.cpp | 6 +++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/components/bsa/compressedbsafile.cpp b/components/bsa/compressedbsafile.cpp index 6c0eb47319..337b03b6cb 100644 --- a/components/bsa/compressedbsafile.cpp +++ b/components/bsa/compressedbsafile.cpp @@ -31,7 +31,6 @@ #include -#include #include #include @@ -89,19 +88,19 @@ void CompressedBSAFile::getBZString(std::string& str, std::istream& filestream) char size = 0; filestream.read(&size, 1); - boost::scoped_array buf(new char[size]); - filestream.read(buf.get(), size); + auto buf = std::vector(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 buffer(new char[size]); - fileStream->read(buffer.get(), size); + auto buffer = std::vector(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); diff --git a/components/esm4/reader.cpp b/components/esm4/reader.cpp index 3966a18bc4..19649c4fa6 100644 --- a/components/esm4/reader.cpp +++ b/components/esm4/reader.cpp @@ -46,9 +46,9 @@ #endif #include #include -#include #include +#include #include "formid.hpp" @@ -559,14 +559,14 @@ void Reader::updateModIndices(const std::vector& files) std::unordered_map fileIndex; for (size_t i = 0; i < files.size(); ++i) // ATTENTION: assumes current file is not included - fileIndex[boost::to_lower_copy(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::const_iterator it - = fileIndex.find(boost::to_lower_copy(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);