| Index: src/FilterEngine.cpp |
| =================================================================== |
| --- a/src/FilterEngine.cpp |
| +++ b/src/FilterEngine.cpp |
| @@ -270,18 +270,17 @@ std::string FilterEngine::ContentTypeToS |
| return it->second; |
| throw std::invalid_argument("Argument is not a valid ContentType"); |
| } |
| FilterEngine::ContentType FilterEngine::StringToContentType(const std::string& contentType) |
| { |
| std::string contentTypeUpper = contentType; |
| std::transform(contentType.begin(), contentType.end(), contentTypeUpper.begin(), ::toupper); |
| - for (ContentTypeMap::const_iterator it = contentTypes.begin(); |
| - it != contentTypes.end(); it++) |
| + for (auto it = contentTypes.cbegin(); it != contentTypes.cend(); it++) |
| { |
| if (it->second == contentTypeUpper) |
| return it->first; |
| } |
| throw std::invalid_argument("Cannot convert argument to ContentType"); |
| } |
| bool FilterEngine::IsFirstRun() const |
| @@ -373,18 +372,17 @@ AdblockPlus::FilterPtr FilterEngine::Mat |
| AdblockPlus::FilterPtr FilterEngine::Matches(const std::string& url, |
| ContentTypeMask contentTypeMask, |
| const std::vector<std::string>& documentUrls) const |
| { |
| if (documentUrls.empty()) |
| return CheckFilterMatch(url, contentTypeMask, ""); |
| std::string lastDocumentUrl = documentUrls.front(); |
| - for (std::vector<std::string>::const_iterator it = documentUrls.begin(); |
| - it != documentUrls.end(); it++) { |
| + for (auto it = documentUrls.cbegin(); it != documentUrls.cend(); it++) { |
| const std::string documentUrl = *it; |
| AdblockPlus::FilterPtr match = CheckFilterMatch(documentUrl, |
| CONTENT_TYPE_DOCUMENT, |
| lastDocumentUrl); |
| if (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION) |
| return match; |
| lastDocumentUrl = documentUrl; |
| } |
| @@ -422,17 +420,17 @@ AdblockPlus::FilterPtr FilterEngine::Che |
| std::vector<std::string> FilterEngine::GetElementHidingSelectors(const std::string& domain) const |
| { |
| JsValuePtr func = jsEngine->Evaluate("API.getElementHidingSelectors"); |
| JsValueList params; |
| params.push_back(jsEngine->NewValue(domain)); |
| JsValueList result = func->Call(params)->AsList(); |
| std::vector<std::string> selectors; |
| - for (JsValueList::iterator it = result.begin(); it != result.end(); ++it) |
| + for (auto it = result.cbegin(); it != result.cend(); ++it) |
| selectors.push_back((*it)->AsString()); |
| return selectors; |
| } |
| JsValuePtr FilterEngine::GetPref(const std::string& pref) const |
| { |
| JsValuePtr func = jsEngine->Evaluate("API.getPref"); |
| JsValueList params; |