]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CURLOPT: bump `CURLHEADER_*` macros to `long`, drop casts
authorViktor Szakats <commit@vsz.me>
Mon, 28 Jul 2025 09:10:34 +0000 (11:10 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 28 Jul 2025 15:31:33 +0000 (17:31 +0200)
This patch bumps the size of these macros 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:

- CURLHEADER_SEPARATE
- CURLHEADER_UNIFIED

Also:
- keep existing cast within the documentation to make sure it applies
  to older curl versions as well.

Closes #18055

include/curl/curl.h
tests/libtest/lib1525.c
tests/libtest/lib1526.c
tests/libtest/lib1527.c
tests/libtest/lib1528.c

index 0ff9a307a79f505f139cb9c1c760e29806ab147b..67f03503b7bb60097eee2e069fcdb21141fd778a 100644 (file)
@@ -1024,8 +1024,8 @@ typedef enum {
 } curl_ftpmethod;
 
 /* bitmask defines for CURLOPT_HEADEROPT */
-#define CURLHEADER_UNIFIED  0
-#define CURLHEADER_SEPARATE (1<<0)
+#define CURLHEADER_UNIFIED  0L
+#define CURLHEADER_SEPARATE (1L<<0)
 
 /* CURLALTSVC_* are bits for the CURLOPT_ALTSVC_CTRL option */
 #define CURLALTSVC_READONLYFILE (1L<<2)
index 10639ea7ff8d7226e74c9e205659e6d2564e2136..375d6aef51ab6e0dfbc5c1f23ee5241c62438089 100644 (file)
@@ -74,7 +74,7 @@ static CURLcode test_lib1525(char *URL)
   test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
   test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
   test_setopt(curl, CURLOPT_PROXYHEADER, hhl);
-  test_setopt(curl, CURLOPT_HEADEROPT, (long)CURLHEADER_UNIFIED);
+  test_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_UNIFIED);
   test_setopt(curl, CURLOPT_POST, 0L);
   test_setopt(curl, CURLOPT_UPLOAD, 1L);
   test_setopt(curl, CURLOPT_VERBOSE, 1L);
index ad3956fa74e3ee8f69c101f3518578670b7dd169..c2e3685a158031d428ee53c02c486fb0fc7dab16 100644 (file)
@@ -78,7 +78,7 @@ static CURLcode test_lib1526(char *URL)
   test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
   test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
   test_setopt(curl, CURLOPT_PROXYHEADER, phl);
-  test_setopt(curl, CURLOPT_HEADEROPT, (long)CURLHEADER_SEPARATE);
+  test_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE);
   test_setopt(curl, CURLOPT_POST, 0L);
   test_setopt(curl, CURLOPT_UPLOAD, 1L);
   test_setopt(curl, CURLOPT_VERBOSE, 1L);
index 2e7c341cc23ddca68fe0a6532ee27e8be119846d..35e06b45aefd60b07fa06ec2581c84e55aba1aef 100644 (file)
@@ -85,7 +85,7 @@ static CURLcode test_lib1527(char *URL)
   test_setopt(curl, CURLOPT_READFUNCTION, t1527_read_cb);
   test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
   test_setopt(curl, CURLOPT_INFILESIZE, (long)strlen(t1527_testdata));
-  test_setopt(curl, CURLOPT_HEADEROPT, (long)CURLHEADER_UNIFIED);
+  test_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_UNIFIED);
 
   res = curl_easy_perform(curl);
 
index 068c17c68256313f6f62e0cea33afdb8a52dfa4d..24293a01888e14fca77c4d9d652f1f1fb0b71079 100644 (file)
@@ -56,7 +56,7 @@ static CURLcode test_lib1528(char *URL)
   test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
   test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
   test_setopt(curl, CURLOPT_PROXYHEADER, phl);
-  test_setopt(curl, CURLOPT_HEADEROPT, (long)CURLHEADER_SEPARATE);
+  test_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE);
   test_setopt(curl, CURLOPT_VERBOSE, 1L);
   test_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
   test_setopt(curl, CURLOPT_HEADER, 1L);