diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index 2e64168046..9d90a542be 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -284,7 +284,7 @@ void loadCell(const Arguments& info, ESM::Cell &cell, ESM::ESMReader &esm, ESMDa } } -void printRawTes3(const std::string& path) +void printRawTes3(std::string_view path) { std::cout << "TES3 RAW file listing: " << path << '\n'; ESM::ESMReader esm; diff --git a/components/esm3/esmreader.cpp b/components/esm3/esmreader.cpp index 08cd100ab1..68228a8156 100644 --- a/components/esm3/esmreader.cpp +++ b/components/esm3/esmreader.cpp @@ -84,7 +84,7 @@ void ESMReader::resolveParentFileIndices(const std::vector& allPlugin } } -void ESMReader::openRaw(std::unique_ptr&& stream, const std::string& name) +void ESMReader::openRaw(std::unique_ptr&& stream, std::string_view name) { close(); mEsm = std::move(stream); @@ -94,9 +94,9 @@ void ESMReader::openRaw(std::unique_ptr&& stream, const std::strin mEsm->seekg(0, mEsm->beg); } -void ESMReader::openRaw(const std::string& filename) +void ESMReader::openRaw(std::string_view filename) { - openRaw(Files::openBinaryInputFileStream(filename), filename); + openRaw(Files::openBinaryInputFileStream(std::string(filename)), filename); } void ESMReader::open(std::unique_ptr&& stream, const std::string &name) diff --git a/components/esm3/esmreader.hpp b/components/esm3/esmreader.hpp index 2c987ef025..658a409ed6 100644 --- a/components/esm3/esmreader.hpp +++ b/components/esm3/esmreader.hpp @@ -61,7 +61,7 @@ public: /// Raw opening. Opens the file and sets everything up but doesn't /// parse the header. - void openRaw(std::unique_ptr&& stream, const std::string &name); + void openRaw(std::unique_ptr&& stream, std::string_view name); /// Load ES file from a new stream, parses the header. Closes the /// currently open file first, if any. @@ -69,7 +69,7 @@ public: void open(const std::string &file); - void openRaw(const std::string &filename); + void openRaw(std::string_view filename); /// Get the current position in the file. Make sure that the file has been opened! size_t getFileOffset() const { return mEsm->tellg(); }; diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index 4ef0d7a0ea..57fe2cb0e8 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -292,12 +292,9 @@ namespace Shader } const char* defaultTextures[] = { "diffuseMap", "normalMap", "emissiveMap", "darkMap", "detailMap", "envMap", "specularMap", "decalMap", "bumpMap", "glossMap" }; - bool isTextureNameRecognized(const std::string& name) + bool isTextureNameRecognized(std::string_view name) { - for (unsigned int i=0; i stateset, osg::Node& node) diff --git a/components/to_utf8/to_utf8.cpp b/components/to_utf8/to_utf8.cpp index 7e7d3101fc..6e04db8db4 100644 --- a/components/to_utf8/to_utf8.cpp +++ b/components/to_utf8/to_utf8.cpp @@ -348,7 +348,7 @@ std::string_view Utf8Encoder::getLegacyEnc(std::string_view input) return mImpl.getLegacyEnc(input, BufferAllocationPolicy::UseGrowFactor, mBuffer); } -ToUTF8::FromType ToUTF8::calculateEncoding(const std::string& encodingName) +ToUTF8::FromType ToUTF8::calculateEncoding(std::string_view encodingName) { if (encodingName == "win1250") return ToUTF8::WINDOWS_1250; @@ -357,10 +357,10 @@ ToUTF8::FromType ToUTF8::calculateEncoding(const std::string& encodingName) else if (encodingName == "win1252") return ToUTF8::WINDOWS_1252; else - throw std::runtime_error(std::string("Unknown encoding '") + encodingName + std::string("', see openmw --help for available options.")); + throw std::runtime_error("Unknown encoding '" + std::string(encodingName) + "', see openmw --help for available options."); } -std::string ToUTF8::encodingUsingMessage(const std::string& encodingName) +std::string ToUTF8::encodingUsingMessage(std::string_view encodingName) { if (encodingName == "win1250") return "Using Central and Eastern European font encoding."; @@ -369,5 +369,5 @@ std::string ToUTF8::encodingUsingMessage(const std::string& encodingName) else if (encodingName == "win1252") return "Using default (English) font encoding."; else - throw std::runtime_error(std::string("Unknown encoding '") + encodingName + std::string("', see openmw --help for available options.")); + throw std::runtime_error("Unknown encoding '" + std::string(encodingName) + "', see openmw --help for available options."); } diff --git a/components/to_utf8/to_utf8.hpp b/components/to_utf8/to_utf8.hpp index 037e3ea3bf..918f03aa9f 100644 --- a/components/to_utf8/to_utf8.hpp +++ b/components/to_utf8/to_utf8.hpp @@ -24,8 +24,8 @@ namespace ToUTF8 UseGrowFactor, }; - FromType calculateEncoding(const std::string& encodingName); - std::string encodingUsingMessage(const std::string& encodingName); + FromType calculateEncoding(std::string_view encodingName); + std::string encodingUsingMessage(std::string_view encodingName); class StatelessUtf8Encoder {