Index: src/FilterEngine.cpp |
=================================================================== |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -247,20 +247,19 @@ |
}); |
// Lock the JS engine while we are loading scripts, no timeouts should fire |
// until we are done. |
const JsContext context(*jsEngine); |
// Set the preconfigured prefs |
auto preconfiguredPrefsObject = jsEngine->NewObject(); |
- for (FilterEngine::Prefs::const_iterator it = params.preconfiguredPrefs.begin(); |
- it != params.preconfiguredPrefs.end(); it++) |
+ for (const auto& pref : params.preconfiguredPrefs) |
{ |
- preconfiguredPrefsObject.SetProperty(it->first, it->second); |
+ preconfiguredPrefsObject.SetProperty(pref.first, pref.second); |
} |
jsEngine->SetGlobalProperty("_preconfiguredPrefs", preconfiguredPrefsObject); |
// Load adblockplus scripts |
for (int i = 0; !jsSources[i].empty(); i += 2) |
jsEngine->Evaluate(jsSources[i + 1], jsSources[i]); |
} |
FilterEnginePtr FilterEngine::Create(const JsEnginePtr& jsEngine, |
@@ -342,38 +341,38 @@ |
return Subscription(func.Call(jsEngine->NewValue(url))); |
} |
std::vector<Filter> FilterEngine::GetListedFilters() const |
{ |
JsValue func = jsEngine->Evaluate("API.getListedFilters"); |
JsValueList values = func.Call().AsList(); |
std::vector<Filter> result; |
- for (JsValueList::iterator it = values.begin(); it != values.end(); it++) |
- result.push_back(Filter(std::move(*it))); |
+ for (auto& value : values) |
+ result.push_back(Filter(std::move(value))); |
return result; |
} |
std::vector<Subscription> FilterEngine::GetListedSubscriptions() const |
{ |
JsValue func = jsEngine->Evaluate("API.getListedSubscriptions"); |
JsValueList values = func.Call().AsList(); |
std::vector<Subscription> result; |
- for (JsValueList::iterator it = values.begin(); it != values.end(); it++) |
- result.push_back(Subscription(std::move(*it))); |
+ for (auto& value : values) |
+ result.push_back(Subscription(std::move(value))); |
return result; |
} |
std::vector<Subscription> FilterEngine::FetchAvailableSubscriptions() const |
{ |
JsValue func = jsEngine->Evaluate("API.getRecommendedSubscriptions"); |
JsValueList values = func.Call().AsList(); |
std::vector<Subscription> result; |
- for (JsValueList::iterator it = values.begin(); it != values.end(); it++) |
- result.push_back(Subscription(std::move(*it))); |
+ for (auto& value : values) |
+ result.push_back(Subscription(std::move(value))); |
return result; |
} |
void FilterEngine::SetAAEnabled(bool enabled) |
{ |
jsEngine->Evaluate("API.setAASubscriptionEnabled").Call(jsEngine->NewValue(enabled)); |
} |