tidy-up: miscellaneous

- badwords: replace stray synonyms with 'null-terminator'.
- tests/FILEFORMAT.md: tidy up feature descriptions.
- printf: replace stray `%i` masks with `%d` for consistency.
- pytest: add comments for empty excepts to try silencing GitHub CodeQL
  warnings.
- tool1394, unit1675: merge nested `if`s.
- dnscache: fix typo in comment.
- fix whitespace, indent and newlines.

Closes #21921
This commit is contained in:
Viktor Szakats 2026-06-05 23:02:11 +02:00
parent 849317ff5c
commit 952b04474c
No known key found for this signature in database
31 changed files with 90 additions and 90 deletions

View file

@ -91,7 +91,7 @@ static CURLcode cf_haproxy_date_out_set(struct Curl_cfilter *cf,
client_dest_ip = ipquad.remote_ip;
}
result = curlx_dyn_addf(&ctx->data_out, "PROXY %s %s %s %i %i\r\n",
result = curlx_dyn_addf(&ctx->data_out, "PROXY %s %s %s %d %d\r\n",
is_ipv6 ? "TCP6" : "TCP4",
client_source_ip, client_dest_ip,
ipquad.local_port, ipquad.remote_port);

View file

@ -667,7 +667,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
* We now have the numerical IP address in the 'myhost' buffer
*/
host = myhost;
infof(data, "Local Interface %s is ip %s using address family %i",
infof(data, "Local Interface %s is ip %s using address family %d",
iface, host, af);
done = 1;
break;
@ -693,7 +693,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
int h_af = h->addr->ai_family;
/* convert the resolved address, sizeof myhost >= INET_ADDRSTRLEN */
Curl_printable_address(h->addr, myhost, sizeof(myhost));
infof(data, "Name '%s' family %i resolved to '%s' family %i",
infof(data, "Name '%s' family %d resolved to '%s' family %d",
host, af, myhost, h_af);
Curl_dns_entry_unlink(data, &h); /* this will NULL, potential free h */
if(af != h_af) {

View file

@ -351,7 +351,7 @@ UNITTEST CURLcode dns_shuffle_addr(struct Curl_easy *data,
if(num_addrs > 1) {
struct Curl_addrinfo **nodes;
CURL_TRC_DNS(data, "Shuffling %i addresses", num_addrs);
CURL_TRC_DNS(data, "Shuffling %d addresses", num_addrs);
nodes = curlx_malloc(num_addrs * sizeof(*nodes));
if(nodes) {
@ -828,7 +828,7 @@ err:
Curl_hash_delete(&dnscache->entries, entry_id, entry_len + 1);
}
/* put this new host in the cache, an overridy for ALL dns queries */
/* put this new host in the cache, an override for ALL dns queries */
dns = dnscache_add_addr(data, dnscache, CURL_DNSQ_ALL,
&head, curlx_str(&source),
curlx_strlen(&source), port, permanent);

View file

@ -419,7 +419,7 @@ static CURLcode doh_probe_run(struct Curl_easy *data,
(void)curl_easy_setopt(doh, CURLOPT_SSL_OPTIONS,
((long)data->set.ssl.primary.ssl_options &
~CURLSSLOPT_AUTO_CLIENT_CERT));
~CURLSSLOPT_AUTO_CLIENT_CERT));
doh->state.internal = TRUE;
doh->master_mid = data->mid; /* master transfer of this one */

View file

@ -262,8 +262,8 @@ static const char *pgrs_timer_name(timerid timer)
return pgrs_timer_names[(size_t)timer];
return "?";
}
#endif /* CURLVERBOSE */
/*
* Curl_pgrsTimeWas(). Store the timestamp time at the given label.
*/

View file

@ -186,7 +186,7 @@ CURLcode Curl_rand_bytes(struct Curl_easy *data,
/*
* Curl_rand_hex() fills the 'rnd' buffer with a given 'num' size with random
* hexadecimal digits PLUS a null-terminating byte. It must be an odd number
* hexadecimal digits PLUS a null-terminator byte. It must be an odd number
* size.
*/
@ -214,7 +214,7 @@ CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd, size_t num)
/*
* Curl_rand_alnum() fills the 'rnd' buffer with a given 'num' size with random
* alphanumerical chars PLUS a null-terminating byte.
* alphanumerical chars PLUS a null-terminator byte.
*/
static const char alnum[] =

View file

@ -37,14 +37,14 @@ CURLcode Curl_rand_bytes(struct Curl_easy *data,
/*
* Curl_rand_hex() fills the 'rnd' buffer with a given 'num' size with random
* hexadecimal digits PLUS a null-terminating byte. It must be an odd number
* hexadecimal digits PLUS a null-terminator byte. It must be an odd number
* size.
*/
CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd, size_t num);
/*
* Curl_rand_alnum() fills the 'rnd' buffer with a given 'num' size with random
* alphanumerical chars PLUS a null-terminating byte.
* alphanumerical chars PLUS a null-terminator byte.
*/
CURLcode Curl_rand_alnum(struct Curl_easy *data, unsigned char *rnd,
size_t num);

View file

@ -491,7 +491,7 @@ static CURLcode tftp_tx(struct tftp_conn *state, tftp_event_t event)
break;
default:
failf(data, "tftp_tx: internal error, event: %i", (int)event);
failf(data, "tftp_tx: internal error, event: %d", (int)event);
break;
}

View file

@ -509,7 +509,6 @@ static CURLUcode hostname_check(struct Curl_URL *u, char *hostname,
*
* @unittest 1675
*/
UNITTEST int ipv4_normalize(struct dynbuf *host);
UNITTEST int ipv4_normalize(struct dynbuf *host)
{
@ -1040,7 +1039,7 @@ static CURLUcode handle_fragment(CURLU *u, const char *fragment,
CURLUcode ures;
u->fragment_present = TRUE;
if(fraglen > 1) {
/* skip the leading '#' in the copy but include the terminating null */
/* skip the leading '#' in the copy but include the null-terminator */
if(flags & CURLU_URLENCODE) {
struct dynbuf enc;
curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);

View file

@ -713,7 +713,7 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data,
failf(data, "Found host key type RSA1 which is not supported");
return CURLE_SSH;
default:
failf(data, "Unknown host key type: %i",
failf(data, "Unknown host key type: %d",
(store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK));
return CURLE_SSH;
}

View file

@ -208,7 +208,7 @@ CURLcode Curl_vtls_apple_verify(struct Curl_cfilter *cf,
status = SecTrustSetOCSPResponse(trust, ocspdata);
CFRelease(ocspdata);
if(status != noErr) {
failf(data, "Apple SecTrust: failed to set OCSP response: %i",
failf(data, "Apple SecTrust: failed to set OCSP response: %d",
(int)status);
result = CURLE_PEER_FAILED_VERIFICATION;
goto out;
@ -254,7 +254,7 @@ CURLcode Curl_vtls_apple_verify(struct Curl_cfilter *cf,
status = SecTrustEvaluate(trust, &sec_result);
if(status != noErr) {
failf(data, "Apple SecTrust verification failed: error %i", (int)status);
failf(data, "Apple SecTrust verification failed: error %d", (int)status);
result = CURLE_PEER_FAILED_VERIFICATION;
}
else if((sec_result == kSecTrustResultUnspecified) ||

View file

@ -2192,7 +2192,7 @@ static CURLcode ossl_verifyhost(struct Curl_easy *data,
if((cnlen <= 0) || !cn)
result = CURLE_OUT_OF_MEMORY;
else if((size_t)cnlen != strlen((char *)cn)) {
/* there was a terminating zero before the end of string, this
/* there was a null-terminator before the end of string, this
cannot match and we return failure! */
failf(data, "SSL: illegal cert name field");
result = CURLE_PEER_FAILED_VERIFICATION;