lib: fix formatting nits (part 3)

From `lib/h` to `lib/w`.

part 1: 47a1ab2ebe #19764
part 2: 86b346443b #19800

Closes #19811
This commit is contained in:
Viktor Szakats 2025-12-02 07:25:18 +01:00
parent dc8c0d54a5
commit c3b030b860
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
102 changed files with 2001 additions and 2226 deletions

View file

@ -59,8 +59,8 @@ static CURLcode setopt_set_timeout_sec(timediff_t *ptimeout_ms, long secs)
{
if(secs < 0)
return CURLE_BAD_FUNCTION_ARGUMENT;
#if LONG_MAX > (TIMEDIFF_T_MAX/1000)
if(secs > (TIMEDIFF_T_MAX/1000)) {
#if LONG_MAX > (TIMEDIFF_T_MAX / 1000)
if(secs > (TIMEDIFF_T_MAX / 1000)) {
*ptimeout_ms = TIMEDIFF_T_MAX;
return CURLE_OK;
}
@ -193,7 +193,7 @@ static CURLcode setstropt_interface(char *option, char **devp,
return CURLE_OK;
}
#define C_SSLVERSION_VALUE(x) (x & 0xffff)
#define C_SSLVERSION_VALUE(x) (x & 0xffff)
#define C_SSLVERSION_MAX_VALUE(x) ((unsigned long)x & 0xffff0000)
static CURLcode protocol2num(const char *str, curl_prot_t *val)
@ -208,7 +208,7 @@ static CURLcode protocol2num(const char *str, curl_prot_t *val)
return CURLE_BAD_FUNCTION_ARGUMENT;
if(curl_strequal(str, "all")) {
*val = ~(curl_prot_t) 0;
*val = ~(curl_prot_t)0;
return CURLE_OK;
}
@ -217,7 +217,7 @@ static CURLcode protocol2num(const char *str, curl_prot_t *val)
size_t tlen;
str = strchr(str, ',');
tlen = str ? (size_t) (str - token) : strlen(token);
tlen = str ? (size_t)(str - token) : strlen(token);
if(tlen) {
const struct Curl_handler *h = Curl_getn_scheme_handler(token, tlen);
@ -256,7 +256,7 @@ static CURLcode httpauth(struct Curl_easy *data, bool proxy,
/* switch off bits we cannot support */
#ifndef USE_NTLM
auth &= ~CURLAUTH_NTLM; /* no NTLM support */
auth &= ~CURLAUTH_NTLM; /* no NTLM support */
#endif
#ifndef USE_SPNEGO
auth &= ~CURLAUTH_NEGOTIATE; /* no Negotiate (SPNEGO) auth without GSS-API
@ -787,8 +787,7 @@ static CURLcode setopt_bool(struct Curl_easy *data, CURLoption option,
case CURLOPT_SSL_SESSIONID_CACHE:
s->ssl.primary.cache_session = enabled;
#ifndef CURL_DISABLE_PROXY
s->proxy_ssl.primary.cache_session =
s->ssl.primary.cache_session;
s->proxy_ssl.primary.cache_session = s->ssl.primary.cache_session;
#endif
break;
#ifdef USE_SSH
@ -810,7 +809,7 @@ static CURLcode setopt_bool(struct Curl_easy *data, CURLoption option,
s->tcp_keepalive = enabled;
break;
case CURLOPT_TCP_FASTOPEN:
#if defined(CONNECT_DATA_IDEMPOTENT) || defined(MSG_FASTOPEN) || \
#if defined(CONNECT_DATA_IDEMPOTENT) || defined(MSG_FASTOPEN) || \
defined(TCP_FASTOPEN_CONNECT)
s->tcp_fastopen = enabled;
break;
@ -1099,7 +1098,7 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
#ifdef HAVE_GSSAPI
case CURLOPT_GSSAPI_DELEGATION:
s->gssapi_delegation = (unsigned char)uarg &
(CURLGSSAPI_DELEGATION_POLICY_FLAG|CURLGSSAPI_DELEGATION_FLAG);
(CURLGSSAPI_DELEGATION_POLICY_FLAG | CURLGSSAPI_DELEGATION_FLAG);
break;
#endif
@ -1145,7 +1144,7 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
case CURLOPT_IPRESOLVE:
if((arg < CURL_IPRESOLVE_WHATEVER) || (arg > CURL_IPRESOLVE_V6))
return CURLE_BAD_FUNCTION_ARGUMENT;
s->ipver = (unsigned char) arg;
s->ipver = (unsigned char)arg;
break;
case CURLOPT_CONNECT_ONLY:
@ -1413,8 +1412,8 @@ static CURLcode setopt_pointers(struct Curl_easy *data, CURLoption option,
break;
#endif /* ! CURL_DISABLE_FORM_API */
#endif /* ! CURL_DISABLE_HTTP */
#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_SMTP) || \
!defined(CURL_DISABLE_IMAP)
#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_SMTP) || \
!defined(CURL_DISABLE_IMAP)
# ifndef CURL_DISABLE_MIME
case CURLOPT_MIMEPOST:
/*
@ -1444,8 +1443,7 @@ static CURLcode setopt_pointers(struct Curl_easy *data, CURLoption option,
if(!s->err)
s->err = stderr;
break;
case CURLOPT_SHARE:
{
case CURLOPT_SHARE: {
struct Curl_share *set = va_arg(param, struct Curl_share *);
/* disconnect from old share, if any */
@ -1492,7 +1490,7 @@ static CURLcode setopt_pointers(struct Curl_easy *data, CURLoption option,
/* enable cookies since we now use a share that uses cookies! */
data->cookies = data->share->cookies;
}
#endif /* CURL_DISABLE_HTTP */
#endif /* CURL_DISABLE_HTTP */
#ifndef CURL_DISABLE_HSTS
if(data->share->hsts) {
/* first free the private one if any */
@ -1509,8 +1507,8 @@ static CURLcode setopt_pointers(struct Curl_easy *data, CURLoption option,
}
/* check for host cache not needed,
* it will be done by curl_easy_perform */
break;
}
break;
#ifdef USE_HTTP2
case CURLOPT_STREAM_DEPENDS:
@ -1530,8 +1528,7 @@ static CURLcode setopt_pointers(struct Curl_easy *data, CURLoption option,
}
#ifndef CURL_DISABLE_COOKIES
static CURLcode cookielist(struct Curl_easy *data,
const char *ptr)
static CURLcode cookielist(struct Curl_easy *data, const char *ptr)
{
CURLcode result = CURLE_OK;
if(!ptr)
@ -1584,8 +1581,7 @@ static CURLcode cookielist(struct Curl_easy *data,
return result;
}
static CURLcode cookiefile(struct Curl_easy *data,
const char *ptr)
static CURLcode cookiefile(struct Curl_easy *data, const char *ptr)
{
/*
* Set cookie file to read and parse. Can be used multiple times.
@ -1639,8 +1635,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
case CURLOPT_PROXY_SSL_CIPHER_LIST:
if(Curl_ssl_supports(data, SSLSUPP_CIPHER_LIST)) {
/* set a list of cipher we want to use in the SSL connection for proxy */
return Curl_setstropt(&s->str[STRING_SSL_CIPHER_LIST_PROXY],
ptr);
return Curl_setstropt(&s->str[STRING_SSL_CIPHER_LIST_PROXY], ptr);
}
else
return CURLE_NOT_BUILT_IN;
@ -1656,8 +1651,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
case CURLOPT_PROXY_TLS13_CIPHERS:
if(Curl_ssl_supports(data, SSLSUPP_TLS13_CIPHERSUITES))
/* set preferred list of TLS 1.3 cipher suites for proxy */
return Curl_setstropt(&s->str[STRING_SSL_CIPHER13_LIST_PROXY],
ptr);
return Curl_setstropt(&s->str[STRING_SSL_CIPHER13_LIST_PROXY], ptr);
else
return CURLE_NOT_BUILT_IN;
#endif
@ -1841,7 +1835,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
* to use the socks proxy.
*/
return Curl_setstropt(&s->str[STRING_PRE_PROXY], ptr);
#endif /* CURL_DISABLE_PROXY */
#endif /* CURL_DISABLE_PROXY */
#ifndef CURL_DISABLE_PROXY
case CURLOPT_SOCKS5_GSSAPI_SERVICE:
@ -2038,8 +2032,8 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
}
curlx_free(u);
curlx_free(p);
}
break;
}
case CURLOPT_PROXYUSERNAME:
/*
* authentication username to use in the operation
@ -2201,8 +2195,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
*/
#ifdef USE_SSL
if(Curl_ssl_supports(data, SSLSUPP_PINNEDPUBKEY))
return Curl_setstropt(&s->str[STRING_SSL_PINNEDPUBLICKEY_PROXY],
ptr);
return Curl_setstropt(&s->str[STRING_SSL_PINNEDPUBLICKEY_PROXY], ptr);
#endif
return CURLE_NOT_BUILT_IN;
#endif
@ -2304,8 +2297,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
* Specify colon-delimited list of signature scheme names.
*/
if(Curl_ssl_supports(data, SSLSUPP_SIGNATURE_ALGORITHMS))
return Curl_setstropt(&s->str[STRING_SSL_SIGNATURE_ALGORITHMS],
ptr);
return Curl_setstropt(&s->str[STRING_SSL_SIGNATURE_ALGORITHMS], ptr);
return CURLE_NOT_BUILT_IN;
#endif
#ifdef USE_SSH
@ -2347,8 +2339,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
* Option to allow for the SHA256 of the host public key to be checked
* for validation purposes.
*/
return Curl_setstropt(&s->str[STRING_SSH_HOST_PUBLIC_KEY_SHA256],
ptr);
return Curl_setstropt(&s->str[STRING_SSH_HOST_PUBLIC_KEY_SHA256], ptr);
case CURLOPT_SSH_HOSTKEYDATA:
/*
@ -2367,7 +2358,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
}
else
/* make a NULL argument reset to default */
s->allowed_protocols = (curl_prot_t) CURLPROTO_ALL;
s->allowed_protocols = (curl_prot_t)CURLPROTO_ALL;
break;
case CURLOPT_REDIR_PROTOCOLS_STR:
@ -2379,7 +2370,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
}
else
/* make a NULL argument reset to default */
s->redir_protocols = (curl_prot_t) CURLPROTO_REDIR;
s->redir_protocols = (curl_prot_t)CURLPROTO_REDIR;
break;
case CURLOPT_DEFAULT_PROTOCOL:
@ -2571,17 +2562,13 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
}
/* set tls_ech flag value, preserving CLA_CFG bit */
if(!strcmp(ptr, "false"))
s->tls_ech = CURLECH_DISABLE |
(s->tls_ech & CURLECH_CLA_CFG);
s->tls_ech = (s->tls_ech & CURLECH_CLA_CFG) | CURLECH_DISABLE;
else if(!strcmp(ptr, "grease"))
s->tls_ech = CURLECH_GREASE |
(s->tls_ech & CURLECH_CLA_CFG);
s->tls_ech = (s->tls_ech & CURLECH_CLA_CFG) | CURLECH_GREASE;
else if(!strcmp(ptr, "true"))
s->tls_ech = CURLECH_ENABLE |
(s->tls_ech & CURLECH_CLA_CFG);
s->tls_ech = (s->tls_ech & CURLECH_CLA_CFG) | CURLECH_ENABLE;
else if(!strcmp(ptr, "hard"))
s->tls_ech = CURLECH_HARD |
(s->tls_ech & CURLECH_CLA_CFG);
s->tls_ech = (s->tls_ech & CURLECH_CLA_CFG) | CURLECH_HARD;
else if(plen > 5 && !strncmp(ptr, "ecl:", 4)) {
result = Curl_setstropt(&s->str[STRING_ECH_CONFIG], ptr + 4);
if(result)
@ -2908,8 +2895,7 @@ static CURLcode setopt_blob(struct Curl_easy *data, CURLoption option,
/*
* Blob that holds Issuer certificate to check certificates issuer
*/
return Curl_setblobopt(&s->blobs[BLOB_SSL_ISSUERCERT_PROXY],
blob);
return Curl_setblobopt(&s->blobs[BLOB_SSL_ISSUERCERT_PROXY], blob);
#endif
case CURLOPT_SSLKEY_BLOB:
/*