diff options
| author | Connor McLaughlin <stenzek@gmail.com> | 2019-08-09 23:39:01 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-09 23:39:01 +1000 |
| commit | 48ca2c6f2e70111cf72052d5d258328c2fdb9afd (patch) | |
| tree | 9d69b41773993fb46b53fea45377b85136b6014c /Source/Core/VideoCommon/PostProcessing.cpp | |
| parent | 0ab7e2eed78731db4b0b2c48f35f85d3a6722272 (diff) | |
| parent | 117a60ceb271594a659392892de2cd1a957bef48 (diff) | |
Merge pull request #8233 from JosJuice/stringutil-string-view
StringUtil: Use std::string_view more
Diffstat (limited to 'Source/Core/VideoCommon/PostProcessing.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PostProcessing.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 77f77cb9ce..859715542b 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -6,6 +6,7 @@ #include <sstream> #include <string> +#include <string_view> #include "Common/Assert.h" #include "Common/CommonPaths.h" @@ -117,16 +118,15 @@ void PostProcessingConfiguration::LoadOptions(const std::string& code) GLSLStringOption* current_strings = nullptr; while (!in.eof()) { - std::string line; - - if (std::getline(in, line)) + std::string line_str; + if (std::getline(in, line_str)) { + std::string_view line = line_str; + #ifndef _WIN32 // Check for CRLF eol and convert it to LF if (!line.empty() && line.at(line.size() - 1) == '\r') - { - line.erase(line.size() - 1); - } + line.remove_suffix(1); #endif if (!line.empty()) @@ -138,8 +138,8 @@ void PostProcessingConfiguration::LoadOptions(const std::string& code) if (endpos != std::string::npos) { // New section! - std::string sub = line.substr(1, endpos - 1); - option_strings.push_back({sub}); + std::string_view sub = line.substr(1, endpos - 1); + option_strings.push_back({std::string(sub)}); current_strings = &option_strings.back(); } } |
