]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl.h: make CURL_IPRESOLVE_* symbols defined as longs
authorChristian Hesse <mail@eworm.de>
Tue, 1 Jul 2025 08:29:13 +0000 (10:29 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 7 Jul 2025 12:37:12 +0000 (14:37 +0200)
... as `curl_easy_setopt()` expects them to be.

Also remove some casting workarounds.

Closes #17790

docs/examples/ipv6.c
docs/libcurl/opts/CURLOPT_IPRESOLVE.md
include/curl/curl.h
tests/unit/unit2600.c

index 371e0f5573e24ef07a0efab79a42e492173dd8e3..1b698705d0ccf29fab1780a5c7ffd5c06de82d01 100644 (file)
@@ -35,7 +35,7 @@ int main(void)
 
   curl = curl_easy_init();
   if(curl) {
-    curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V6);
+    curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
 
     curl_easy_setopt(curl, CURLOPT_URL, "https://curl.se/");
 
index 1b13e3641d7643e3205452e71fffb09b591164c7..1b761c961b560e1e35e49063a820af8d0f787507 100644 (file)
@@ -66,7 +66,7 @@ int main(void)
     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
 
     /* of all addresses example.com resolves to, only IPv6 ones are used */
-    curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V6);
+    curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
 
     res = curl_easy_perform(curl);
 
index 9eb021305a3109f8d25a98827b2ae0512208e613..7ef5b9934987b865a00877aba1ffbbd936603199 100644 (file)
@@ -2289,10 +2289,10 @@ typedef enum {
   /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
      name resolves addresses using more than one IP protocol version, this
      option might be handy to force libcurl to use a specific IP version. */
-#define CURL_IPRESOLVE_WHATEVER 0 /* default, uses addresses to all IP
+#define CURL_IPRESOLVE_WHATEVER 0L /* default, uses addresses to all IP
                                      versions that your system allows */
-#define CURL_IPRESOLVE_V4       1 /* uses only IPv4 addresses/connections */
-#define CURL_IPRESOLVE_V6       2 /* uses only IPv6 addresses/connections */
+#define CURL_IPRESOLVE_V4       1L /* uses only IPv4 addresses/connections */
+#define CURL_IPRESOLVE_V6       2L /* uses only IPv6 addresses/connections */
 
   /* Convenient "aliases" */
 #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
index 47459477a4bd7addc0dc202f53123fdf5033b491..063eed3536943b17f45ea6afc20ad1cfeb6ac1de 100644 (file)
@@ -75,7 +75,7 @@ struct test_case {
   int id;
   const char *url;
   const char *resolve_info;
-  unsigned char ip_version;
+  long ip_version;
   timediff_t connect_timeout_ms;
   timediff_t he_timeout_ms;
   timediff_t cf4_fail_delay_ms;
@@ -312,7 +312,7 @@ static void test_connect(CURL *easy, const struct test_case *tc)
   list = curl_slist_append(NULL, tc->resolve_info);
   fail_unless(list, "error allocating resolve list entry");
   curl_easy_setopt(easy, CURLOPT_RESOLVE, list);
-  curl_easy_setopt(easy, CURLOPT_IPRESOLVE, (long)tc->ip_version);
+  curl_easy_setopt(easy, CURLOPT_IPRESOLVE, tc->ip_version);
   curl_easy_setopt(easy, CURLOPT_CONNECTTIMEOUT_MS,
                    (long)tc->connect_timeout_ms);
   curl_easy_setopt(easy, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,