mirror of
https://github.com/curl/curl.git
synced 2025-09-04 11:24:59 +03:00
CURLOPT: bump CURLFTP*
enums to long
, drop casts
This patch bumps the size of these constants from `int` to `long`, while keeping their actual values the same. It may cause incompatibilities in user code, requiring the bump of holder variables and/or adding casts: - CURLFTP_CREATE_DIR - CURLFTP_CREATE_DIR_NONE - CURLFTP_CREATE_DIR_RETRY - CURLFTPAUTH_DEFAULT - CURLFTPAUTH_SSL - CURLFTPAUTH_TLS - CURLFTPMETHOD_DEFAULT - CURLFTPMETHOD_MULTICWD - CURLFTPMETHOD_NOCWD - CURLFTPMETHOD_SINGLECWD - CURLFTPSSL_CCC_ACTIVE - CURLFTPSSL_CCC_NONE - CURLFTPSSL_CCC_PASSIVE Also: - keep existing casts within the documentation to make sure it applies to older curl versions as well. Closes #17797
This commit is contained in:
parent
5debe7cb34
commit
430f9b03fd
|
@ -21,11 +21,9 @@ CURLOPT_FTP_CREATE_MISSING_DIRS - create missing directories for FTP and SFTP
|
|||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
typedef enum {
|
||||
CURLFTP_CREATE_DIR_NONE,
|
||||
CURLFTP_CREATE_DIR,
|
||||
CURLFTP_CREATE_DIR_RETRY
|
||||
} curl_ftpcreatedir;
|
||||
#define CURLFTP_CREATE_DIR_NONE 0L
|
||||
#define CURLFTP_CREATE_DIR 1L
|
||||
#define CURLFTP_CREATE_DIR_RETRY 2L
|
||||
|
||||
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_CREATE_MISSING_DIRS,
|
||||
long create);
|
||||
|
|
|
@ -979,39 +979,44 @@ typedef enum {
|
|||
#endif /* !CURL_NO_OLDIES */
|
||||
|
||||
/* parameter for the CURLOPT_FTP_SSL_CCC option */
|
||||
#define CURLFTPSSL_CCC_NONE 0L /* do not send CCC */
|
||||
#define CURLFTPSSL_CCC_PASSIVE 1L /* Let the server initiate the shutdown */
|
||||
#define CURLFTPSSL_CCC_ACTIVE 2L /* Initiate the shutdown */
|
||||
|
||||
typedef enum {
|
||||
CURLFTPSSL_CCC_NONE, /* do not send CCC */
|
||||
CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
|
||||
CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */
|
||||
CURLFTPSSL_CCC_LAST /* not an option, never use */
|
||||
CURLFTPSSL_CCC_LAST = 3 /* not an option, never use */
|
||||
} curl_ftpccc;
|
||||
|
||||
/* parameter for the CURLOPT_FTPSSLAUTH option */
|
||||
#define CURLFTPAUTH_DEFAULT 0L /* let libcurl decide */
|
||||
#define CURLFTPAUTH_SSL 1L /* use "AUTH SSL" */
|
||||
#define CURLFTPAUTH_TLS 2L /* use "AUTH TLS" */
|
||||
|
||||
typedef enum {
|
||||
CURLFTPAUTH_DEFAULT, /* let libcurl decide */
|
||||
CURLFTPAUTH_SSL, /* use "AUTH SSL" */
|
||||
CURLFTPAUTH_TLS, /* use "AUTH TLS" */
|
||||
CURLFTPAUTH_LAST /* not an option, never use */
|
||||
CURLFTPAUTH_LAST = 3 /* not an option, never use */
|
||||
} curl_ftpauth;
|
||||
|
||||
/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
|
||||
#define CURLFTP_CREATE_DIR_NONE 0L /* do NOT create missing dirs! */
|
||||
#define CURLFTP_CREATE_DIR 1L /* (FTP/SFTP) if CWD fails, try MKD and
|
||||
then CWD again if MKD succeeded, for
|
||||
SFTP this does similar magic */
|
||||
#define CURLFTP_CREATE_DIR_RETRY 2L /* (FTP only) if CWD fails, try MKD and
|
||||
then CWD again even if MKD failed! */
|
||||
|
||||
typedef enum {
|
||||
CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
|
||||
CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
|
||||
again if MKD succeeded, for SFTP this does
|
||||
similar magic */
|
||||
CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
|
||||
again even if MKD failed! */
|
||||
CURLFTP_CREATE_DIR_LAST /* not an option, never use */
|
||||
CURLFTP_CREATE_DIR_LAST = 3 /* not an option, never use */
|
||||
} 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 */
|
||||
|
|
|
@ -2749,7 +2749,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
|
|||
requested. Try an FTPS connection now */
|
||||
|
||||
ftpc->count3 = 0;
|
||||
switch(data->set.ftpsslauth) {
|
||||
switch((long)data->set.ftpsslauth) {
|
||||
case CURLFTPAUTH_DEFAULT:
|
||||
case CURLFTPAUTH_SSL:
|
||||
ftpc->count2 = 1; /* add one to get next */
|
||||
|
@ -2868,7 +2868,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
|
|||
* server, but we do not send one. Let's hope other servers do
|
||||
* the same... */
|
||||
result = Curl_ssl_cfilter_remove(data, FIRSTSOCKET,
|
||||
(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE));
|
||||
(data->set.ftp_ccc == (unsigned char)CURLFTPSSL_CCC_ACTIVE));
|
||||
|
||||
if(result)
|
||||
failf(data, "Failed to clear the command channel (CCC)");
|
||||
|
|
|
@ -900,7 +900,7 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
|
|||
*/
|
||||
if((arg < CURLFTPAUTH_DEFAULT) || (arg >= CURLFTPAUTH_LAST))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
data->set.ftpsslauth = (unsigned char)(curl_ftpauth)arg;
|
||||
data->set.ftpsslauth = (unsigned char)arg;
|
||||
break;
|
||||
case CURLOPT_ACCEPTTIMEOUT_MS:
|
||||
/*
|
||||
|
|
|
@ -653,7 +653,7 @@ static CURLcode ftp_setopts(struct OperationConfig *config, CURL *curl)
|
|||
|
||||
/* new in curl 7.16.1 */
|
||||
if(config->ftp_ssl_ccc)
|
||||
my_setopt_enum(curl, CURLOPT_FTP_SSL_CCC, (long)config->ftp_ssl_ccc_mode);
|
||||
my_setopt_enum(curl, CURLOPT_FTP_SSL_CCC, config->ftp_ssl_ccc_mode);
|
||||
|
||||
my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
|
||||
|
||||
|
|
|
@ -226,8 +226,8 @@ struct OperationConfig {
|
|||
unsigned long timecond;
|
||||
HttpReq httpreq;
|
||||
long proxyver; /* set to CURLPROXY_HTTP* define */
|
||||
int ftp_ssl_ccc_mode;
|
||||
int ftp_filemethod;
|
||||
long ftp_ssl_ccc_mode;
|
||||
long ftp_filemethod;
|
||||
enum {
|
||||
CLOBBER_DEFAULT, /* Provides compatibility with previous versions of curl,
|
||||
by using the default behavior for -o, -O, and -J.
|
||||
|
|
|
@ -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;
|
||||
|
@ -635,7 +635,7 @@ int ftpfilemethod(struct OperationConfig *config, const char *str)
|
|||
return CURLFTPMETHOD_MULTICWD;
|
||||
}
|
||||
|
||||
int ftpcccmethod(struct OperationConfig *config, const char *str)
|
||||
long ftpcccmethod(struct OperationConfig *config, const char *str)
|
||||
{
|
||||
if(curl_strequal("passive", str))
|
||||
return CURLFTPSSL_CCC_PASSIVE;
|
||||
|
|
|
@ -58,9 +58,9 @@ 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);
|
||||
|
||||
int ftpcccmethod(struct OperationConfig *config, const char *str);
|
||||
long ftpcccmethod(struct OperationConfig *config, const char *str);
|
||||
|
||||
long delegation(struct OperationConfig *config, const char *str);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user