clang-tidy: enable more checks, fix fallouts

- enable three checks:
  - bugprone-invalid-enum-default-initialization
  - bugprone-sizeof-expression
  - readability-inconsistent-declaration-parameter-name (strict)
- fix remaining discrepancies with arg names in prototypes
  and implementation, in strict mode.
- document reason for some checks tested but not enabled.

Closes #20794
This commit is contained in:
Viktor Szakats 2026-03-03 01:58:29 +01:00
parent e0dd6eb4a4
commit df6014894b
No known key found for this signature in database
34 changed files with 222 additions and 209 deletions

View file

@ -1527,16 +1527,16 @@ static CURLcode nw_in_recv(void *reader_ctx,
return curl_easy_recv(data, buf, buflen, pnread);
}
CURLcode curl_ws_recv(CURL *d, void *buffer,
size_t buflen, size_t *nread,
CURLcode curl_ws_recv(CURL *curl, void *buffer,
size_t buflen, size_t *recv,
const struct curl_ws_frame **metap)
{
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
struct connectdata *conn;
struct websocket *ws;
struct ws_collect ctx;
*nread = 0;
*recv = 0;
*metap = NULL;
if(!GOOD_EASY_HANDLE(data) || (buflen && !buffer))
return CURLE_BAD_FUNCTION_ARGUMENT;
@ -1609,10 +1609,10 @@ CURLcode curl_ws_recv(CURL *d, void *buffer,
update_meta(ws, ctx.frame_age, ctx.frame_flags, ctx.payload_offset,
ctx.payload_len, ctx.bufidx);
*metap = &ws->recvframe;
*nread = ws->recvframe.len;
*recv = ws->recvframe.len;
CURL_TRC_WS(data, "curl_ws_recv(len=%zu) -> %zu bytes (frame at %"
FMT_OFF_T ", %" FMT_OFF_T " left)",
buflen, *nread, ws->recvframe.offset,
buflen, *recv, ws->recvframe.offset,
ws->recvframe.bytesleft);
/* all's well, try to send any pending control. we do not know
* when the application will call `curl_ws_send()` again. */
@ -1763,7 +1763,7 @@ static CURLcode ws_send_raw(struct Curl_easy *data, const void *buffer,
return result;
}
CURLcode curl_ws_send(CURL *d, const void *buffer_arg,
CURLcode curl_ws_send(CURL *curl, const void *buffer_arg,
size_t buflen, size_t *sent,
curl_off_t fragsize,
unsigned int flags)
@ -1771,7 +1771,7 @@ CURLcode curl_ws_send(CURL *d, const void *buffer_arg,
struct websocket *ws;
const uint8_t *buffer = buffer_arg;
CURLcode result = CURLE_OK;
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
size_t ndummy;
size_t *pnsent = sent ? sent : &ndummy;
@ -1851,11 +1851,11 @@ static CURLcode ws_setup_conn(struct Curl_easy *data,
return Curl_http_setup_conn(data, conn);
}
const struct curl_ws_frame *curl_ws_meta(CURL *d)
const struct curl_ws_frame *curl_ws_meta(CURL *curl)
{
/* we only return something for websocket, called from within the callback
when not using raw mode */
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
if(GOOD_EASY_HANDLE(data) && Curl_is_in_callback(data) &&
data->conn && !data->set.ws_raw_mode) {
struct websocket *ws;
@ -1866,13 +1866,13 @@ const struct curl_ws_frame *curl_ws_meta(CURL *d)
return NULL;
}
CURL_EXTERN CURLcode curl_ws_start_frame(CURL *d,
CURL_EXTERN CURLcode curl_ws_start_frame(CURL *curl,
unsigned int flags,
curl_off_t frame_len)
{
struct websocket *ws;
CURLcode result = CURLE_OK;
struct Curl_easy *data = d;
struct Curl_easy *data = curl;
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
@ -1941,13 +1941,13 @@ const struct Curl_protocol Curl_protocol_ws = {
#else
CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
size_t *nread,
size_t *recv,
const struct curl_ws_frame **metap)
{
(void)curl;
(void)buffer;
(void)buflen;
(void)nread;
(void)recv;
(void)metap;
return CURLE_NOT_BUILT_IN;
}