ConfigInfo: Switch to doing case-insensitive comparison
This commit is contained in:
parent
ec7b84c5f2
commit
e331a76176
|
@ -55,9 +55,9 @@
|
||||||
<ClInclude Include="CommonPaths.h" />
|
<ClInclude Include="CommonPaths.h" />
|
||||||
<ClInclude Include="CommonTypes.h" />
|
<ClInclude Include="CommonTypes.h" />
|
||||||
<ClInclude Include="Config\Config.h" />
|
<ClInclude Include="Config\Config.h" />
|
||||||
|
<ClInclude Include="Config\ConfigInfo.h" />
|
||||||
<ClInclude Include="Config\Enums.h" />
|
<ClInclude Include="Config\Enums.h" />
|
||||||
<ClInclude Include="Config\Layer.h" />
|
<ClInclude Include="Config\Layer.h" />
|
||||||
<ClInclude Include="Config\Section.h" />
|
|
||||||
<ClInclude Include="CPUDetect.h" />
|
<ClInclude Include="CPUDetect.h" />
|
||||||
<ClInclude Include="DebugInterface.h" />
|
<ClInclude Include="DebugInterface.h" />
|
||||||
<ClInclude Include="ENetUtil.h" />
|
<ClInclude Include="ENetUtil.h" />
|
||||||
|
@ -170,8 +170,8 @@
|
||||||
<ClCompile Include="CommonFuncs.cpp" />
|
<ClCompile Include="CommonFuncs.cpp" />
|
||||||
<ClCompile Include="CompatPatches.cpp" />
|
<ClCompile Include="CompatPatches.cpp" />
|
||||||
<ClCompile Include="Config\Config.cpp" />
|
<ClCompile Include="Config\Config.cpp" />
|
||||||
|
<ClCompile Include="Config\ConfigInfo.cpp" />
|
||||||
<ClCompile Include="Config\Layer.cpp" />
|
<ClCompile Include="Config\Layer.cpp" />
|
||||||
<ClCompile Include="Config\Section.cpp" />
|
|
||||||
<ClCompile Include="ENetUtil.cpp" />
|
<ClCompile Include="ENetUtil.cpp" />
|
||||||
<ClCompile Include="File.cpp" />
|
<ClCompile Include="File.cpp" />
|
||||||
<ClCompile Include="FileSearch.cpp" />
|
<ClCompile Include="FileSearch.cpp" />
|
||||||
|
|
|
@ -2,15 +2,17 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <strings.h>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "Common/CommonFuncs.h"
|
||||||
#include "Common/Config/ConfigInfo.h"
|
#include "Common/Config/ConfigInfo.h"
|
||||||
|
|
||||||
namespace Config
|
namespace Config
|
||||||
{
|
{
|
||||||
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);
|
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
|
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
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue