Patch to support curl 8.16 (& also below)

Discuss new features and functions
Posts: 58
Joined: 14 Aug 2022

daviank

Dear Zenju,

Please find here a patch to support build with the newer curl 8.16.
It will also work with older versions of curl
--- a/FreeFileSync/Source/afs/ftp.cpp
+++ b/FreeFileSync/Source/afs/ftp.cpp
@@ -20,6 +20,11 @@ using namespace zen;
 using namespace fff;
 using AFS = AbstractFileSystem;
 
+#if LIBCURL_VERSION_NUM >= 0x081000 // 8.16.0
+#define CURL_FTPMETHOD_TYPE long
+#else
+#define CURL_FTPMETHOD_TYPE curl_ftpmethod
+#endif
 
 namespace
 {
@@ -316,7 +321,7 @@ public:
     void setContextTimeout(const std::weak_ptr<int>& timeoutSec) { timeoutSec_ = timeoutSec; }
 
     //returns server response (header data)
-    std::string perform(const AfsPath& itemPath, bool isDir, curl_ftpmethod pathMethod,
+    std::string perform(const AfsPath& itemPath, bool isDir, CURL_FTPMETHOD_TYPE pathMethod,
                         const std::vector<CurlOption>& extraOptions, bool requestUtf8) //throw SysError, SysErrorPassword, SysErrorFtpProtocol
     {
         if (requestUtf8) //avoid endless recursion
@@ -1258,7 +1263,7 @@ public:
                 {CURLOPT_WRITEDATA, &rawListing},
                 {CURLOPT_WRITEFUNCTION, onBytesReceived},
             };
-            curl_ftpmethod pathMethod = CURLFTPMETHOD_SINGLECWD;
+            CURL_FTPMETHOD_TYPE pathMethod = CURLFTPMETHOD_SINGLECWD;
 
             if (session.supportsMlsd()) //throw SysError
             {
Regards

Origin: https://salsa.debian.org/bastif/freefilesync/-/commit/19b048a702bdf533ae98c6af91c2a2f7df67606c