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:
Viktor Szakats
2025-07-01 17:15:45 +02:00
parent 5debe7cb34
commit 430f9b03fd
10 changed files with 47 additions and 44 deletions

View File

@@ -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 */