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

@ -424,7 +424,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
const char *userp,
const char *passwdp,
const char *service,
const char *hostname,
const char *host,
struct ntlmdata *ntlm,
struct bufref *out)
{
@ -445,7 +445,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
size_t size;
char *ntlmbuf;
const char *host = ""; /* empty */
const char *hostname = ""; /* empty */
const char *domain = ""; /* empty */
size_t hostlen = 0;
size_t domlen = 0;
@ -456,7 +456,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
(void)userp;
(void)passwdp;
(void)service;
(void)hostname;
(void)host;
/* Clean up any former leftovers and initialise to defaults */
Curl_auth_cleanup_ntlm(ntlm);
@ -490,7 +490,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
SHORTPAIR(hostlen),
SHORTPAIR(hostoff),
0, 0,
host, /* this is empty */
hostname, /* this is empty */
domain /* this is empty */);
if(!ntlmbuf)

View file

@ -191,21 +191,21 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
* Returns CURLE_OK on success.
*/
CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data,
const struct bufref *type2,
const struct bufref *type2ref,
struct ntlmdata *ntlm)
{
/* Ensure we have a valid type-2 message */
if(!Curl_bufref_len(type2)) {
if(!Curl_bufref_len(type2ref)) {
infof(data, "NTLM handshake failure (empty type-2 message)");
return CURLE_BAD_CONTENT_ENCODING;
}
/* Store the challenge for later use */
ntlm->input_token = curlx_memdup0(Curl_bufref_ptr(type2),
Curl_bufref_len(type2));
ntlm->input_token = curlx_memdup0(Curl_bufref_ptr(type2ref),
Curl_bufref_len(type2ref));
if(!ntlm->input_token)
return CURLE_OUT_OF_MEMORY;
ntlm->input_token_len = Curl_bufref_len(type2);
ntlm->input_token_len = Curl_bufref_len(type2ref);
return CURLE_OK;
}

View file

@ -199,7 +199,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
const char *userp,
const char *passwdp,
const char *service,
const char *hostname,
const char *host,
struct ntlmdata *ntlm,
struct bufref *out);
@ -263,7 +263,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
const char *passwdp,
const char *service,
const char *host,
const bool mutual,
const bool mutual_auth,
const struct bufref *chlg,
struct kerberos5data *krb5,
struct bufref *out);