diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2025-01-08 05:27:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-08 05:27:42 +0100 |
| commit | 7133bfbb0e5d091782f83d8fec56f300977600c1 (patch) | |
| tree | f431ab40aba30a447b4d20c536ce91914fdde66c /Source/Core/VideoCommon/PostProcessing.cpp | |
| parent | 696b363f478961bb18420b79ef9f09eabd600e55 (diff) | |
| parent | 0938fca6e360e8635ef3ce95985aaef837b9fb56 (diff) | |
Merge pull request #13180 from jordan-woyak/eof-logic
Core/VideoCommon: Fix some weird (!eof) logic.
Diffstat (limited to 'Source/Core/VideoCommon/PostProcessing.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PostProcessing.cpp | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 7b66269ec7..e7ff694161 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -137,43 +137,40 @@ void PostProcessingConfiguration::LoadOptions(const std::string& code) std::vector<GLSLStringOption> option_strings; GLSLStringOption* current_strings = nullptr; - while (!in.eof()) + std::string line_str; + while (std::getline(in, line_str)) { - std::string line_str; - if (std::getline(in, line_str)) - { - std::string_view line = 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.remove_suffix(1); + // Check for CRLF eol and convert it to LF + if (!line.empty() && line.at(line.size() - 1) == '\r') + line.remove_suffix(1); #endif - if (!line.empty()) + if (!line.empty()) + { + if (line[0] == '[') { - if (line[0] == '[') + size_t endpos = line.find("]"); + + if (endpos != std::string::npos) { - size_t endpos = line.find("]"); - - if (endpos != std::string::npos) - { - // New section! - std::string_view sub = line.substr(1, endpos - 1); - option_strings.push_back({std::string(sub)}); - current_strings = &option_strings.back(); - } + // New section! + std::string_view sub = line.substr(1, endpos - 1); + option_strings.push_back({std::string(sub)}); + current_strings = &option_strings.back(); } - else + } + else + { + if (current_strings) { - if (current_strings) - { - std::string key, value; - Common::IniFile::ParseLine(line, &key, &value); - - if (!(key.empty() && value.empty())) - current_strings->m_options.emplace_back(key, value); - } + std::string key, value; + Common::IniFile::ParseLine(line, &key, &value); + + if (!(key.empty() && value.empty())) + current_strings->m_options.emplace_back(key, value); } } } |
