summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2023-01-09 13:54:45 +0100
committerJulien Nabet <serval2412@yahoo.fr>2023-01-11 10:14:47 +0000
commit071c66521c6db7136ea7f4606d48ab9fbcc4c71d (patch)
tree08af44c98948595bfb9fb7cf2b6b1666be06e4b9 /extensions
parent0bd3600d9415c10891ea1d90dd598d827d1a9c48 (diff)
Fix types for Curl elements (update part)
"CURLOPT_REDIR_PROTOCOLS_STR" has been added with Curl 7.85 so check if Curl version is 7.85 min or use the previous version "CURLOPT_REDIR_PROTOCOLS" Change-Id: Iacf6a3c37aba63d615eaa93352b098b1c9183533 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145208 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/update/check/download.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx
index 3b76f9cc8a27..4ba5863930ba 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -60,8 +60,8 @@ static void openFile( OutData& out )
char * effective_url;
curl_easy_getinfo(out.curl, CURLINFO_EFFECTIVE_URL, &effective_url);
- double fDownloadSize;
- curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &fDownloadSize);
+ curl_off_t nDownloadSize;
+ curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &nDownloadSize);
OString aURL(effective_url);
@@ -94,7 +94,7 @@ static void openFile( OutData& out )
} while( osl_File_E_EXIST == rc );
if( osl_File_E_None == rc )
- out.Handler->downloadStarted(out.File, static_cast<sal_Int64>(fDownloadSize));
+ out.Handler->downloadStarted(out.File, static_cast<sal_Int64>(nDownloadSize));
}
}
@@ -140,7 +140,7 @@ write_function( void *ptr, size_t size, size_t nmemb, void *stream )
static int
-progress_callback( void *clientp, double dltotal, double dlnow, SAL_UNUSED_PARAMETER double, SAL_UNUSED_PARAMETER double )
+progress_callback( void *clientp, curl_off_t dltotal, curl_off_t dlnow, SAL_UNUSED_PARAMETER curl_off_t, SAL_UNUSED_PARAMETER curl_off_t)
{
OutData *out = static_cast < OutData * > (clientp);
@@ -148,7 +148,7 @@ progress_callback( void *clientp, double dltotal, double dlnow, SAL_UNUSED_PARAM
if (out && !out->StopCondition.check())
{
- double fPercent = 0;
+ float fPercent = 0;
if ( dltotal + out->Offset )
fPercent = (dlnow + out->Offset) * 100 / (dltotal + out->Offset);
if( fPercent < 0 )
@@ -233,7 +233,11 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro
// enable redirection
(void)curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1);
// only allow redirect to http:// and https://
- (void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+#if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 85)
+ curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
+#else
+ curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+#endif
// write function
(void)curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, &out);
@@ -274,9 +278,9 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro
{
// this sometimes happens, when a user throws away his user data, but has already
// completed the download of an update.
- double fDownloadSize;
- curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &fDownloadSize );
- if ( -1 == fDownloadSize )
+ curl_off_t nDownloadSize;
+ curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &nDownloadSize );
+ if ( -1 == nDownloadSize )
{
out.Handler->downloadFinished(out.File);
ret = true;