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

Unified Diff: src/DefaultWebRequestCurl.cpp

Issue 29391775: Issue 5013 - Improve some const-correctness (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Removed GetType() const-ness change Created March 23, 2017, 12:57 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 | src/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/DefaultWebRequestCurl.cpp
===================================================================
--- a/src/DefaultWebRequestCurl.cpp
+++ b/src/DefaultWebRequestCurl.cpp
@@ -139,32 +139,29 @@ AdblockPlus::ServerResponse AdblockPlus:
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, ReceiveData);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &responseText);
// Request compressed data. Using any supported aglorithm
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, ReceiveHeader);
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &headerData);
struct curl_slist* headerList = 0;
- for (HeaderList::const_iterator it = requestHeaders.begin();
- it != requestHeaders.end(); ++it)
+ for (const auto& header : requestHeaders)
{
- headerList = curl_slist_append(headerList, (it->first + ": " + it->second).c_str());
+ headerList = curl_slist_append(headerList, (header.first + ": " + header.second).c_str());
}
if (headerList)
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerList);
result.status = ConvertErrorCode(curl_easy_perform(curl));
result.responseStatus = headerData.status;
result.responseText = responseText.str();
- for (std::vector<std::string>::iterator it = headerData.headers.begin();
- it != headerData.headers.end(); ++it)
+ for (const auto& header : headerData.headers)
{
// Parse header name and value out of something like "Foo: bar"
- std::string header = *it;
size_t colonPos = header.find(':');
if (colonPos != std::string::npos)
{
size_t nameStart = 0;
size_t nameEnd = colonPos;
while (nameEnd > nameStart && isspace(header[nameEnd - 1]))
nameEnd--;
« no previous file with comments | « no previous file | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld