fix(menus): make functions case insensitive

This commit is contained in:
6arelyFuture 2023-12-10 21:33:02 +01:00
parent 20af6c4ba5
commit b8b76adc73
Signed by: Future
GPG Key ID: FA77F074E98D98A5
2 changed files with 3 additions and 2 deletions

View File

@ -92,6 +92,7 @@ std::unique_ptr<ISimpleExpression> MenuExpressionMatchers::ProcessOperandExtensi
const auto& functionCallToken = result.NextCapture(CAPTURE_FUNCTION_NAME); const auto& functionCallToken = result.NextCapture(CAPTURE_FUNCTION_NAME);
auto functionCallName = functionCallToken.IdentifierValue(); auto functionCallName = functionCallToken.IdentifierValue();
utils::MakeStringLowerCase(functionCallName);
const auto& baseFunctionMap = GetBaseFunctionMapForFeatureLevel(m_state->m_feature_level); const auto& baseFunctionMap = GetBaseFunctionMapForFeatureLevel(m_state->m_feature_level);
const auto foundBaseFunction = baseFunctionMap.find(functionCallName); const auto foundBaseFunction = baseFunctionMap.find(functionCallName);

View File

@ -92,12 +92,12 @@ namespace utils
void MakeStringLowerCase(std::string& str) void MakeStringLowerCase(std::string& str)
{ {
for (auto& c : str) for (auto& c : str)
c = static_cast<char>(tolower(c)); c = static_cast<char>(tolower(static_cast<unsigned char>(c)));
} }
void MakeStringUpperCase(std::string& str) void MakeStringUpperCase(std::string& str)
{ {
for (auto& c : str) for (auto& c : str)
c = static_cast<char>(toupper(c)); c = static_cast<char>(toupper(static_cast<unsigned char>(c)));
} }
} // namespace utils } // namespace utils