lib: unify recv/send function signatures

cfilter/conn: change send/recv function signatures. Unify the
calling/return conventions in our send/receive handling.

Curl_conn_recv(), adjust pnread type

Parameter `pnread` was a `ssize_t *`, but `size_t *` is better since the
function returns any error in its `CURLcode` return value.

Closes #17546
This commit is contained in:
Stefan Eissing 2025-06-11 10:18:15 +02:00 committed by Daniel Stenberg
parent 3934431421
commit 20c90ba298
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
37 changed files with 1114 additions and 1219 deletions

View file

@ -428,14 +428,13 @@ static CURLcode mqtt_recv_atleast(struct Curl_easy *data, size_t nbytes)
if(rlen < nbytes) {
unsigned char readbuf[1024];
ssize_t nread;
size_t nread;
DEBUGASSERT(nbytes - rlen < sizeof(readbuf));
result = Curl_xfer_recv(data, (char *)readbuf, nbytes - rlen, &nread);
if(result)
return result;
DEBUGASSERT(nread >= 0);
if(curlx_dyn_addn(&mq->recvbuf, readbuf, (size_t)nread))
if(curlx_dyn_addn(&mq->recvbuf, readbuf, nread))
return CURLE_OUT_OF_MEMORY;
rlen = curlx_dyn_len(&mq->recvbuf);
}
@ -703,7 +702,7 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
{
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
ssize_t nread;
size_t nread;
size_t remlen;
struct mqtt_conn *mqtt = Curl_conn_meta_get(conn, CURL_META_MQTT_CONN);
struct MQTT *mq = Curl_meta_get(data, CURL_META_MQTT_EASY);
@ -868,7 +867,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
{
struct MQTT *mq = Curl_meta_get(data, CURL_META_MQTT_EASY);
CURLcode result = CURLE_OK;
ssize_t nread;
size_t nread;
unsigned char recvbyte;
struct mqtt_conn *mqtt = Curl_conn_meta_get(data->conn, CURL_META_MQTT_CONN);