From 8658d4ddd6cce358b108b5993e850f9c4c54fdc4 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sun, 10 Apr 2016 16:04:54 +0100 Subject: Fixed port override code. --- src/OverridesSettingsRepository.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'src/OverridesSettingsRepository.cpp') diff --git a/src/OverridesSettingsRepository.cpp b/src/OverridesSettingsRepository.cpp index 9e85abce6..f3db96a5c 100644 --- a/src/OverridesSettingsRepository.cpp +++ b/src/OverridesSettingsRepository.cpp @@ -108,31 +108,26 @@ std::vector> cOverridesSettingsRepository::GetValues { auto overrides = m_Overrides->GetValues(a_keyName); auto main = m_Main->GetValues(a_keyName); - std::sort(overrides.begin(), overrides.end(), [](std::pair a, std::pair b) -> bool { return a < b ;}); - std::sort(main.begin(), main.end(), [](std::pair a, std::pair b) -> bool { return a < b ;}); - std::vector> ret; + auto ret = overrides; - - size_t overridesIndex = 0; - for (auto pair : main) + for (const auto & mainpair : main) { - if (overridesIndex >= overrides.size()) - { - ret.push_back(pair); - continue; - } - if (pair.first == overrides[overridesIndex].first) + bool found = false; + for (const auto & returnpair : ret) { - continue; + if (returnpair.first == mainpair.first) + { + found = true; + break; + } } - while (pair.first > overrides[overridesIndex].first) + if (found == false) { - ret.push_back(overrides[overridesIndex]); - overridesIndex++; + ret.push_back(mainpair); } - ret.push_back(pair); } + return ret; } @@ -270,4 +265,3 @@ bool cOverridesSettingsRepository::Flush() { return m_Overrides->Flush() && m_Main->Flush(); } - -- cgit v1.2.3