From e331a761762b23810df8c399c1f62d694fe48e4d Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 30 Oct 2017 17:09:05 +0000 Subject: [PATCH] ConfigInfo: Switch to doing case-insensitive comparison --- Source/Core/Common/Common.vcxproj | 4 ++-- Source/Core/Common/Config/ConfigInfo.cpp | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj index 853cff6d0f..7d8ba3b2b0 100644 --- a/Source/Core/Common/Common.vcxproj +++ b/Source/Core/Common/Common.vcxproj @@ -55,9 +55,9 @@ + - @@ -170,8 +170,8 @@ + - diff --git a/Source/Core/Common/Config/ConfigInfo.cpp b/Source/Core/Common/Config/ConfigInfo.cpp index cc34a2d9f0..47d2e25c84 100644 --- a/Source/Core/Common/Config/ConfigInfo.cpp +++ b/Source/Core/Common/Config/ConfigInfo.cpp @@ -2,15 +2,17 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include +#include +#include "Common/CommonFuncs.h" #include "Common/Config/ConfigInfo.h" namespace Config { bool ConfigLocation::operator==(const ConfigLocation& other) const { - return std::tie(system, section, key) == std::tie(other.system, other.section, other.key); + return system == other.system && strcasecmp(section.c_str(), other.section.c_str()) == 0 && + strcasecmp(key.c_str(), other.key.c_str()) == 0; } bool ConfigLocation::operator!=(const ConfigLocation& other) const @@ -20,6 +22,14 @@ bool ConfigLocation::operator!=(const ConfigLocation& other) const bool ConfigLocation::operator<(const ConfigLocation& other) const { - return std::tie(system, section, key) < std::tie(other.system, other.section, other.key); + if (system != other.system) + return system < other.system; + + const int section_compare = strcasecmp(section.c_str(), other.section.c_str()); + if (section_compare != 0) + return section_compare < 0; + + const int key_compare = strcasecmp(key.c_str(), other.key.c_str()); + return key_compare < 0; } }