From: Fab Stz <fabstz-it@yahoo.fr>
Date: Sat, 6 Sep 2025 10:33:06 +0200
Subject: Support curl's newftp methods type (since 8.16)

Last-Modified: 2025-09-06
Forwarded: not-needed
---
 FreeFileSync/Source/afs/ftp.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/FreeFileSync/Source/afs/ftp.cpp b/FreeFileSync/Source/afs/ftp.cpp
index c4f9f78..41f4787 100644
--- 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, long 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
@@ -1262,7 +1267,7 @@ public:
                 {CURLOPT_WRITEDATA, &rawListing},
                 {CURLOPT_WRITEFUNCTION, onBytesReceived},
             };
-            long pathMethod = CURLFTPMETHOD_SINGLECWD;
+            CURL_FTPMETHOD_TYPE pathMethod = CURLFTPMETHOD_SINGLECWD;
 
             if (session.supportsMlsd()) //throw SysError
             {
