From 38961528434e6efdd4c1fba19e67ae0f0585007c Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Fri, 28 Nov 2025 10:44:05 +0100 Subject: [PATCH] connection: give send methods/prototypes an uint8_t buffer To conclude changing the send buffer type from `const void *` to `const uint8_t *`, change the top level send function and its implementations. Closes #19743 --- lib/cfilters.c | 2 +- lib/cfilters.h | 2 +- lib/curl_rtmp.c | 2 +- lib/urldata.h | 2 +- lib/vssh/libssh.c | 4 ++-- lib/vssh/libssh2.c | 9 +++++---- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/cfilters.c b/lib/cfilters.c index 7d1f0c3d9e..dd4cb5210a 100644 --- a/lib/cfilters.c +++ b/lib/cfilters.c @@ -242,7 +242,7 @@ CURLcode Curl_cf_recv(struct Curl_easy *data, int num, char *buf, } CURLcode Curl_cf_send(struct Curl_easy *data, int num, - const void *mem, size_t len, bool eos, + const uint8_t *mem, size_t len, bool eos, size_t *pnwritten) { struct Curl_cfilter *cf; diff --git a/lib/cfilters.h b/lib/cfilters.h index 5d39725088..a3bd97a9f1 100644 --- a/lib/cfilters.h +++ b/lib/cfilters.h @@ -508,7 +508,7 @@ CURLcode Curl_cf_recv(struct Curl_easy *data, int sockindex, char *buf, * in `*pnwritten` or on error. */ CURLcode Curl_cf_send(struct Curl_easy *data, int sockindex, - const void *buf, size_t len, bool eos, + const uint8_t *buf, size_t len, bool eos, size_t *pnwritten); /** diff --git a/lib/curl_rtmp.c b/lib/curl_rtmp.c index 351c9f494c..b2dd937008 100644 --- a/lib/curl_rtmp.c +++ b/lib/curl_rtmp.c @@ -352,7 +352,7 @@ static CURLcode rtmp_recv(struct Curl_easy *data, int sockindex, char *buf, } static CURLcode rtmp_send(struct Curl_easy *data, int sockindex, - const void *buf, size_t len, bool eos, + const uint8_t *buf, size_t len, bool eos, size_t *pnwritten) { struct connectdata *conn = data->conn; diff --git a/lib/urldata.h b/lib/urldata.h index 2d28718181..561db56ecd 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -162,7 +162,7 @@ typedef unsigned int curl_prot_t; /* On error return, the value of `pnwritten` has no meaning */ typedef CURLcode (Curl_send)(struct Curl_easy *data, /* transfer */ int sockindex, /* socketindex */ - const void *buf, /* data to write */ + const uint8_t *buf, /* data to write */ size_t len, /* amount to send */ bool eos, /* last chunk */ size_t *pnwritten); /* how much sent */ diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index d0f3d3de5c..db80bcbf8c 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -2887,7 +2887,7 @@ static CURLcode scp_done(struct Curl_easy *data, CURLcode status, } static CURLcode scp_send(struct Curl_easy *data, int sockindex, - const void *mem, size_t len, bool eos, + const uint8_t *mem, size_t len, bool eos, size_t *pnwritten) { int rc; @@ -3048,7 +3048,7 @@ static CURLcode sftp_done(struct Curl_easy *data, CURLcode status, /* return number of sent bytes */ static CURLcode sftp_send(struct Curl_easy *data, int sockindex, - const void *mem, size_t len, bool eos, + const uint8_t *mem, size_t len, bool eos, size_t *pnwritten) { struct connectdata *conn = data->conn; diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index 31ef5092d3..ce593d5487 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -3715,7 +3715,7 @@ static CURLcode scp_done(struct Curl_easy *data, CURLcode status, } static CURLcode scp_send(struct Curl_easy *data, int sockindex, - const void *mem, size_t len, bool eos, + const uint8_t *mem, size_t len, bool eos, size_t *pnwritten) { struct connectdata *conn = data->conn; @@ -3731,7 +3731,8 @@ static CURLcode scp_send(struct Curl_easy *data, int sockindex, return CURLE_FAILED_INIT; /* libssh2_channel_write() returns int! */ - nwritten = (ssize_t) libssh2_channel_write(sshc->ssh_channel, mem, len); + nwritten = (ssize_t) libssh2_channel_write(sshc->ssh_channel, + (const char *)mem, len); ssh_block2waitfor(data, sshc, (nwritten == LIBSSH2_ERROR_EAGAIN)); @@ -3874,7 +3875,7 @@ static CURLcode sftp_done(struct Curl_easy *data, CURLcode status, /* return number of sent bytes */ static CURLcode sftp_send(struct Curl_easy *data, int sockindex, - const void *mem, size_t len, bool eos, + const uint8_t *mem, size_t len, bool eos, size_t *pnwritten) { struct connectdata *conn = data->conn; @@ -3888,7 +3889,7 @@ static CURLcode sftp_send(struct Curl_easy *data, int sockindex, if(!sshc) return CURLE_FAILED_INIT; - nwrite = libssh2_sftp_write(sshc->sftp_handle, mem, len); + nwrite = libssh2_sftp_write(sshc->sftp_handle, (const char *)mem, len); ssh_block2waitfor(data, sshc, (nwrite == LIBSSH2_ERROR_EAGAIN));