Skip to content

CURLOPT: bump CURLFTP* enums to long, drop casts#17797

Closed
vszakats wants to merge 10 commits intocurl:masterfrom
vszakats:curl-h-more-long
Closed

CURLOPT: bump CURLFTP* enums to long, drop casts#17797
vszakats wants to merge 10 commits intocurl:masterfrom
vszakats:curl-h-more-long

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jul 1, 2025

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.

@vszakats vszakats marked this pull request as draft July 1, 2025 16:18
@vszakats vszakats changed the title bump CURLOPT enums and constants to long CURLOPT: bump enums and constants to long Jul 1, 2025
@vszakats vszakats force-pushed the curl-h-more-long branch from 391db8f to 60eaccf Compare July 1, 2025 16:45
@vszakats vszakats changed the title CURLOPT: bump enums and constants to long CURLOPT: bump enums to long Jul 1, 2025
@vszakats vszakats force-pushed the curl-h-more-long branch 3 times, most recently from b831eae to 63101fe Compare July 1, 2025 17:49
@vszakats vszakats changed the title CURLOPT: bump enums to long CURLOPT: bump enums to long, drop casts Jul 1, 2025
CURLFTP_CREATE_DIR_NONE,
CURLFTP_CREATE_DIR,
CURLFTP_CREATE_DIR_RETRY
} curl_ftpcreatedir;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the enums still need to be provided, as they have been offered in the header for a long while there is a significant change/risk that there are users using this publicly provided type in source code now.

Copy link
Member Author

@vszakats vszakats Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the enums in curl/curl.h.
This is a copy in the docs, synced with the updated header.

There is a similar copy case in CURLOPT_HSTS_CTRL,
out of sync with curl/curl.h, ref #17791.

It'd seem safe to delete such copies from the docs, since the
macros are described in the texts anyway. What do you think?

@dfandrich
Copy link
Contributor

FWIW, you can force an enum to be long in C23 (so with gcc >=15) with the syntax enum:long {…}.

@vszakats vszakats marked this pull request as ready for review July 7, 2025 12:40
@vszakats vszakats added the feature-window A merge of this requires an open feature window label Jul 7, 2025
@vszakats vszakats changed the title CURLOPT: bump enums to long, drop casts CURLOPT: bump CURLFTP* enums to long, drop casts Jul 28, 2025
@vszakats vszakats closed this in 430f9b0 Jul 28, 2025
@vszakats vszakats deleted the curl-h-more-long branch July 28, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmdline tool feature-window A merge of this requires an open feature window libcurl API tests

Development

Successfully merging this pull request may close these issues.

3 participants