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:
Viktor Szakats 2026-02-23 00:59:57 +01:00
parent 29bca12978
commit 65262be0ab
No known key found for this signature in database
40 changed files with 85 additions and 80 deletions

View File

@ -18,6 +18,7 @@ Checks:
- misc-header-include-cycle
- portability-*
- readability-duplicate-include
- readability-math-missing-parentheses
- readability-named-parameter
- readability-redundant-control-flow
- readability-redundant-preprocessor

View File

@ -340,8 +340,8 @@ static CURLcode on_resp_header(struct Curl_cfilter *cf,
ISDIGIT(header[9]) && ISDIGIT(header[10]) && ISDIGIT(header[11]) &&
!ISDIGIT(header[12])) {
/* store the HTTP code from the proxy */
data->info.httpproxycode = k->httpcode = (header[9] - '0') * 100 +
(header[10] - '0') * 10 + (header[11] - '0');
data->info.httpproxycode = k->httpcode = ((header[9] - '0') * 100) +
((header[10] - '0') * 10) + (header[11] - '0');
}
return result;
}

View File

@ -399,7 +399,7 @@ static void ascii_to_unicode_le(unsigned char *dest, const char *src,
size_t i;
for(i = 0; i < srclen; i++) {
dest[2 * i] = (unsigned char)src[i];
dest[2 * i + 1] = '\0';
dest[(2 * i) + 1] = '\0';
}
}
@ -492,7 +492,7 @@ static void ascii_uppercase_to_unicode_le(unsigned char *dest,
size_t i;
for(i = 0; i < srclen; i++) {
dest[2 * i] = (unsigned char)(Curl_raw_toupper(src[i]));
dest[2 * i + 1] = '\0';
dest[(2 * i) + 1] = '\0';
}
}

View File

