1
0
Fork 0

Proper fix for #3136 (#3143)

This commit is contained in:
Alexander Harkness 2016-04-18 23:04:13 +01:00 committed by Tiger Wang
parent 931ee84685
commit e0e3f396f2
1 changed files with 11 additions and 17 deletions

View File

@ -108,30 +108,24 @@ std::vector<std::pair<AString, AString>> cOverridesSettingsRepository::GetValues
{
auto overrides = m_Overrides->GetValues(a_keyName);
auto main = m_Main->GetValues(a_keyName);
std::sort(overrides.begin(), overrides.end(), [](std::pair<AString, AString> a, std::pair<AString, AString> b) -> bool { return a < b ;});
std::sort(main.begin(), main.end(), [](std::pair<AString, AString> a, std::pair<AString, AString> b) -> bool { return a < b ;});
std::vector<std::pair<AString, AString>> ret;
auto ret = overrides;
size_t overridesIndex = 0;
for (auto pair : main)
for (auto mainpair : main)
{
if (overridesIndex >= overrides.size())
bool found = false;
for (const auto & overridepair : overrides)
{
ret.push_back(pair);
continue;
if (overridepair.first == mainpair.first)
{
found = true;
break;
}
}
if (pair.first == overrides[overridesIndex].first)
if (found == false)
{
continue;
ret.push_back(mainpair);
}
while (pair.first > overrides[overridesIndex].first)
{
ret.push_back(overrides[overridesIndex]);
overridesIndex++;
}
ret.push_back(pair);
}
return ret;
}