1
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

View File

@ -108,30 +108,24 @@ std::vector<std::pair<AString, AString>> cOverridesSettingsRepository::GetValues
{ {
auto overrides = m_Overrides->GetValues(a_keyName); auto overrides = m_Overrides->GetValues(a_keyName);
auto main = m_Main->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;
for (auto mainpair : main)
size_t overridesIndex = 0;
for (auto pair : main)
{ {
if (overridesIndex >= overrides.size()) bool found = false;
for (const auto & overridepair : overrides)
{ {
ret.push_back(pair); if (overridepair.first == mainpair.first)
continue; {
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; return ret;
} }