diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-14 13:11:58 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-14 13:11:58 (GMT) |
commit | 63f6fd144ef0171864ddeccee6618ab179e90384 (patch) | |
tree | 36c602ec8b47cef4b0b72929958c5c19846ffb1e /Source/CTest/cmCTestCurl.cxx | |
parent | 420874bfaa20772525c60b20d1ee5b6ef5ed9298 (diff) | |
download | CMake-63f6fd144ef0171864ddeccee6618ab179e90384.zip CMake-63f6fd144ef0171864ddeccee6618ab179e90384.tar.gz CMake-63f6fd144ef0171864ddeccee6618ab179e90384.tar.bz2 |
Meta: modernize old-fashioned loops to range-based `for` (CTest).
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
Diffstat (limited to 'Source/CTest/cmCTestCurl.cxx')
-rw-r--r-- | Source/CTest/cmCTestCurl.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index b175d44..022afd2 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -61,12 +61,11 @@ size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/, void cmCTestCurl::SetCurlOptions(std::vector<std::string> const& args) { - for (std::vector<std::string>::const_iterator i = args.begin(); - i != args.end(); ++i) { - if (*i == "CURLOPT_SSL_VERIFYPEER_OFF") { + for (std::string const& arg : args) { + if (arg == "CURLOPT_SSL_VERIFYPEER_OFF") { this->VerifyPeerOff = true; } - if (*i == "CURLOPT_SSL_VERIFYHOST_OFF") { + if (arg == "CURLOPT_SSL_VERIFYHOST_OFF") { this->VerifyHostOff = true; } } @@ -146,12 +145,11 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, struct curl_slist* headers = ::curl_slist_append(nullptr, "Content-Type: text/xml"); // Add any additional headers that the user specified. - for (std::vector<std::string>::const_iterator h = this->HttpHeaders.begin(); - h != this->HttpHeaders.end(); ++h) { + for (std::string const& h : this->HttpHeaders) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Add HTTP Header: \"" << *h << "\"" << std::endl, + " Add HTTP Header: \"" << h << "\"" << std::endl, this->Quiet); - headers = ::curl_slist_append(headers, h->c_str()); + headers = ::curl_slist_append(headers, h.c_str()); } ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers); std::vector<char> responseData; @@ -213,13 +211,11 @@ bool cmCTestCurl::HttpRequest(std::string const& url, // Add headers if any were specified. struct curl_slist* headers = nullptr; if (!this->HttpHeaders.empty()) { - for (std::vector<std::string>::const_iterator h = - this->HttpHeaders.begin(); - h != this->HttpHeaders.end(); ++h) { + for (std::string const& h : this->HttpHeaders) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Add HTTP Header: \"" << *h << "\"" << std::endl, + " Add HTTP Header: \"" << h << "\"" << std::endl, this->Quiet); - headers = ::curl_slist_append(headers, h->c_str()); + headers = ::curl_slist_append(headers, h.c_str()); } } |