Skip to content
Permalink
Browse files

build: fix "clarify calculation precedence" warnings

Codacy/CppCheck warns about this. Consistently use parentheses as we
already do in some places to silence the warning.

Closes #3866
  • Loading branch information...
MarcelRaad committed May 11, 2019
1 parent 5f8b9fe commit 6b3dde7fe62ea5a557fd1fd323fac2bcd0c2e9be
Showing with 15 additions and 13 deletions.
  1. +2 −2 lib/asyn-ares.c
  2. +2 −2 lib/easy.c
  3. +1 −1 lib/formdata.c
  4. +4 −2 lib/mime.c
  5. +2 −2 lib/multi.c
  6. +2 −2 lib/progress.c
  7. +2 −2 tests/libtest/lib1156.c
@@ -331,9 +331,9 @@ static int waitperform(struct connectdata *conn, int timeout_ms)
/* move through the descriptors and ask for processing on them */
for(i = 0; i < num; i++)
ares_process_fd((ares_channel)data->state.resolver,
pfd[i].revents & (POLLRDNORM|POLLIN)?
(pfd[i].revents & (POLLRDNORM|POLLIN))?
pfd[i].fd:ARES_SOCKET_BAD,
pfd[i].revents & (POLLWRNORM|POLLOUT)?
(pfd[i].revents & (POLLWRNORM|POLLOUT))?
pfd[i].fd:ARES_SOCKET_BAD);
}
return nfds;
@@ -451,8 +451,8 @@ static int events_socket(struct Curl_easy *easy, /* easy handle */
m->socket.revents = 0;
ev->list = m;
infof(easy, "socket cb: socket %d ADDED as %s%s\n", s,
what&CURL_POLL_IN?"IN":"",
what&CURL_POLL_OUT?"OUT":"");
(what&CURL_POLL_IN)?"IN":"",
(what&CURL_POLL_OUT)?"OUT":"");
}
else
return CURLE_OUT_OF_MEMORY;
@@ -569,7 +569,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if(((form->flags & HTTPPOST_FILENAME) ||
(form->flags & HTTPPOST_BUFFER)) &&
!form->contenttype) {
char *f = form->flags & HTTPPOST_BUFFER?
char *f = (form->flags & HTTPPOST_BUFFER)?
form->showfilename : form->value;
char const *type;
type = Curl_mime_contenttype(f);
@@ -821,8 +821,10 @@ static size_t readback_part(curl_mimepart *part,
struct curl_slist *hdr = (struct curl_slist *) part->state.ptr;
switch(part->state.state) {
case MIMESTATE_BEGIN:
mimesetstate(&part->state, part->flags & MIME_BODY_ONLY? MIMESTATE_BODY:
MIMESTATE_CURLHEADERS, part->curlheaders);
mimesetstate(&part->state,
(part->flags & MIME_BODY_ONLY)?
MIMESTATE_BODY: MIMESTATE_CURLHEADERS,
part->curlheaders);
break;
case MIMESTATE_USERHEADERS:
if(!hdr) {
@@ -3056,8 +3056,8 @@ void Curl_multi_dump(struct Curl_multi *multi)
continue;
}
fprintf(stderr, "[%s %s] ",
entry->action&CURL_POLL_IN?"RECVING":"",
entry->action&CURL_POLL_OUT?"SENDING":"");
(entry->action&CURL_POLL_IN)?"RECVING":"",
(entry->action&CURL_POLL_OUT)?"SENDING":"");
}
if(data->numsocks)
fprintf(stderr, "\n");
@@ -564,9 +564,9 @@ int Curl_pgrsUpdate(struct connectdata *conn)

/* Get the total amount of data expected to get transferred */
total_expected_transfer =
(data->progress.flags & PGRS_UL_SIZE_KNOWN?
((data->progress.flags & PGRS_UL_SIZE_KNOWN)?
data->progress.size_ul:data->progress.uploaded)+
(data->progress.flags & PGRS_DL_SIZE_KNOWN?
((data->progress.flags & PGRS_DL_SIZE_KNOWN)?
data->progress.size_dl:data->progress.downloaded);

/* We have transferred this much so far */
@@ -88,15 +88,15 @@ static int onetest(CURL *curl, const char *url, const testparams *p)
unsigned int replyselector;
char urlbuf[256];

replyselector = p->flags & F_CONTENTRANGE? 1: 0;
replyselector = (p->flags & F_CONTENTRANGE)? 1: 0;
if(p->flags & F_HTTP416)
replyselector += 2;
msnprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
test_setopt(curl, CURLOPT_URL, urlbuf);
test_setopt(curl, CURLOPT_RESUME_FROM, (p->flags & F_RESUME)? 3: 0);
test_setopt(curl, CURLOPT_RANGE, !(p->flags & F_RESUME)?
"3-1000000": (char *) NULL);
test_setopt(curl, CURLOPT_FAILONERROR, p->flags & F_FAIL? 1: 0);
test_setopt(curl, CURLOPT_FAILONERROR, (p->flags & F_FAIL)? 1: 0);
hasbody = 0;
res = curl_easy_perform(curl);
if(res != p->result) {

0 comments on commit 6b3dde7

Please sign in to comment.
You can’t perform that action at this time.