@ -182,7 +182,7 @@ static CURLcode base64_encode(const char *table64,
if(insize > CURL_MAX_BASE64_INPUT)
return CURLE_TOO_LARGE;
base64data = output = curlx_malloc((insize + 2) / 3 * 4 + 1);
base64data = output = curlx_malloc(((insize + 2) / 3 * 4) + 1);
if(!output)
return CURLE_OUT_OF_MEMORY;

View File

@ -172,7 +172,7 @@ static int str_num_base(const char **linep, curl_off_t *nump, curl_off_t max,
/* special-case low max scenario because check needs to be different */
do {
int n = curlx_hexval(*p++);
num = num * base + n;
num = (num * base) + n;
if(num > max)
return STRE_OVERFLOW;
} while(valid_digit(*p, m));
@ -182,7 +182,7 @@ static int str_num_base(const char **linep, curl_off_t *nump, curl_off_t max,
int n = curlx_hexval(*p++);
if(num > ((max - n) / base))
return STRE_OVERFLOW;
num = num * base + n;
num = (num * base) + n;
} while(valid_digit(*p, m));
}
*nump = num;

View File

@ -191,7 +191,7 @@ timediff_t curlx_ptimediff_ms(const struct curltime *newer,
return TIMEDIFF_T_MAX;
else if(diff <= (TIMEDIFF_T_MIN / 1000))
return TIMEDIFF_T_MIN;
return diff * 1000 + (newer->tv_usec - older->tv_usec) / 1000;
return (diff * 1000) + ((newer->tv_usec - older->tv_usec) / 1000);
}
@ -212,7 +212,7 @@ timediff_t curlx_timediff_ceil_ms(struct curltime newer,
return TIMEDIFF_T_MAX;
else if(diff <= (TIMEDIFF_T_MIN / 1000))
return TIMEDIFF_T_MIN;
return diff * 1000 + (newer.tv_usec - older.tv_usec + 999) / 1000;
return (diff * 1000) + ((newer.tv_usec - older.tv_usec + 999) / 1000);
}
/*
@ -227,7 +227,7 @@ timediff_t curlx_ptimediff_us(const struct curltime *newer,
return TIMEDIFF_T_MAX;
else if(diff <= (TIMEDIFF_T_MIN / 1000000))
return TIMEDIFF_T_MIN;
return diff * 1000000 + newer->tv_usec - older->tv_usec;
return (diff * 1000000) + newer->tv_usec - older->tv_usec;
}
timediff_t curlx_timediff_us(struct curltime newer, struct curltime older)

View File

@ -63,7 +63,7 @@ char *curl_easy_escape(CURL *data, const char *string, int inlength)
if(length > SIZE_MAX / 16)
return NULL;
curlx_dyn_init(&d, length * 3 + 1);
curlx_dyn_init(&d, (length * 3) + 1);
while(length--) {
/* treat the characters unsigned */

View File

@ -2496,7 +2496,7 @@ static CURLcode ftp_state_port_resp(struct Curl_easy *data,
static int twodigit(const char *p)
{
return (p[0] - '0') * 10 + (p[1] - '0');
return ((p[0] - '0') * 10) + (p[1] - '0');
}
static bool ftp_213_date(const char *p, int *year, int *month, int *day,
@ -2505,7 +2505,7 @@ static bool ftp_213_date(const char *p, int *year, int *month, int *day,
size_t len = strlen(p);
if(len < 14)
return FALSE;
*year = twodigit(&p[0]) * 100 + twodigit(&p[2]);
*year = (twodigit(&p[0]) * 100) + twodigit(&p[2]);
*month = twodigit(&p[4]);
*day = twodigit(&p[6]);
*hour = twodigit(&p[8]);

View File

@ -52,7 +52,7 @@ struct HMAC_context *Curl_HMAC_init(const struct HMAC_params *hashparams,
unsigned char b;
/* Create HMAC context. */
i = sizeof(*ctxt) + 2 * hashparams->ctxtsize + hashparams->resultlen;
i = sizeof(*ctxt) + (2 * hashparams->ctxtsize) + hashparams->resultlen;
ctxt = curlx_malloc(i);
if(!ctxt)

View File

@ -4232,7 +4232,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
k->httpversion = (unsigned char)(10 + (p[1] - '0'));
p += 3;
if(ISDIGIT(p[0]) && ISDIGIT(p[1]) && ISDIGIT(p[2])) {
k->httpcode = (p[0] - '0') * 100 + (p[1] - '0') * 10 +
k->httpcode = ((p[0] - '0') * 100) + ((p[1] - '0') * 10) +
(p[2] - '0');
/* RFC 9112 requires a single space following the status code,
but the browsers do not so let's not insist */
@ -4252,7 +4252,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
k->httpversion = (unsigned char)((*p - '0') * 10);
p += 2;
if(ISDIGIT(p[0]) && ISDIGIT(p[1]) && ISDIGIT(p[2])) {
k->httpcode = (p[0] - '0') * 100 + (p[1] - '0') * 10 +
k->httpcode = ((p[0] - '0') * 100) + ((p[1] - '0') * 10) +
(p[2] - '0');
p += 3;
if(!ISBLANK(*p))

View File

@ -53,7 +53,7 @@
#define TIMESTAMP_SIZE 17
/* hex-encoded with trailing null */
#define SHA256_HEX_LENGTH (2 * CURL_SHA256_DIGEST_LENGTH + 1)
#define SHA256_HEX_LENGTH ((2 * CURL_SHA256_DIGEST_LENGTH) + 1)
#define MAX_QUERY_COMPONENTS 128
@ -745,8 +745,10 @@ UNITTEST CURLcode canon_query(const char *query, struct dynbuf *dq)
in_key_len = offset - in_key;
}
curlx_dyn_init(&encoded_query_array[index].key, query_part_len * 3 + 1);
curlx_dyn_init(&encoded_query_array[index].value, query_part_len * 3 + 1);
curlx_dyn_init(&encoded_query_array[index].key,
(query_part_len * 3) + 1);
curlx_dyn_init(&encoded_query_array[index].value,
(query_part_len * 3) + 1);
counted_query_components++;
/* Decode/encode the key */

View File

@ -218,12 +218,12 @@ typedef struct md4_ctx MD4_CTX;
#define MD4_SET(n) (*(const uint32_t *)(const void *)&ptr[(n) * 4])
#define MD4_GET(n) MD4_SET(n)
#else
#define MD4_SET(n) (ctx->block[(n)] = \
(uint32_t)ptr[(n) * 4] | \
((uint32_t)ptr[(n) * 4 + 1] << 8) | \
((uint32_t)ptr[(n) * 4 + 2] << 16) | \
((uint32_t)ptr[(n) * 4 + 3] << 24))
#define MD4_GET(n) (ctx->block[(n)])
#define MD4_SET(n) (ctx->block[n] = \
(uint32_t)ptr[(n) * 4] | \
((uint32_t)ptr[((n) * 4) + 1] << 8) | \
((uint32_t)ptr[((n) * 4) + 2] << 16) | \
((uint32_t)ptr[((n) * 4) + 3] << 24))
#define MD4_GET(n) ctx->block[n]
#endif
/*

View File

@ -299,12 +299,12 @@ typedef struct md5_ctx my_md5_ctx;
#define MD5_SET(n) (*(const uint32_t *)(const void *)&ptr[(n) * 4])
#define MD5_GET(n) MD5_SET(n)
#else
#define MD5_SET(n) (ctx->block[(n)] = \
(uint32_t)ptr[(n) * 4] | \
((uint32_t)ptr[(n) * 4 + 1] << 8) | \
((uint32_t)ptr[(n) * 4 + 2] << 16) | \
((uint32_t)ptr[(n) * 4 + 3] << 24))
#define MD5_GET(n) (ctx->block[(n)])
#define MD5_SET(n) (ctx->block[n] = \
(uint32_t)ptr[(n) * 4] | \
((uint32_t)ptr[((n) * 4) + 1] << 8) | \
((uint32_t)ptr[((n) * 4) + 2] << 16) | \
((uint32_t)ptr[((n) * 4) + 3] << 24))
#define MD5_GET(n) ctx->block[n]
#endif
/*

View File

@ -426,7 +426,7 @@ static curl_off_t encoder_base64_size(curl_mimepart *part)
size = 4 * (1 + (size - 1) / 3);
/* Effective character count must include CRLFs. */
return size + 2 * ((size - 1) / MAX_ENCODED_LINE_LENGTH);
return size + (2 * ((size - 1) / MAX_ENCODED_LINE_LENGTH));
}
/* Quoted-printable lookahead.

View File

@ -279,9 +279,10 @@ static time_t time2epoch(int sec, int min, int hour,
int leap_days = year - (mon <= 1);
leap_days = ((leap_days / 4) - (leap_days / 100) + (leap_days / 400)
- (1969 / 4) + (1969 / 100) - (1969 / 400));
return ((((time_t)(year - 1970) * 365
+ leap_days + month_days_cumulative[mon] + mday - 1) * 24
+ hour) * 60 + min) * 60 + sec;
return ((((((((time_t)(year - 1970) * 365)
+ leap_days + month_days_cumulative[mon] + mday - 1) * 24)
+ hour) * 60)
+ min) * 60) + sec;
}
/* Returns the value of a single-digit or two-digit decimal number, return
@ -292,7 +293,7 @@ static int oneortwodigit(const char *date, const char **endp)
int num = date[0] - '0';
if(ISDIGIT(date[1])) {
*endp = &date[2];
return num * 10 + (date[1] - '0');
return (num * 10) + (date[1] - '0');
}
*endp = &date[1];
return num;
@ -445,7 +446,7 @@ static int parsedate(const char *date, time_t *output)
/* 8 digits, no year, month or day yet. This is YYYYMMDD */
found = TRUE;
yearnum = val / 10000;
monnum = (val % 10000) / 100 - 1; /* month is 0 - 11 */
monnum = ((val % 10000) / 100) - 1; /* month is 0 - 11 */
mdaynum = val % 100;
}

View File

@ -557,7 +557,7 @@ static CURLcode pop3_perform_apop(struct Curl_easy *data,
size_t i;
struct MD5_context *ctxt;
unsigned char digest[MD5_DIGEST_LEN];
char secret[2 * MD5_DIGEST_LEN + 1];
char secret[(2 * MD5_DIGEST_LEN) + 1];
if(!pop3c)
return CURLE_FAILED_INIT;

View File

@ -548,7 +548,7 @@ static CURLcode smb_recv_message(struct Curl_easy *data,
if(nbt_size >= msg_size + 1) {
/* Add the word count */
msg_size += 1 + ((unsigned char)buf[msg_size]) * sizeof(unsigned short);
msg_size += 1 + (((unsigned char)buf[msg_size]) * sizeof(unsigned short));
if(nbt_size >= msg_size + sizeof(unsigned short)) {
/* Add the byte count */
msg_size += sizeof(unsigned short) +

View File

@ -1877,7 +1877,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
{
const char *newp;
struct dynbuf enc;
curlx_dyn_init(&enc, nalloc * 3 + 1 + leadingslash);
curlx_dyn_init(&enc, (nalloc * 3) + 1 + leadingslash);
if(leadingslash && (part[0] != '/')) {
CURLcode result = curlx_dyn_addn(&enc, "/", 1);

View File

@ -341,9 +341,9 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
struct MD5_context *ctxt;
char *response = NULL;
unsigned char digest[MD5_DIGEST_LEN];
char HA1_hex[2 * MD5_DIGEST_LEN + 1];
char HA2_hex[2 * MD5_DIGEST_LEN + 1];
char resp_hash_hex[2 * MD5_DIGEST_LEN + 1];
char HA1_hex[(2 * MD5_DIGEST_LEN) + 1];
char HA2_hex[(2 * MD5_DIGEST_LEN) + 1];
char resp_hash_hex[(2 * MD5_DIGEST_LEN) + 1];
char nonce[64];
char realm[128];
char algorithm[64];

View File

@ -398,7 +398,7 @@ static void unicodecpy(unsigned char *dest, const char *src, size_t length)
size_t i;
for(i = 0; i < length; i++) {
dest[2 * i] = (unsigned char)src[i];
dest[2 * i + 1] = '\0';
dest[(2 * i) + 1] = '\0';
}
}

View File

@ -391,8 +391,8 @@ static void pktx_update_time(struct Curl_easy *data,
const struct curltime *pnow = Curl_pgrs_now(data);
vquic_ctx_update_time(&ctx->q, pnow);
pktx->ts = (ngtcp2_tstamp)pnow->tv_sec * NGTCP2_SECONDS +
(ngtcp2_tstamp)pnow->tv_usec * NGTCP2_MICROSECONDS;
pktx->ts = ((ngtcp2_tstamp)pnow->tv_sec * NGTCP2_SECONDS) +
((ngtcp2_tstamp)pnow->tv_usec * NGTCP2_MICROSECONDS);
}
static void pktx_init(struct pkt_io_ctx *pktx,
@ -406,8 +406,8 @@ static void pktx_init(struct pkt_io_ctx *pktx,
pktx->data = data;
ngtcp2_path_storage_zero(&pktx->ps);
vquic_ctx_set_time(&ctx->q, pnow);
pktx->ts = (ngtcp2_tstamp)pnow->tv_sec * NGTCP2_SECONDS +
(ngtcp2_tstamp)pnow->tv_usec * NGTCP2_MICROSECONDS;
pktx->ts = ((ngtcp2_tstamp)pnow->tv_sec * NGTCP2_SECONDS) +
((ngtcp2_tstamp)pnow->tv_usec * NGTCP2_MICROSECONDS);
}
static int cb_h3_acked_req_body(nghttp3_conn *conn, int64_t stream_id,

View File

@ -107,8 +107,9 @@ bool Curl_tls_keylog_write(const char *label,
const unsigned char *secret, size_t secretlen)
{
size_t pos, i;
unsigned char line[KEYLOG_LABEL_MAXLEN + 1 + 2 * CLIENT_RANDOM_SIZE + 1 +
2 * SECRET_MAXLEN + 1 + 1];
unsigned char line[KEYLOG_LABEL_MAXLEN + 1 +
(2 * CLIENT_RANDOM_SIZE) + 1 +
(2 * SECRET_MAXLEN) + 1 + 1];
if(!keylog_file_fp) {
return FALSE;

View File

@ -173,8 +173,8 @@ static int mbedtls_bio_cf_read(void *bio, unsigned char *buf, size_t blen)
/* See:
* https://web.archive.org/web/20200921194007/tls.mbed.org/discussions/generic/howto-determine-exact-buffer-len-for-mbedtls_pk_write_pubkey_der
*/
#define RSA_PUB_DER_MAX_BYTES (38 + 2 * MBEDTLS_MPI_MAX_SIZE)
#define ECP_PUB_DER_MAX_BYTES (30 + 2 * MBEDTLS_ECP_MAX_BYTES)
#define RSA_PUB_DER_MAX_BYTES (38 + (2 * MBEDTLS_MPI_MAX_SIZE))
#define ECP_PUB_DER_MAX_BYTES (30 + (2 * MBEDTLS_ECP_MAX_BYTES))
#define PUB_DER_MAX_BYTES (RSA_PUB_DER_MAX_BYTES > ECP_PUB_DER_MAX_BYTES ? \
RSA_PUB_DER_MAX_BYTES : ECP_PUB_DER_MAX_BYTES)

View File

@ -983,7 +983,7 @@ static int do_pubkey(struct Curl_easy *data, int certnum, const char *algo,
if(!certnum)
infof(data, " ECC Public Key (%zu bits)", len);
if(data->set.ssl.certinfo) {
char q[sizeof(len) * 8 / 3 + 1];
char q[(sizeof(len) * 8 / 3) + 1];
(void)curl_msnprintf(q, sizeof(q), "%zu", len);
if(ssl_push_certinfo(data, certnum, "ECC Public Key", q))
return 1;
@ -1018,7 +1018,7 @@ static int do_pubkey(struct Curl_easy *data, int certnum, const char *algo,
if(!certnum)
infof(data, " RSA Public Key (%zu bits)", len);
if(data->set.ssl.certinfo) {
char r[sizeof(len) * 8 / 3 + 1];
char r[(sizeof(len) * 8 / 3) + 1];
curl_msnprintf(r, sizeof(r), "%zu", len);
if(ssl_push_certinfo(data, certnum, "RSA Public Key", r))
return 1;

View File

@ -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);

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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. */

View File

@ -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

View File

@ -147,7 +147,7 @@ static void memory_tracking_init(void)
/* returns a hexdump in a static memory area */
char *hexdump(const unsigned char *buf, size_t len)
{
static char dump[200 * 3 + 1];
static char dump[(200 * 3) + 1];
char *p = dump;
size_t i;
if(len > 200)

View File

@ -217,7 +217,7 @@ static ssize_t t530_getMicroSecondTimeout(struct curltime *timeout)
struct curltime now;
ssize_t result;
now = curlx_now();
result = (ssize_t)((timeout->tv_sec - now.tv_sec) * 1000000 +
result = (ssize_t)(((timeout->tv_sec - now.tv_sec) * 1000000) +
timeout->tv_usec - now.tv_usec);
if(result < 0)
result = 0;

View File

@ -164,7 +164,7 @@ static ssize_t t582_getMicroSecondTimeout(struct curltime *timeout)
struct curltime now;
ssize_t result;
now = curlx_now();
result = (ssize_t)((timeout->tv_sec - now.tv_sec) * 1000000 +
result = (ssize_t)(((timeout->tv_sec - now.tv_sec) * 1000000) +
timeout->tv_usec - now.tv_usec);
if(result < 0)
result = 0;

View File

@ -98,7 +98,7 @@ static CURLcode test_lib597(const char *URL)
interval.tv_usec = (itimeout % 1000) * 1000;
}
else {
interval.tv_sec = TEST_HANG_TIMEOUT / 1000 - 1;
interval.tv_sec = (TEST_HANG_TIMEOUT / 1000) - 1;
interval.tv_usec = 0;
}

View File

@ -40,7 +40,7 @@ static CURLcode test_lib666(const char *URL)
if(i % 77 == 76)
testbuf[i] = '\n';
else
testbuf[i] = (char)(0x41 + i % 26); /* A...Z */
testbuf[i] = (char)(0x41 + (i % 26)); /* A...Z */
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");

View File

@ -263,7 +263,7 @@ static ssize_t t758_getMicroSecondTimeout(struct curltime *timeout)
struct curltime now;
ssize_t result;
now = curlx_now();
result = (ssize_t)((timeout->tv_sec - now.tv_sec) * 1000000 +
result = (ssize_t)(((timeout->tv_sec - now.tv_sec) * 1000000) +
timeout->tv_usec - now.tv_usec);
if(result < 0)
result = 0;

View File

@ -180,7 +180,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
return 1;
}
req->prot_version = prot_major * 10 + prot_minor;
req->prot_version = (prot_major * 10) + prot_minor;
/* find the last slash */
ptr = strrchr(doc, '/');

View File

@ -293,8 +293,8 @@ static curl_socket_t socks4(curl_socket_t fd,
static curl_socket_t sockit(curl_socket_t fd)
{
unsigned char buffer[2 * 256 + 16];
unsigned char response[2 * 256 + 16];
unsigned char buffer[(2 * 256) + 16];
unsigned char response[(2 * 256) + 16];
ssize_t rc;
unsigned char len;
unsigned char type;

View File

@ -386,7 +386,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
if(fine) {
const char *ptr;
req->prot_version = prot_major * 10 + prot_minor;
req->prot_version = (prot_major * 10) + prot_minor;
/* find the last slash */
ptr = &httppath[npath];

View File

@ -109,9 +109,9 @@ static CURLcode test_unit1309(const char *arg)
/* add some nodes with the same key */
for(j = 0; j <= i % 3; j++) {
storage[i * 3 + j] = key.tv_usec * 10 + j;
Curl_splayset(&nodes[i * 3 + j], &storage[i * 3 + j]);
root = Curl_splayinsert(&key, root, &nodes[i * 3 + j]);
storage[(i * 3) + j] = (key.tv_usec * 10) + j;
Curl_splayset(&nodes[(i * 3) + j], &storage[(i * 3) + j]);
root = Curl_splayinsert(&key, root, &nodes[(i * 3) + j]);
}
}