Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/FilterEngine.cpp

Issue 29424797: Noissue - use range iterator (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 28, 2017, 3:44 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld