summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-09-18 11:02:44 +0200
committerMarc Chevrier <marc.chevrier@gmail.com>2021-09-19 19:10:59 +0200
commit062432a6bc1f334f17200a88a04d3c8e02a4fd94 (patch)
tree8304c27c4d72b82ccc4faccfe313ae51c3ea3ece /Source
parent96c38493849f05724ec5c2b2e0152c5c86c3b5b0 (diff)
downloadcmake-062432a6bc1f334f17200a88a04d3c8e02a4fd94.tar.gz
cmCurlSetCAInfo: use std::string as argument
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCurl.cxx6
-rw-r--r--Source/cmCurl.h2
-rw-r--r--Source/cmFileCommand.cxx4
-rw-r--r--Source/cmGetPropertyCommand.cxx2
4 files changed, 8 insertions, 6 deletions
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index fa001d2825..28ee24dfe9 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -31,11 +31,11 @@
} \
} while (false)
-std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile)
+std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile)
{
std::string e;
- if (cafile && *cafile) {
- ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile);
+ if (!cafile.empty()) {
+ ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile.c_str());
check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
}
#ifdef CMAKE_FIND_CAFILE
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index 9c1e33778e..b5134f466e 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -8,7 +8,7 @@
#include <cm3p/curl/curl.h>
-std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = nullptr);
+std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile = {});
std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
const std::string& netrc_file);
std::string cmCurlFixFileURL(std::string url);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 1223d2a10b..bdfec02997 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1986,7 +1986,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
// check to see if a CAINFO file has been specified
// command arg comes first
- std::string const& cainfo_err = cmCurlSetCAInfo(curl, cmToCStr(cainfo));
+ std::string const& cainfo_err = cmCurlSetCAInfo(curl, cainfo);
if (!cainfo_err.empty()) {
status.SetError(cainfo_err);
return false;
@@ -2304,7 +2304,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
// check to see if a CAINFO file has been specified
// command arg comes first
- std::string const& cainfo_err = cmCurlSetCAInfo(curl, cmToCStr(cainfo));
+ std::string const& cainfo_err = cmCurlSetCAInfo(curl, cainfo);
if (!cainfo_err.empty()) {
status.SetError(cainfo_err);
return false;
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 4b380c05b8..c976ddae57 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetPropertyCommand.h"
+#include <cstddef>
+
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmInstalledFile.h"