From eb9dfcedbde44209a9a46aa2897817724366991d Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Fri, 12 Nov 2021 15:13:11 +0100 Subject: [PATCH] [util] Move toLower transform to function --- src/util/config/config.cpp | 9 +++++++-- src/util/config/config.h | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/util/config/config.cpp b/src/util/config/config.cpp index 08ddd8d5..b25ace2b 100644 --- a/src/util/config/config.cpp +++ b/src/util/config/config.cpp @@ -635,8 +635,7 @@ namespace dxvk { I begin, I end, V& value) { - std::transform(str.begin(), str.end(), str.begin(), - [] (unsigned char c) { return (c >= 'A' && c <= 'Z') ? (c + 'a' - 'A') : c; }); + str = Config::toLower(str); for (auto i = begin; i != end; i++) { if (str == i->first) { @@ -708,4 +707,10 @@ namespace dxvk { } } + std::string Config::toLower(std::string str) { + std::transform(str.begin(), str.end(), str.begin(), + [] (unsigned char c) { return (c >= 'A' && c <= 'Z') ? (c + 'a' - 'A') : c; }); + return str; + } + } diff --git a/src/util/config/config.h b/src/util/config/config.h index 5951a27c..f947272c 100644 --- a/src/util/config/config.h +++ b/src/util/config/config.h @@ -102,6 +102,8 @@ namespace dxvk { */ static Config getUserConfig(); + static std::string toLower(std::string str); + private: OptionMap m_options; @@ -149,4 +151,4 @@ namespace dxvk { option |= state == Tristate::True; } -} \ No newline at end of file +}