convert CURLFTPMETHOD_* to long constants

This commit is contained in:
Viktor Szakats 2025-07-01 17:26:58 +02:00
parent 35081fb461
commit af22a19ced
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
7 changed files with 20 additions and 19 deletions

View file

@ -68,8 +68,7 @@ int main(void)
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/1/2/3/4/new.txt");
curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD,
(long)CURLFTPMETHOD_SINGLECWD);
curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);

View file

@ -1009,12 +1009,14 @@ typedef enum {
} curl_ftpcreatedir;
/* parameter for the CURLOPT_FTP_FILEMETHOD option */
#define CURLFTPMETHOD_DEFAULT 0L /* let libcurl pick */
#define CURLFTPMETHOD_MULTICWD 1L /* single CWD operation for each path
part */
#define CURLFTPMETHOD_NOCWD 2L /* no CWD at all */
#define CURLFTPMETHOD_SINGLECWD 3L /* one CWD to full dir, then work on file */
typedef enum {
CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
CURLFTPMETHOD_NOCWD, /* no CWD at all */
CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
CURLFTPMETHOD_LAST /* not an option, never use */
CURLFTPMETHOD_LAST = 4 /* not an option, never use */
} curl_ftpmethod;
/* bitmask defines for CURLOPT_HEADEROPT */

View file

@ -227,7 +227,7 @@ struct OperationConfig {
HttpReq httpreq;
long proxyver; /* set to CURLPROXY_HTTP* define */
long ftp_ssl_ccc_mode;
int ftp_filemethod;
long ftp_filemethod;
enum {
CLOBBER_DEFAULT, /* Provides compatibility with previous versions of curl,
by using the default behavior for -o, -O, and -J.

View file

@ -620,7 +620,7 @@ ParameterError add2list(struct curl_slist **list, const char *ptr)
return PARAM_OK;
}
int ftpfilemethod(struct OperationConfig *config, const char *str)
long ftpfilemethod(struct OperationConfig *config, const char *str)
{
if(curl_strequal("singlecwd", str))
return CURLFTPMETHOD_SINGLECWD;

View file

@ -58,7 +58,7 @@ CURLcode get_args(struct OperationConfig *config, const size_t i);
ParameterError add2list(struct curl_slist **list, const char *ptr);
int ftpfilemethod(struct OperationConfig *config, const char *str);
long ftpfilemethod(struct OperationConfig *config, const char *str);
long ftpcccmethod(struct OperationConfig *config, const char *str);

View file

@ -49,7 +49,7 @@ static CURLcode test_lib539(char *URL)
*/
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
@ -70,7 +70,7 @@ static CURLcode test_lib539(char *URL)
}
test_setopt(curl, CURLOPT_URL, libtest_arg2);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);

View file

@ -50,7 +50,7 @@ static CURLcode test_lib661(char *URL)
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
@ -77,7 +77,7 @@ static CURLcode test_lib661(char *URL)
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
@ -86,7 +86,7 @@ static CURLcode test_lib661(char *URL)
curl_free(newURL);
newURL = curl_maprintf("%s/folderB/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
@ -94,7 +94,7 @@ static CURLcode test_lib661(char *URL)
curl_free(newURL);
newURL = curl_maprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
@ -119,7 +119,7 @@ static CURLcode test_lib661(char *URL)
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
if(res)
@ -138,7 +138,7 @@ static CURLcode test_lib661(char *URL)
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
if(res)
@ -151,7 +151,7 @@ static CURLcode test_lib661(char *URL)
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);