CURLOPT: drop redundant long casts

Also:
- CURLOPT_HSTS_CTRL.md: sync macro definitions with `curl/curl.h`.
  Perhaps it'd be better to delete copies like this?
- keep existing casts within the documentation to make sure it applies
  to older curl versions as well.
- CURLOPT_IPRESOLVE.md: re-add a long cast to man page, for consistency
  with the above.

Closes #17791
This commit is contained in:
Viktor Szakats 2025-07-01 11:31:01 +02:00
parent fc98a630cf
commit 5debe7cb34
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
32 changed files with 43 additions and 46 deletions

View file

@ -142,7 +142,7 @@ int main(int argc, char **argv)
/* tell libcurl we can use "any" auth, which lets the lib pick one, but it
also costs one extra round-trip and possibly sending of all the PUT
data twice!!! */
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
/* set user name and password for the authentication */
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");

View file

@ -66,7 +66,7 @@
#include <curl/curl.h>
#define MSG_OUT g_print /* Change to "g_error" to write to stderr */
#define SHOW_VERBOSE 0 /* Set to non-zero for libcurl messages */
#define SHOW_VERBOSE 0L /* Set to non-zero for libcurl messages */
#define SHOW_PROGRESS 0 /* Set to non-zero to enable progress callback */
/* Global information, common to all connections */
@ -311,7 +311,7 @@ static void new_conn(const char *url, struct GlobalInfo *g)
curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url);
curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn);
curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, (long)SHOW_VERBOSE);
curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, SHOW_VERBOSE);
curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error);
curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn);
curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS ? 0L : 1L);

View file

@ -87,7 +87,7 @@ int main(void)
struct state st = {0};
/* enable HSTS for this handle */
curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE);
curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
/* function to call at first to populate the cache before the transfer */
curl_easy_setopt(curl, CURLOPT_HSTSREADFUNCTION, hstsread);

View file

@ -38,8 +38,7 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Use HTTP/3 but fallback to earlier HTTP if necessary */
curl_easy_setopt(curl, CURLOPT_HTTP_VERSION,
(long)CURL_HTTP_VERSION_3);
curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3);
/* Perform the request, res gets the return code */
res = curl_easy_perform(curl);

View file

@ -57,7 +57,7 @@ int main(void)
* of using CURLUSESSL_TRY here, because if TLS upgrade fails, the
* transfer continues anyway - see the security discussion in the libcurl
* tutorial for more details. */
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
/* If your server does not have a valid certificate, then you can disable
* part of the Transport Layer Security protection by setting the

View file

@ -56,7 +56,7 @@ int main(void)
* using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer
* continues anyway - see the security discussion in the libcurl tutorial
* for more details. */
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
/* If your server does not have a valid certificate, then you can disable
* part of the Transport Layer Security protection by setting the

View file

@ -110,7 +110,7 @@ int main(void)
* of using CURLUSESSL_TRY here, because if TLS upgrade fails, the
* transfer continues anyway - see the security discussion in the libcurl
* tutorial for more details. */
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
/* If your server does not have a valid certificate, then you can disable
* part of the Transport Layer Security protection by setting the