]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
send: drop `CURL_UNCONST()` from buffer argument on most platforms
authorViktor Szakats <commit@vsz.me>
Wed, 28 Jan 2026 14:24:09 +0000 (15:24 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 29 Jan 2026 02:42:09 +0000 (03:42 +0100)
Keep it on platforms requiring a non-const buffer. These are AmigaOS and
OS400.

Also:
- replace `SEND_QUAL_ARG2` with boolean macro `SEND_NONCONST_ARG2`.

Closes #20463

lib/config-mac.h
lib/config-os400.h
lib/config-riscos.h
lib/config-win32.h
lib/curl_setup_once.h
lib/functypes.h
projects/vms/config_h.com

index 6c8acad72290ef76173b0d050d77df891effeb3c..8f32a51a3f271e1bfcbf2e809d3171b2996d357c 100644 (file)
@@ -77,7 +77,6 @@
 
 #define HAVE_SEND 1
 #define SEND_TYPE_ARG1 int
-#define SEND_QUAL_ARG2 const
 #define SEND_TYPE_ARG2 void *
 #define SEND_TYPE_ARG3 size_t
 #define SEND_TYPE_ARG4 int
index 610b9cd36f754dda32bb31d31ba23edd8fac55f4..294d512a9f546e3ff5f7f310116cd97101517a13 100644 (file)
 /* Define to the type of arg 1 for send. */
 #define SEND_TYPE_ARG1 int
 
-/* Define to the type qualifier of arg 2 for send. */
-#define SEND_QUAL_ARG2
+/* Define if the type qualifier of arg 2 for send is not const. */
+#define SEND_NONCONST_ARG2
 
 /* Define to the type of arg 2 for send. */
 #define SEND_TYPE_ARG2 char *
index ca8cd532b4ffb871edb37d75854a497d993a3fa0..43f33e50864f0a0c6df642291e93f1e4fdac542d 100644 (file)
 /* Define to the type of arg 1 for send. */
 #define SEND_TYPE_ARG1 int
 
-/* Define to the type qualifier of arg 2 for send. */
-#define SEND_QUAL_ARG2 const
-
 /* Define to the type of arg 2 for send. */
 #define SEND_TYPE_ARG2 void *
 
index 2609d5743650af8b802a7772bc054e91ee84e46a..4d509573cf63f9ee6b0d04a9cbc09dda67f22b5f 100644 (file)
 /* Define to the type of arg 1 for send. */
 #define SEND_TYPE_ARG1 SOCKET
 
-/* Define to the type qualifier of arg 2 for send. */
-#define SEND_QUAL_ARG2 const
-
 /* Define to the type of arg 2 for send. */
 #define SEND_TYPE_ARG2 char *
 
index 48ca36b560b9fb4167461c2d8f076426ec0e64b7..8cd21f1110b36f26080081a896d0bddbbc43e9eb 100644 (file)
@@ -144,9 +144,10 @@ struct timeval {
  * which is used to write outgoing data on a connected socket.
  * If yours has another name then do not define HAVE_SEND.
  *
- * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
- * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
- * SEND_TYPE_RETV must also be defined.
+ * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_TYPE_ARG2,
+ * SEND_TYPE_ARG3, SEND_TYPE_ARG4 and SEND_TYPE_RETV must also
+ * be defined. SEND_NONCONST_ARG2 must also be defined if ARG2
+ * does not accept const.
  */
 
 #define sread(x, y, z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
@@ -165,10 +166,17 @@ struct timeval {
                                        (SEND_TYPE_ARG2)CURL_UNCONST(y), \
                                        (SEND_TYPE_ARG3)(z))
 #elif defined(HAVE_SEND)
+#ifdef SEND_NONCONST_ARG2
 #define swrite(x, y, z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
-                              (SEND_QUAL_ARG2 SEND_TYPE_ARG2)CURL_UNCONST(y), \
+                                      (SEND_TYPE_ARG2)CURL_UNCONST(y), \
                                       (SEND_TYPE_ARG3)(z), \
                                       (SEND_TYPE_ARG4)(SEND_4TH_ARG))
+#else
+#define swrite(x, y, z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
+                                      (const SEND_TYPE_ARG2)(y), \
+                                      (SEND_TYPE_ARG3)(z), \
+                                      (SEND_TYPE_ARG4)(SEND_4TH_ARG))
+#endif /* SEND_NONCONST_ARG2 */
 #else /* HAVE_SEND */
 #ifndef swrite
 #error "Missing definition of macro swrite!"
index 12dfe17906de5b247d156ae978accb224db509c5..df3cfd44c88f3f254dfa1907c1673192b326fd8a 100644 (file)
@@ -59,9 +59,9 @@
 #define RECV_TYPE_ARG4 long
 #define RECV_TYPE_RETV long
 
-/* int send(int, const char *, int, int); */
+/* int send(int, char *, int, int); */
 #define SEND_TYPE_ARG1 int
-#define SEND_QUAL_ARG2
+#define SEND_NONCONST_ARG2
 #define SEND_TYPE_ARG2 char *
 #define SEND_TYPE_ARG3 int
 #define SEND_TYPE_RETV int
 #define RECV_TYPE_RETV ssize_t
 #endif
 
-#ifndef SEND_QUAL_ARG2
-#define SEND_QUAL_ARG2 const
-#endif
-
 #ifndef SEND_TYPE_ARG1
 #define SEND_TYPE_ARG1 int
 #endif
index ba66434ba0fb9abc445af2c7f82741813ffe3ca9..e42ecd9d78db2be5421f09d6690273283d440cf7 100644 (file)
@@ -1582,13 +1582,6 @@ $!      Process SEND directives
 $!-------------------------------------
 $       if key2a .eqs. "SEND"
 $       then
-$           if key2 .eqs. "SEND_QUAL_ARG2"
-$           then
-$               write tf "#ifndef ''key2'"
-$               write tf "#define ''key2' const"
-$               write tf "#endif"
-$               goto cfgh_in_loop1
-$           endif
 $           if key2 .eqs. "SEND_TYPE_ARG1"
 $           then
 $               write tf "#ifndef ''key2'"