From 9247a13ca703bb09adcc25c32ad8834e3b92ee0c Mon Sep 17 00:00:00 2001 From: Leonardo Laureti <204957+leolweb@users.noreply.github.com> Date: Sat, 25 Feb 2023 17:52:43 +0100 Subject: [PATCH] ftpcom: FIX and libcurl deprecated CURLOPT_PROTOCOLS --- INSTALL.md | 2 +- scripts/darwin.sh | 2 +- scripts/{mingw32.sh => mingw.sh} | 0 src/ftpcom/ftpcom.cpp | 20 ++------------------ src/ftpcom/ftpcom.h | 2 +- 5 files changed, 5 insertions(+), 21 deletions(-) rename scripts/{mingw32.sh => mingw.sh} (100%) diff --git a/INSTALL.md b/INSTALL.md index 26792493..ab766038 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -10,7 +10,7 @@ Utils scripts in **scripts** folder. - For macOS with Xcode use scripts/darwin.sh -- For Windows with MinGW-64 use scripts/mingw32.sh +- For Windows with MinGW-64 use scripts/mingw.sh ### Required dependencies diff --git a/scripts/darwin.sh b/scripts/darwin.sh index e2814650..23234493 100755 --- a/scripts/darwin.sh +++ b/scripts/darwin.sh @@ -37,7 +37,7 @@ relinking () { local qtbase="/usr/local/opt/qt/lib" if [[ -n "$1" ]]; then - local libs=$(xcrun dyldinfo -dylibs "$1" | tail -n +2) + local libs=$(dyld_info -dependents "$1" | tail -n +2) for lib in $libs; do if [[ "$lib" == "/usr/local/opt"* || "$lib" == "@rpath"* ]]; then diff --git a/scripts/mingw32.sh b/scripts/mingw.sh similarity index 100% rename from scripts/mingw32.sh rename to scripts/mingw.sh diff --git a/src/ftpcom/ftpcom.cpp b/src/ftpcom/ftpcom.cpp index 497f1de5..8e1e164e 100644 --- a/src/ftpcom/ftpcom.cpp +++ b/src/ftpcom/ftpcom.cpp @@ -16,7 +16,6 @@ #include #include -// #define CURL_STATICLIB #include "ftpcom.h" using std::string, std::stringstream, std::min, std::endl, std::to_string; @@ -85,12 +84,7 @@ bool ftpcom::handle() curl_url_set(rph, CURLUPART_SCHEME, "ftp", 0); curl_url_set(rph, CURLUPART_HOST, host.c_str(), 0); -#ifdef CURLOPT_PROTOCOLS_STR - curl_easy_setopt(csh, CURLOPT_PROTOCOLS_STR, "ftp"); -#else - curl_easy_setopt(csh, CURLOPT_PROTOCOLS, CURLPROTO_FTP); -#endif - + curl_easy_setopt(cph, CURLOPT_PROTOCOLS_STR, "ftp"); curl_easy_setopt(cph, CURLOPT_CURLU, rph); curl_easy_setopt(cph, CURLOPT_USERNAME, user.c_str()); curl_easy_setopt(cph, CURLOPT_PASSWORD, pass.c_str()); @@ -470,12 +464,7 @@ bool ftpcom::cmd_ifreload() // debug("cmd_ifreload", "URL", url); // url = NULL; -#ifdef CURLOPT_PROTOCOLS_STR curl_easy_setopt(csh, CURLOPT_PROTOCOLS_STR, "http"); -#else - curl_easy_setopt(csh, CURLOPT_PROTOCOLS, CURLPROTO_HTTP); -#endif - curl_easy_setopt(csh, CURLOPT_HTTPGET, true); curl_easy_setopt(csh, CURLOPT_FOLLOWLOCATION, true); curl_easy_setopt(csh, CURLOPT_CURLU, rsh); @@ -527,17 +516,12 @@ bool ftpcom::cmd_tnreload() curl_url_set(rsh, CURLUPART_SCHEME, "telnet", 0); curl_url_set(rsh, CURLUPART_HOST, host.c_str(), 0); -#ifdef CURLOPT_PROTOCOLS_STR curl_easy_setopt(csh, CURLOPT_PROTOCOLS_STR, "telnet"); -#else - curl_easy_setopt(csh, CURLOPT_PROTOCOLS, CURLPROTO_TELNET); -#endif - curl_easy_setopt(csh, CURLOPT_CURLU, rsh); curl_easy_setopt(csh, CURLOPT_PORT, 23); curl_easy_setopt(csh, CURLOPT_READFUNCTION, data_tn_shell_func); curl_easy_setopt(csh, CURLOPT_READDATA, &data); - curl_easy_setopt(cph, CURLOPT_WRITEFUNCTION, data_discard_func); + curl_easy_setopt(csh, CURLOPT_WRITEFUNCTION, data_discard_func); curl_easy_setopt(csh, CURLOPT_FAILONERROR, true); // curl_easy_setopt(csh, CURLOPT_VERBOSE, true); diff --git a/src/ftpcom/ftpcom.h b/src/ftpcom/ftpcom.h index b175aaba..03b8f46b 100644 --- a/src/ftpcom/ftpcom.h +++ b/src/ftpcom/ftpcom.h @@ -15,7 +15,7 @@ #include #include -#define CURL_STATICLIB +// #define CURL_STATICLIB #include #include "../logger/logger.h"