mirror of
https://github.com/curl/curl.git
synced 2026-08-24 14:23:30 +03:00
clang-tidy: enable readability-math-missing-parentheses, adjust code
No functional changes. Also: - md4, md5: drop redundant parentheses from macro values. Closes #20691
This commit is contained in:
parent
29bca12978
commit
65262be0ab
40 changed files with 85 additions and 80 deletions
|
|
@ -78,13 +78,13 @@ static void fly(struct ProgressData *bar, bool moved)
|
|||
|
||||
memcpy(&buf[bar->bar + 1], "-=O=-", 5);
|
||||
|
||||
pos = sinus[bar->tick % 200] / (1000000 / check) + 1;
|
||||
pos = (sinus[bar->tick % 200] / (1000000 / check)) + 1;
|
||||
buf[pos] = '#';
|
||||
pos = sinus[(bar->tick + 5) % 200] / (1000000 / check) + 1;
|
||||
pos = (sinus[(bar->tick + 5) % 200] / (1000000 / check)) + 1;
|
||||
buf[pos] = '#';
|
||||
pos = sinus[(bar->tick + 10) % 200] / (1000000 / check) + 1;
|
||||
pos = (sinus[(bar->tick + 10) % 200] / (1000000 / check)) + 1;
|
||||
buf[pos] = '#';
|
||||
pos = sinus[(bar->tick + 15) % 200] / (1000000 / check) + 1;
|
||||
pos = (sinus[(bar->tick + 15) % 200] / (1000000 / check)) + 1;
|
||||
buf[pos] = '#';
|
||||
|
||||
fputs(buf, bar->out);
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ UNITTEST ParameterError GetSizeParameter(const char *arg, curl_off_t *out)
|
|||
if(value > ((CURL_OFF_T_MAX - add) / mul))
|
||||
return PARAM_NUMBER_TOO_LARGE;
|
||||
|
||||
*out = value * mul + add;
|
||||
*out = (value * mul) + add;
|
||||
return PARAM_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1788,7 +1788,7 @@ static CURLcode check_finished(struct parastate *s)
|
|||
if(retry) {
|
||||
ended->added = FALSE; /* add it again */
|
||||
/* we delay retries in full integer seconds only */
|
||||
ended->startat = delay ? time(NULL) + delay / 1000 : 0;
|
||||
ended->startat = delay ? time(NULL) + (delay / 1000) : 0;
|
||||
}
|
||||
else {
|
||||
/* result receives this transfer's error unless the transfer was
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ ParameterError secs2ms(long *valp, const char *str)
|
|||
ms = ((long)fracs * 100) / digs[len - 1];
|
||||
}
|
||||
|
||||
*valp = (long)secs * 1000 + ms;
|
||||
*valp = ((long)secs * 1000) + ms;
|
||||
return PARAM_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ static char *c_escape(const char *str, curl_off_t len)
|
|||
CURLcode result;
|
||||
struct dynbuf escaped;
|
||||
|
||||
curlx_dyn_init(&escaped, 4 * MAX_STRING_LENGTH_OUTPUT + 3);
|
||||
curlx_dyn_init(&escaped, (4 * MAX_STRING_LENGTH_OUTPUT) + 3);
|
||||
|
||||
if(len == ZERO_TERMINATED)
|
||||
len = strlen(str);
|
||||
|
|
@ -211,7 +211,7 @@ static char *c_escape(const char *str, curl_off_t len)
|
|||
|
||||
if(!result) {
|
||||
if(p && *p)
|
||||
result = curlx_dyn_addn(&escaped, to + 2 * (p - from), 2);
|
||||
result = curlx_dyn_addn(&escaped, to + (2 * (p - from)), 2);
|
||||
else {
|
||||
result = curlx_dyn_addf(&escaped,
|
||||
/* Octal escape to avoid >2 digit hex. */
|
||||
|
|
|
|||
|
|
@ -272,8 +272,8 @@ static CURLcode glob_range(struct URLGlob *glob, const char **patternp,
|
|||
pat->c.ascii.letter = pat->c.ascii.min = min_c;
|
||||
pat->c.ascii.max = max_c;
|
||||
|
||||
if(multiply(amount, ((pat->c.ascii.max - pat->c.ascii.min) /
|
||||
pat->c.ascii.step + 1)))
|
||||
if(multiply(amount, (((pat->c.ascii.max - pat->c.ascii.min) /
|
||||
pat->c.ascii.step) + 1)))
|
||||
return globerror(glob, "range overflow", *posp, CURLE_URL_MALFORMAT);
|
||||
}
|
||||
else if(ISDIGIT(*pattern)) {
|
||||
|
|
@ -328,8 +328,8 @@ static CURLcode glob_range(struct URLGlob *glob, const char **patternp,
|
|||
pat->c.num.max = max_n;
|
||||
pat->c.num.step = step_n;
|
||||
|
||||
if(multiply(amount, ((pat->c.num.max - pat->c.num.min) /
|
||||
pat->c.num.step + 1)))
|
||||
if(multiply(amount, (((pat->c.num.max - pat->c.num.min) /
|
||||
pat->c.num.step) + 1)))
|
||||
return globerror(glob, "range overflow", *posp, CURLE_URL_MALFORMAT);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue