diff options
author | Brad King <brad.king@kitware.com> | 2023-01-31 14:13:15 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-01-31 14:13:24 (GMT) |
commit | 1a5bc71c59c75e66e280b3f3f6bf1727b0e21c39 (patch) | |
tree | 53e9b7f3b2c51e2146500f550f51103df081ac6f /Source | |
parent | 4dc058270d47316a7779e03ab8e60d75820a86f5 (diff) | |
parent | 8443dfa94663531c8481611cc35b807c1cea2c75 (diff) | |
download | CMake-1a5bc71c59c75e66e280b3f3f6bf1727b0e21c39.zip CMake-1a5bc71c59c75e66e280b3f3f6bf1727b0e21c39.tar.gz CMake-1a5bc71c59c75e66e280b3f3f6bf1727b0e21c39.tar.bz2 |
Merge topic 'update-curl'
8443dfa946 curl: Work around missing OpenSSL symbol on machine with LCC 1.23
f9f5957884 Merge branch 'upstream-curl' into update-curl
dac458ddbf curl 2022-12-21 (c12fb3dd)
39dcf9469d curl: Update script to get curl 7.87.0
b2fe717a49 file: Avoid using deprecated curl progress callback
1cd38de47f ctest: Drop unnecessary use of deprecated CURLOPT_PUT
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8131
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestCurl.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 2 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 30 |
3 files changed, 21 insertions, 13 deletions
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 84161f9..13b0278 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -118,8 +118,6 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, /* enable uploading */ curl_easy_setopt(this->Curl, CURLOPT_UPLOAD, 1); - /* HTTP PUT please */ - ::curl_easy_setopt(this->Curl, CURLOPT_PUT, 1); ::curl_easy_setopt(this->Curl, CURLOPT_VERBOSE, 1); FILE* ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 2bc270e..3ff8c8f 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -223,8 +223,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( submitInactivityTimeout); } - /* HTTP PUT please */ - ::curl_easy_setopt(curl, CURLOPT_PUT, 1); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); ::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index dfce033..00a68a8 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1629,6 +1629,14 @@ int cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr, return 0; } +# if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM >= 0x072000 +const CURLoption CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_XFERINFOFUNCTION; +using cm_curl_off_t = curl_off_t; +# else +const CURLoption CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_PROGRESSFUNCTION; +using cm_curl_off_t = double; +# endif + class cURLProgressHelper { public: @@ -1638,12 +1646,14 @@ public: { } - bool UpdatePercentage(double value, double total, std::string& status) + bool UpdatePercentage(cm_curl_off_t value, cm_curl_off_t total, + std::string& status) { long OldPercentage = this->CurrentPercentage; - if (total > 0.0) { - this->CurrentPercentage = std::lround(value / total * 100.0); + if (total > 0) { + this->CurrentPercentage = std::lround( + static_cast<double>(value) / static_cast<double>(total) * 100.0); if (this->CurrentPercentage > 100) { // Avoid extra progress reports for unexpected data beyond total. this->CurrentPercentage = 100; @@ -1668,8 +1678,9 @@ private: std::string Text; }; -int cmFileDownloadProgressCallback(void* clientp, double dltotal, double dlnow, - double ultotal, double ulnow) +int cmFileDownloadProgressCallback(void* clientp, cm_curl_off_t dltotal, + cm_curl_off_t dlnow, cm_curl_off_t ultotal, + cm_curl_off_t ulnow) { cURLProgressHelper* helper = reinterpret_cast<cURLProgressHelper*>(clientp); @@ -1685,8 +1696,9 @@ int cmFileDownloadProgressCallback(void* clientp, double dltotal, double dlnow, return 0; } -int cmFileUploadProgressCallback(void* clientp, double dltotal, double dlnow, - double ultotal, double ulnow) +int cmFileUploadProgressCallback(void* clientp, cm_curl_off_t dltotal, + cm_curl_off_t dlnow, cm_curl_off_t ultotal, + cm_curl_off_t ulnow) { cURLProgressHelper* helper = reinterpret_cast<cURLProgressHelper*>(clientp); @@ -2062,7 +2074,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args, res = ::curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); check_curl_result(res, "DOWNLOAD cannot set noprogress value: "); - res = ::curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, + res = ::curl_easy_setopt(curl, CM_CURLOPT_XFERINFOFUNCTION, cmFileDownloadProgressCallback); check_curl_result(res, "DOWNLOAD cannot set progress function: "); @@ -2376,7 +2388,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args, res = ::curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); check_curl_result(res, "UPLOAD cannot set noprogress value: "); - res = ::curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, + res = ::curl_easy_setopt(curl, CM_CURLOPT_XFERINFOFUNCTION, cmFileUploadProgressCallback); check_curl_result(res, "UPLOAD cannot set progress function: "); |