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
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
10 changed files with 47 additions and 44 deletions

View file

@ -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)");

View file

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