clang-tidy: add missing and delete redundant parentheses

Reported by clang-tidy v22.1.0.

Ref: https://releases.llvm.org/22.1.0/tools/clang/tools/extra/docs/ReleaseNotes.html

Closes #20749
This commit is contained in:
Viktor Szakats 2026-02-26 21:36:59 +01:00
parent 8d28ac612b
commit f76a54f890
No known key found for this signature in database
6 changed files with 12 additions and 11 deletions

View file

@ -219,7 +219,7 @@ void *curl_dbg_malloc(size_t wantedsize, int line, const char *source)
/* alloc at least 64 bytes */
size = sizeof(struct memdebug) + wantedsize;
mem = (Curl_cmalloc)(size);
mem = Curl_cmalloc(size);
if(mem) {
mem->size = wantedsize;
}
@ -249,7 +249,7 @@ void *curl_dbg_calloc(size_t wanted_elements, size_t wanted_size,
user_size = wanted_size * wanted_elements;
size = sizeof(struct memdebug) + user_size;
mem = (Curl_ccalloc)(1, size);
mem = Curl_ccalloc(1, size);
if(mem)
mem->size = user_size;
@ -344,7 +344,7 @@ void *curl_dbg_realloc(void *ptr, size_t wantedsize,
# pragma warning(pop)
#endif
mem = (Curl_crealloc)(mem, size);
mem = Curl_crealloc(mem, size);
if(source)
curl_dbg_log_locked("MEM %s:%d realloc(%p, %zu) = %p\n",
source, line, (void *)ptr, wantedsize,
@ -380,7 +380,7 @@ void curl_dbg_free(void *ptr, int line, const char *source)
#endif
/* free for real */
(Curl_cfree)(mem);
Curl_cfree(mem);
}
}

View file

@ -423,7 +423,7 @@ static curl_off_t encoder_base64_size(curl_mimepart *part)
return size; /* Unknown size or no data. */
/* Compute base64 character count. */
size = 4 * (1 + (size - 1) / 3);
size = 4 * (1 + ((size - 1) / 3));
/* Effective character count must include CRLFs. */
return size + (2 * ((size - 1) / MAX_ENCODED_LINE_LENGTH));

View file

@ -676,9 +676,10 @@ static bool out_double(void *userp,
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
/* !checksrc! disable BANNEDFUNC 1 */
/* !checksrc! disable LONGLINE */
/* NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling) */
(snprintf)(work, BUFFSIZE, formatbuf, dnum);
snprintf(work, BUFFSIZE, formatbuf, dnum);
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif

View file

@ -422,7 +422,7 @@ static int parsedate(const char *date, time_t *output)
(num_digits == 4) &&
(val <= 1400) &&
(indate < date) &&
((date[-1] == '+' || date[-1] == '-'))) {
(date[-1] == '+' || date[-1] == '-')) {
/* four digits and a value less than or equal to 1400 (to take into
account all sorts of funny time zone diffs) and it is preceded
with a plus or minus. This is a time zone indication. 1400 is
@ -432,7 +432,7 @@ static int parsedate(const char *date, time_t *output)
anyone has a more authoritative source for the exact maximum time
zone offsets, please speak up! */
found = TRUE;
tzoff = (val / 100 * 60 + val % 100) * 60;
tzoff = ((val / 100 * 60) + (val % 100)) * 60;
/* the + and - prefix indicates the local time compared to GMT,
this we need their reversed math to get what we want */

View file

@ -486,7 +486,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: %i", (int)event);
break;
}

View file

@ -870,8 +870,8 @@ CURLcode Curl_xfer_send_close(struct Curl_easy *data)
bool Curl_xfer_is_blocked(struct Curl_easy *data)
{
bool want_send = ((data)->req.keepon & KEEP_SEND);
bool want_recv = ((data)->req.keepon & KEEP_RECV);
bool want_send = (data->req.keepon & KEEP_SEND);
bool want_recv = (data->req.keepon & KEEP_RECV);
if(!want_send)
return want_recv && Curl_xfer_recv_is_paused(data);
else if(!want_recv)