From 4d75e29b3bba8a4002231dbc507f79ea63dccd82 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 19 Nov 2021 18:08:45 +0100 Subject: Revert "The CurlOption curl_off_t case appears to be unused" This reverts commit 20168b1f09b4d2aa8643dc7d4a16d8a1dd1008a6. Change-Id: I3ac7bdeece94ec2a0e01d67f2788874b3f286fe4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125578 Tested-by: Jenkins Reviewed-by: Michael Stahl --- ucb/source/ucp/webdav-curl/CurlSession.cxx | 45 ++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index e1cfd2c3f79f..9fe20d10794f 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -118,15 +118,21 @@ struct CurlOption enum class Type { Pointer, - Long + Long, + CurlOffT }; Type const Tag; union { void const* const pValue; long const lValue; + curl_off_t const cValue; }; #if 0 ::std::variant const Value; #endif char const* const pExceptionString; @@ -147,11 +153,14 @@ struct CurlOption { } #if SAL_TYPES_SIZEOFLONG == 4 - // According to mst this might get used "if one of the options to set stream size like - // CURLOPT_INFILESIZE_LARGE were used but it's not the case currently", so keep this ctor - // around as deleted in case it would ever become necessary to extend Value with a curl_off_t - // case: - CurlOption(CURLoption, curl_off_t, char const*) = delete; + CurlOption(CURLoption const i_Option, curl_off_t const i_Value, + char const* const i_pExceptionString) + : Option(i_Option) + , Tag(Type::CurlOffT) + , cValue(i_Value) + , pExceptionString(i_pExceptionString) + { + } #endif }; @@ -200,6 +209,12 @@ public: { rc = curl_easy_setopt(m_pCurl, it.Option, *pLong); } +#if SAL_TYPES_SIZEOFLONG == 4 + else if (curl_off_t const* const pOfft = ::std::get_if(&it.Value)) + { + rc = curl_easy_setopt(m_pCurl, it.Option, *pOfft); + } +#endif #endif if (it.Tag == CurlOption::Type::Pointer) { @@ -209,6 +224,12 @@ public: { rc = curl_easy_setopt(m_pCurl, it.Option, it.lValue); } +#if SAL_TYPES_SIZEOFLONG == 4 + else if (it.Tag == CurlOption::Type::CurlOffT) + { + rc = curl_easy_setopt(m_pCurl, it.Option, it.cValue); + } +#endif else { assert(false); @@ -246,6 +267,12 @@ public: { rc = curl_easy_setopt(m_pCurl, it.Option, 0L); } +#if SAL_TYPES_SIZEOFLONG == 4 + else if (curl_off_t const* const pOfft = ::std::get_if(&it.Value)) + { + rc = curl_easy_setopt(m_pCurl, it.Option, curl_off_t(0)); + } +#endif #endif if (it.Tag == CurlOption::Type::Pointer) { @@ -255,6 +282,12 @@ public: { rc = curl_easy_setopt(m_pCurl, it.Option, 0L); } +#if SAL_TYPES_SIZEOFLONG == 4 + else if (it.Tag == CurlOption::Type::CurlOffT) + { + rc = curl_easy_setopt(m_pCurl, it.Option, curl_off_t(0)); + } +#endif else { assert(false); -- cgit v1.2.3