fix bool variables checking and assignment

This commit is contained in:
Yang Tse 2011-09-05 20:46:09 +02:00
parent eb44ac0138
commit a50210710a
23 changed files with 128 additions and 129 deletions

View File

@ -126,7 +126,7 @@ static bool tailmatch(const char *little, const char *bigone)
if(littlelen > biglen) if(littlelen > biglen)
return FALSE; return FALSE;
return (bool)Curl_raw_equal(little, bigone+biglen-littlelen); return Curl_raw_equal(little, bigone+biglen-littlelen) ? TRUE : FALSE;
} }
/* /*
@ -241,7 +241,7 @@ Curl_cookie_add(struct SessionHandle *data,
endofn++; endofn++;
/* name ends with a '=' ? */ /* name ends with a '=' ? */
sep = *endofn == '='?TRUE:FALSE; sep = (*endofn == '=')?TRUE:FALSE;
/* Strip off trailing whitespace from the 'what' */ /* Strip off trailing whitespace from the 'what' */
while(len && ISBLANK(what[len-1])) { while(len && ISBLANK(what[len-1])) {
@ -527,7 +527,7 @@ Curl_cookie_add(struct SessionHandle *data,
As far as I can see, it is set to true when the cookie says As far as I can see, it is set to true when the cookie says
.domain.com and to false when the domain is complete www.domain.com .domain.com and to false when the domain is complete www.domain.com
*/ */
co->tailmatch=(bool)Curl_raw_equal(ptr, "TRUE"); co->tailmatch = Curl_raw_equal(ptr, "TRUE")?TRUE:FALSE;
break; break;
case 2: case 2:
/* It turns out, that sometimes the file format allows the path /* It turns out, that sometimes the file format allows the path
@ -547,7 +547,7 @@ Curl_cookie_add(struct SessionHandle *data,
fields++; /* add a field and fall down to secure */ fields++; /* add a field and fall down to secure */
/* FALLTHROUGH */ /* FALLTHROUGH */
case 3: case 3:
co->secure = (bool)Curl_raw_equal(ptr, "TRUE"); co->secure = Curl_raw_equal(ptr, "TRUE")?TRUE:FALSE;
break; break;
case 4: case 4:
co->expires = curlx_strtoofft(ptr, NULL, 10); co->expires = curlx_strtoofft(ptr, NULL, 10);

View File

@ -413,7 +413,7 @@ int Curl_cyassl_init(void)
bool Curl_cyassl_data_pending(const struct connectdata* conn, int connindex) bool Curl_cyassl_data_pending(const struct connectdata* conn, int connindex)
{ {
if(conn->ssl[connindex].handle) /* SSL is in use */ if(conn->ssl[connindex].handle) /* SSL is in use */
return (bool)(0 != SSL_pending(conn->ssl[connindex].handle)); return (0 != SSL_pending(conn->ssl[connindex].handle)) ? TRUE : FALSE;
else else
return FALSE; return FALSE;
} }

View File

@ -1273,7 +1273,7 @@ static size_t readfromfile(struct Form *form, char *buffer,
size_t size) size_t size)
{ {
size_t nread; size_t nread;
bool callback = (bool)(form->data->type == FORM_CALLBACK); bool callback = (form->data->type == FORM_CALLBACK)?TRUE:FALSE;
if(callback) { if(callback) {
if(form->fread_func == ZERO_NULL) if(form->fread_func == ZERO_NULL)

View File

@ -298,8 +298,8 @@ static void freedirs(struct ftp_conn *ftpc)
*/ */
static bool isBadFtpString(const char *string) static bool isBadFtpString(const char *string)
{ {
return (bool)((NULL != strchr(string, '\r')) || return ((NULL != strchr(string, '\r')) ||
(NULL != strchr(string, '\n'))); (NULL != strchr(string, '\n'))) ? TRUE : FALSE;
} }
/*********************************************************************** /***********************************************************************
@ -2530,7 +2530,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
if(ftpcode/100 == 2) if(ftpcode/100 == 2)
/* We have enabled SSL for the data connection! */ /* We have enabled SSL for the data connection! */
conn->ssl[SECONDARYSOCKET].use = conn->ssl[SECONDARYSOCKET].use =
(bool)(data->set.ftp_ssl != CURLUSESSL_CONTROL); (data->set.ftp_ssl != CURLUSESSL_CONTROL) ? TRUE : FALSE;
/* FTP servers typically responds with 500 if they decide to reject /* FTP servers typically responds with 500 if they decide to reject
our 'P' request */ our 'P' request */
else if(data->set.ftp_ssl > CURLUSESSL_CONTROL) else if(data->set.ftp_ssl > CURLUSESSL_CONTROL)
@ -2841,7 +2841,7 @@ static CURLcode ftp_multi_statemach(struct connectdata *conn,
/* Check for the state outside of the Curl_socket_ready() return code checks /* Check for the state outside of the Curl_socket_ready() return code checks
since at times we are in fact already in this state when this function since at times we are in fact already in this state when this function
gets called. */ gets called. */
*done = (bool)(ftpc->state == FTP_STOP); *done = (ftpc->state == FTP_STOP) ? TRUE : FALSE;
return result; return result;
} }
@ -2895,9 +2895,9 @@ static CURLcode ftp_init(struct connectdata *conn)
*/ */
ftp->user = conn->user; ftp->user = conn->user;
ftp->passwd = conn->passwd; ftp->passwd = conn->passwd;
if(TRUE == isBadFtpString(ftp->user)) if(isBadFtpString(ftp->user))
return CURLE_URL_MALFORMAT; return CURLE_URL_MALFORMAT;
if(TRUE == isBadFtpString(ftp->passwd)) if(isBadFtpString(ftp->passwd))
return CURLE_URL_MALFORMAT; return CURLE_URL_MALFORMAT;
conn->proto.ftpc.known_filesize = -1; /* unknown size for now */ conn->proto.ftpc.known_filesize = -1; /* unknown size for now */

View File

@ -588,7 +588,7 @@ output_auth_headers(struct connectdata *conn,
proxy?"Proxy":"Server", auth, proxy?"Proxy":"Server", auth,
proxy?(conn->proxyuser?conn->proxyuser:""): proxy?(conn->proxyuser?conn->proxyuser:""):
(conn->user?conn->user:"")); (conn->user?conn->user:""));
authstatus->multi = (bool)(!authstatus->done); authstatus->multi = (!authstatus->done) ? TRUE : FALSE;
} }
else else
authstatus->multi = FALSE; authstatus->multi = FALSE;
@ -745,7 +745,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
} }
else { else {
neg = Curl_input_negotiate(conn, (bool)(httpcode == 407), start); neg = Curl_input_negotiate(conn, (httpcode == 407)?TRUE:FALSE, start);
if(neg == 0) { if(neg == 0) {
DEBUGASSERT(!data->req.newurl); DEBUGASSERT(!data->req.newurl);
data->req.newurl = strdup(data->change.url); data->req.newurl = strdup(data->change.url);
@ -771,7 +771,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
authp->picked == CURLAUTH_NTLM_WB) { authp->picked == CURLAUTH_NTLM_WB) {
/* NTLM authentication is picked and activated */ /* NTLM authentication is picked and activated */
CURLcode ntlm = CURLcode ntlm =
Curl_input_ntlm(conn, (bool)(httpcode == 407), start); Curl_input_ntlm(conn, (httpcode == 407)?TRUE:FALSE, start);
if(CURLE_OK == ntlm) { if(CURLE_OK == ntlm) {
data->state.authproblem = FALSE; data->state.authproblem = FALSE;
#ifdef NTLM_WB_ENABLED #ifdef NTLM_WB_ENABLED
@ -817,7 +817,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
/* We call this function on input Digest headers even if Digest /* We call this function on input Digest headers even if Digest
* authentication isn't activated yet, as we need to store the * authentication isn't activated yet, as we need to store the
* incoming data from this header in case we are gonna use Digest. */ * incoming data from this header in case we are gonna use Digest. */
dig = Curl_input_digest(conn, (bool)(httpcode == 407), start); dig = Curl_input_digest(conn, (httpcode == 407)?TRUE:FALSE, start);
if(CURLDIGEST_FINE != dig) { if(CURLDIGEST_FINE != dig) {
infof(data, "Authentication problem. Ignoring this.\n"); infof(data, "Authentication problem. Ignoring this.\n");
@ -946,7 +946,7 @@ static size_t readmoredata(char *buffer,
return 0; return 0;
/* make sure that a HTTP request is never sent away chunked! */ /* make sure that a HTTP request is never sent away chunked! */
conn->data->req.forbidchunk = (bool)(http->sending == HTTPSEND_REQUEST); conn->data->req.forbidchunk = (http->sending == HTTPSEND_REQUEST)?TRUE:FALSE;
if(http->postsize <= (curl_off_t)fullsize) { if(http->postsize <= (curl_off_t)fullsize) {
memcpy(buffer, http->postdata, (size_t)http->postsize); memcpy(buffer, http->postdata, (size_t)http->postsize);
@ -1479,11 +1479,11 @@ CURLcode Curl_http_done(struct connectdata *conn,
static bool use_http_1_1(const struct SessionHandle *data, static bool use_http_1_1(const struct SessionHandle *data,
const struct connectdata *conn) const struct connectdata *conn)
{ {
return (bool)((data->set.httpversion == CURL_HTTP_VERSION_1_1) || return ((data->set.httpversion == CURL_HTTP_VERSION_1_1) ||
((data->set.httpversion != CURL_HTTP_VERSION_1_0) && ((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
((conn->httpversion == 11) || ((conn->httpversion == 11) ||
((conn->httpversion != 10) && ((conn->httpversion != 10) &&
(data->state.httpversion != 10))))); (data->state.httpversion != 10))))) ? TRUE : FALSE;
} }
/* check and possibly add an Expect: header */ /* check and possibly add an Expect: header */
@ -2154,8 +2154,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
conn->allocptr.cookiehost? conn->allocptr.cookiehost?
conn->allocptr.cookiehost:host, conn->allocptr.cookiehost:host,
data->state.path, data->state.path,
(bool)(conn->handler->protocol&CURLPROTO_HTTPS? (conn->handler->protocol&CURLPROTO_HTTPS)?
TRUE:FALSE)); TRUE:FALSE);
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
} }
if(co) { if(co) {
@ -2582,7 +2582,7 @@ checkhttpprefix(struct SessionHandle *data,
head = head->next; head = head->next;
} }
if((rc != TRUE) && (checkprefix("HTTP/", s))) if(!rc && (checkprefix("HTTP/", s)))
rc = TRUE; rc = TRUE;
#ifdef CURL_DOES_CONVERSIONS #ifdef CURL_DOES_CONVERSIONS

View File

@ -79,9 +79,9 @@
We avoid the use of isxdigit to accommodate non-ASCII hosts. */ We avoid the use of isxdigit to accommodate non-ASCII hosts. */
static bool Curl_isxdigit(char digit) static bool Curl_isxdigit(char digit)
{ {
return (bool)( (digit >= 0x30 && digit <= 0x39) /* 0-9 */ return ( (digit >= 0x30 && digit <= 0x39) /* 0-9 */
|| (digit >= 0x41 && digit <= 0x46) /* A-F */ || (digit >= 0x41 && digit <= 0x46) /* A-F */
|| (digit >= 0x61 && digit <= 0x66) ); /* a-f */ || (digit >= 0x61 && digit <= 0x66) /* a-f */ ) ? TRUE : FALSE;
} }
void Curl_httpchunk_init(struct connectdata *conn) void Curl_httpchunk_init(struct connectdata *conn)

View File

@ -630,7 +630,7 @@ static CURLcode imap_multi_statemach(struct connectdata *conn,
else else
result = Curl_pp_multi_statemach(&imapc->pp); result = Curl_pp_multi_statemach(&imapc->pp);
*done = (bool)(imapc->state == IMAP_STOP); *done = (imapc->state == IMAP_STOP) ? TRUE : FALSE;
return result; return result;
} }

View File

@ -628,9 +628,10 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
easy = data->multi_pos; easy = data->multi_pos;
if(easy) { if(easy) {
bool premature = (bool)(easy->state < CURLM_STATE_COMPLETED); bool premature = (easy->state < CURLM_STATE_COMPLETED) ? TRUE : FALSE;
bool easy_owns_conn = (bool)(easy->easy_conn && bool easy_owns_conn = (easy->easy_conn &&
(easy->easy_conn->data == easy->easy_handle)); (easy->easy_conn->data == easy->easy_handle)) ?
TRUE : FALSE;
/* If the 'state' is not INIT or COMPLETED, we might need to do something /* If the 'state' is not INIT or COMPLETED, we might need to do something
nice to put the easy_handle in a good known state when this returns. */ nice to put the easy_handle in a good known state when this returns. */
@ -1282,7 +1283,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
disconnect_conn = TRUE; disconnect_conn = TRUE;
} }
else else
retry = (bool)(newurl?TRUE:FALSE); retry = (newurl)?TRUE:FALSE;
Curl_posttransfer(data); Curl_posttransfer(data);
drc = Curl_done(&easy->easy_conn, easy->result, FALSE); drc = Curl_done(&easy->easy_conn, easy->result, FALSE);
@ -1481,14 +1482,14 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
Curl_posttransfer(data); Curl_posttransfer(data);
Curl_done(&easy->easy_conn, easy->result, FALSE); Curl_done(&easy->easy_conn, easy->result, FALSE);
} }
else if(TRUE == done) { else if(done) {
char *newurl = NULL; char *newurl = NULL;
bool retry = FALSE; bool retry = FALSE;
followtype follow=FOLLOW_NONE; followtype follow=FOLLOW_NONE;
easy->result = Curl_retry_request(easy->easy_conn, &newurl); easy->result = Curl_retry_request(easy->easy_conn, &newurl);
if(!easy->result) if(!easy->result)
retry = (bool)(newurl?TRUE:FALSE); retry = (newurl)?TRUE:FALSE;
/* call this even if the readwrite function returned error */ /* call this even if the readwrite function returned error */
Curl_posttransfer(data); Curl_posttransfer(data);
@ -2213,7 +2214,7 @@ CURLMcode curl_multi_setopt(CURLM *multi_handle,
multi->socket_userp = va_arg(param, void *); multi->socket_userp = va_arg(param, void *);
break; break;
case CURLMOPT_PIPELINING: case CURLMOPT_PIPELINING:
multi->pipelining_enabled = (bool)(0 != va_arg(param, long)); multi->pipelining_enabled = (0 != va_arg(param, long)) ? TRUE : FALSE;
break; break;
case CURLMOPT_TIMERFUNCTION: case CURLMOPT_TIMERFUNCTION:
multi->timer_cb = va_arg(param, curl_multi_timer_callback); multi->timer_cb = va_arg(param, curl_multi_timer_callback);
@ -2478,7 +2479,7 @@ static bool isHandleAtHead(struct SessionHandle *handle,
{ {
struct curl_llist_element *curr = pipeline->head; struct curl_llist_element *curr = pipeline->head;
if(curr) if(curr)
return (bool)(curr->ptr == handle); return (curr->ptr == handle) ? TRUE : FALSE;
return FALSE; return FALSE;
} }

View File

@ -62,7 +62,7 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
/* most recent unix versions */ /* most recent unix versions */
int flags; int flags;
flags = fcntl(sockfd, F_GETFL, 0); flags = fcntl(sockfd, F_GETFL, 0);
if(FALSE != nonblock) if(nonblock)
return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
else else
return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
@ -70,26 +70,25 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
#elif defined(HAVE_IOCTL_FIONBIO) #elif defined(HAVE_IOCTL_FIONBIO)
/* older unix versions */ /* older unix versions */
int flags; int flags = nonblock ? 1 : 0;
flags = nonblock;
return ioctl(sockfd, FIONBIO, &flags); return ioctl(sockfd, FIONBIO, &flags);
#elif defined(HAVE_IOCTLSOCKET_FIONBIO) #elif defined(HAVE_IOCTLSOCKET_FIONBIO)
/* Windows */ /* Windows */
unsigned long flags; unsigned long flags = nonblock ? 1UL : 0UL;
flags = nonblock;
return ioctlsocket(sockfd, FIONBIO, &flags); return ioctlsocket(sockfd, FIONBIO, &flags);
#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO) #elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
/* Amiga */ /* Amiga */
return IoctlSocket(sockfd, FIONBIO, (long)nonblock); long flags = nonblock ? 1L : 0L;
return IoctlSocket(sockfd, FIONBIO, flags);
#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK) #elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
/* BeOS */ /* BeOS */
long b = nonblock ? 1 : 0; long b = nonblock ? 1L : 0L;
return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
#else #else

View File

@ -570,7 +570,7 @@ static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done)
struct pop3_conn *pop3c = &conn->proto.pop3c; struct pop3_conn *pop3c = &conn->proto.pop3c;
CURLcode result = Curl_pp_multi_statemach(&pop3c->pp); CURLcode result = Curl_pp_multi_statemach(&pop3c->pp);
*done = (bool)(pop3c->state == POP3_STOP); *done = (pop3c->state == POP3_STOP) ? TRUE : FALSE;
return result; return result;
} }

View File

@ -73,7 +73,7 @@ static size_t convert_lineends(struct SessionHandle *data,
return(size); return(size);
} }
if(data->state.prev_block_had_trailing_cr == TRUE) { if(data->state.prev_block_had_trailing_cr) {
/* The previous block of incoming data /* The previous block of incoming data
had a trailing CR, which was turned into a LF. */ had a trailing CR, which was turned into a LF. */
if(*startPtr == '\n') { if(*startPtr == '\n') {
@ -536,8 +536,8 @@ CURLcode Curl_read(struct connectdata *conn, /* connection data */
ssize_t nread = 0; ssize_t nread = 0;
size_t bytesfromsocket = 0; size_t bytesfromsocket = 0;
char *buffertofill = NULL; char *buffertofill = NULL;
bool pipelining = (bool)(conn->data->multi && bool pipelining = (conn->data->multi &&
Curl_multi_canPipeline(conn->data->multi)); Curl_multi_canPipeline(conn->data->multi)) ? TRUE : FALSE;
/* Set 'num' to 0 or 1, depending on which socket that has been sent here. /* Set 'num' to 0 or 1, depending on which socket that has been sent here.
If it is the second socket, we set num to 1. Otherwise to 0. This lets If it is the second socket, we set num to 1. Otherwise to 0. This lets

View File

@ -1032,7 +1032,7 @@ static CURLcode smtp_multi_statemach(struct connectdata *conn,
else else
result = Curl_pp_multi_statemach(&smtpc->pp); result = Curl_pp_multi_statemach(&smtpc->pp);
*done = (bool)(smtpc->state == SMTP_STOP); *done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE;
return result; return result;
} }

View File

@ -368,7 +368,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
curl_socket_t sock = conn->sock[sockindex]; curl_socket_t sock = conn->sock[sockindex];
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
long timeout; long timeout;
bool socks5_resolve_local = (bool)(conn->proxytype == CURLPROXY_SOCKS5); bool socks5_resolve_local = (conn->proxytype == CURLPROXY_SOCKS5)?TRUE:FALSE;
const size_t hostname_len = strlen(hostname); const size_t hostname_len = strlen(hostname);
ssize_t packetsize = 0; ssize_t packetsize = 0;

View File

@ -2500,7 +2500,7 @@ static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done)
implementation */ implementation */
result = ssh_statemach_act(conn, &block); result = ssh_statemach_act(conn, &block);
*done = (bool)(sshc->state == SSH_STOP); *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
ssh_block2waitfor(conn, block); ssh_block2waitfor(conn, block);
return result; return result;

View File

@ -69,10 +69,10 @@ static bool safe_strequal(char* str1, char* str2)
{ {
if(str1 && str2) if(str1 && str2)
/* both pointers point to something then compare them */ /* both pointers point to something then compare them */
return (bool)(0 != Curl_raw_equal(str1, str2)); return (0 != Curl_raw_equal(str1, str2)) ? TRUE : FALSE;
else else
/* if both pointers are NULL then treat them as equal */ /* if both pointers are NULL then treat them as equal */
return (bool)(!str1 && !str2); return (!str1 && !str2) ? TRUE : FALSE;
} }
bool bool
@ -210,7 +210,7 @@ Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex,
/* mark this is being ssl requested from here on. */ /* mark this is being ssl requested from here on. */
conn->ssl[sockindex].use = TRUE; conn->ssl[sockindex].use = TRUE;
res = curlssl_connect_nonblocking(conn, sockindex, done); res = curlssl_connect_nonblocking(conn, sockindex, done);
if(!res && *done == TRUE) if(!res && *done)
Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */ Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */
return res; return res;
#else #else

View File

@ -166,14 +166,14 @@ static int passwd_callback(char *buf, int num, int verify
#define seed_enough(x) rand_enough() #define seed_enough(x) rand_enough()
static bool rand_enough(void) static bool rand_enough(void)
{ {
return (bool)(0 != RAND_status()); return (0 != RAND_status()) ? TRUE : FALSE;
} }
#else #else
#define seed_enough(x) rand_enough(x) #define seed_enough(x) rand_enough(x)
static bool rand_enough(int nread) static bool rand_enough(int nread)
{ {
/* this is a very silly decision to make */ /* this is a very silly decision to make */
return (bool)(nread > 500); return (nread > 500) ? TRUE : FALSE;
} }
#endif #endif
@ -2564,7 +2564,7 @@ bool Curl_ossl_data_pending(const struct connectdata *conn,
{ {
if(conn->ssl[connindex].handle) if(conn->ssl[connindex].handle)
/* SSL is in use */ /* SSL is in use */
return (bool)(0 != SSL_pending(conn->ssl[connindex].handle)); return (0 != SSL_pending(conn->ssl[connindex].handle)) ? TRUE : FALSE;
else else
return FALSE; return FALSE;
} }

View File

@ -1386,7 +1386,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
} }
/* We called WSACreateEvent, so call WSACloseEvent */ /* We called WSACreateEvent, so call WSACloseEvent */
if(close_event_func(event_handle) == FALSE) { if(!close_event_func(event_handle)) {
infof(data,"WSACloseEvent failed (%d)", SOCKERRNO); infof(data,"WSACloseEvent failed (%d)", SOCKERRNO);
} }

View File

@ -206,7 +206,7 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state)
{ {
time_t maxtime, timeout; time_t maxtime, timeout;
long timeout_ms; long timeout_ms;
bool start = (bool)(state->state == TFTP_STATE_START); bool start = (state->state == TFTP_STATE_START) ? TRUE : FALSE;
time(&state->start_time); time(&state->start_time);
@ -1334,7 +1334,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
result = tftp_state_machine(state, event); result = tftp_state_machine(state, event);
if(result != CURLE_OK) if(result != CURLE_OK)
return(result); return(result);
*done = (bool)(state->state == TFTP_STATE_FIN); *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
if(*done) if(*done)
/* Tell curl we're done */ /* Tell curl we're done */
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
@ -1356,7 +1356,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
result = tftp_state_machine(state, state->event); result = tftp_state_machine(state, state->event);
if(result != CURLE_OK) if(result != CURLE_OK)
return(result); return(result);
*done = (bool)(state->state == TFTP_STATE_FIN); *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
if(*done) if(*done)
/* Tell curl we're done */ /* Tell curl we're done */
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);

View File

@ -430,7 +430,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
*didwhat |= KEEP_RECV; *didwhat |= KEEP_RECV;
/* indicates data of zero size, i.e. empty file */ /* indicates data of zero size, i.e. empty file */
is_empty_data = (bool)((nread == 0) && (k->bodywrites == 0)); is_empty_data = ((nread == 0) && (k->bodywrites == 0)) ? TRUE : FALSE;
/* NUL terminate, allowing string ops to be used */ /* NUL terminate, allowing string ops to be used */
if(0 < nread || is_empty_data) { if(0 < nread || is_empty_data) {
@ -1143,8 +1143,8 @@ CURLcode Curl_readwrite(struct connectdata *conn,
} }
/* Now update the "done" boolean we return */ /* Now update the "done" boolean we return */
*done = (bool)(0 == (k->keepon&(KEEP_RECV|KEEP_SEND| *done = (0 == (k->keepon&(KEEP_RECV|KEEP_SEND|
KEEP_RECV_PAUSE|KEEP_SEND_PAUSE))); KEEP_RECV_PAUSE|KEEP_SEND_PAUSE))) ? TRUE : FALSE;
return CURLE_OK; return CURLE_OK;
} }
@ -1607,7 +1607,7 @@ static bool is_absolute_url(const char *url)
char prot[16]; /* URL protocol string storage */ char prot[16]; /* URL protocol string storage */
char letter; /* used for a silly sscanf */ char letter; /* used for a silly sscanf */
return (bool)(2 == sscanf(url, "%15[^?&/:]://%c", prot, &letter)); return (2 == sscanf(url, "%15[^?&/:]://%c", prot, &letter)) ? TRUE : FALSE;
} }
/* /*

107
lib/url.c
View File

@ -821,7 +821,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
{ {
/* remember we want this enabled */ /* remember we want this enabled */
long use_cache = va_arg(param, long); long use_cache = va_arg(param, long);
data->set.global_dns_cache = (bool)(0 != use_cache); data->set.global_dns_cache = (0 != use_cache)?TRUE:FALSE;
} }
break; break;
case CURLOPT_SSL_CIPHER_LIST: case CURLOPT_SSL_CIPHER_LIST:
@ -857,33 +857,33 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* When this transfer is done, it must not be left to be reused by a * When this transfer is done, it must not be left to be reused by a
* subsequent transfer but shall be closed immediately. * subsequent transfer but shall be closed immediately.
*/ */
data->set.reuse_forbid = (bool)(0 != va_arg(param, long)); data->set.reuse_forbid = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FRESH_CONNECT: case CURLOPT_FRESH_CONNECT:
/* /*
* This transfer shall not use a previously cached connection but * This transfer shall not use a previously cached connection but
* should be made with a fresh new connect! * should be made with a fresh new connect!
*/ */
data->set.reuse_fresh = (bool)(0 != va_arg(param, long)); data->set.reuse_fresh = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_VERBOSE: case CURLOPT_VERBOSE:
/* /*
* Verbose means infof() calls that give a lot of information about * Verbose means infof() calls that give a lot of information about
* the connection and transfer procedures as well as internal choices. * the connection and transfer procedures as well as internal choices.
*/ */
data->set.verbose = (bool)(0 != va_arg(param, long)); data->set.verbose = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_HEADER: case CURLOPT_HEADER:
/* /*
* Set to include the header in the general data output stream. * Set to include the header in the general data output stream.
*/ */
data->set.include_header = (bool)(0 != va_arg(param, long)); data->set.include_header = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_NOPROGRESS: case CURLOPT_NOPROGRESS:
/* /*
* Shut off the internal supported progress meter * Shut off the internal supported progress meter
*/ */
data->set.hide_progress = (bool)(0 != va_arg(param, long)); data->set.hide_progress = (0 != va_arg(param, long))?TRUE:FALSE;
if(data->set.hide_progress) if(data->set.hide_progress)
data->progress.flags |= PGRS_HIDE; data->progress.flags |= PGRS_HIDE;
else else
@ -893,14 +893,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* Do not include the body part in the output data stream. * Do not include the body part in the output data stream.
*/ */
data->set.opt_no_body = (bool)(0 != va_arg(param, long)); data->set.opt_no_body = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FAILONERROR: case CURLOPT_FAILONERROR:
/* /*
* Don't output the >=300 error code HTML-page, but instead only * Don't output the >=300 error code HTML-page, but instead only
* return error. * return error.
*/ */
data->set.http_fail_on_error = (bool)(0 != va_arg(param, long)); data->set.http_fail_on_error = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_UPLOAD: case CURLOPT_UPLOAD:
case CURLOPT_PUT: case CURLOPT_PUT:
@ -908,7 +908,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* We want to sent data to the remote host. If this is HTTP, that equals * We want to sent data to the remote host. If this is HTTP, that equals
* using the PUT request. * using the PUT request.
*/ */
data->set.upload = (bool)(0 != va_arg(param, long)); data->set.upload = (0 != va_arg(param, long))?TRUE:FALSE;
if(data->set.upload) { if(data->set.upload) {
/* If this is HTTP, PUT is what's needed to "upload" */ /* If this is HTTP, PUT is what's needed to "upload" */
data->set.httpreq = HTTPREQ_PUT; data->set.httpreq = HTTPREQ_PUT;
@ -924,7 +924,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Try to get the file time of the remote document. The time will * Try to get the file time of the remote document. The time will
* later (possibly) become available using curl_easy_getinfo(). * later (possibly) become available using curl_easy_getinfo().
*/ */
data->set.get_filetime = (bool)(0 != va_arg(param, long)); data->set.get_filetime = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FTP_CREATE_MISSING_DIRS: case CURLOPT_FTP_CREATE_MISSING_DIRS:
/* /*
@ -965,13 +965,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* An option that changes the command to one that asks for a list * An option that changes the command to one that asks for a list
* only, no file info details. * only, no file info details.
*/ */
data->set.ftp_list_only = (bool)(0 != va_arg(param, long)); data->set.ftp_list_only = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_APPEND: case CURLOPT_APPEND:
/* /*
* We want to upload and append to an existing file. * We want to upload and append to an existing file.
*/ */
data->set.ftp_append = (bool)(0 != va_arg(param, long)); data->set.ftp_append = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FTP_FILEMETHOD: case CURLOPT_FTP_FILEMETHOD:
/* /*
@ -999,7 +999,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* *
* Transfer using ASCII (instead of BINARY). * Transfer using ASCII (instead of BINARY).
*/ */
data->set.prefer_ascii = (bool)(0 != va_arg(param, long)); data->set.prefer_ascii = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_TIMECONDITION: case CURLOPT_TIMECONDITION:
/* /*
@ -1028,7 +1028,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* Switch on automatic referer that gets set if curl follows locations. * Switch on automatic referer that gets set if curl follows locations.
*/ */
data->set.http_auto_referer = (bool)(0 != va_arg(param, long)); data->set.http_auto_referer = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_ACCEPT_ENCODING: case CURLOPT_ACCEPT_ENCODING:
@ -1048,14 +1048,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
break; break;
case CURLOPT_TRANSFER_ENCODING: case CURLOPT_TRANSFER_ENCODING:
data->set.http_transfer_encoding = (bool)(0 != va_arg(param, long)); data->set.http_transfer_encoding = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FOLLOWLOCATION: case CURLOPT_FOLLOWLOCATION:
/* /*
* Follow Location: header hints on a HTTP-server. * Follow Location: header hints on a HTTP-server.
*/ */
data->set.http_follow_location = (bool)(0 != va_arg(param, long)); data->set.http_follow_location = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_UNRESTRICTED_AUTH: case CURLOPT_UNRESTRICTED_AUTH:
@ -1064,7 +1064,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* hostname changed. * hostname changed.
*/ */
data->set.http_disable_hostname_check_before_authentication = data->set.http_disable_hostname_check_before_authentication =
(bool)(0 != va_arg(param, long)); (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_MAXREDIRS: case CURLOPT_MAXREDIRS:
@ -1086,8 +1086,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* other - POST is kept as POST after 301 and 302 * other - POST is kept as POST after 301 and 302
*/ */
long postRedir = va_arg(param, long); long postRedir = va_arg(param, long);
data->set.post301 = (bool)((postRedir & CURL_REDIR_POST_301)?TRUE:FALSE); data->set.post301 = (postRedir & CURL_REDIR_POST_301)?TRUE:FALSE;
data->set.post302 = (bool)((postRedir & CURL_REDIR_POST_302)?TRUE:FALSE); data->set.post302 = (postRedir & CURL_REDIR_POST_302)?TRUE:FALSE;
} }
break; break;
@ -1296,7 +1296,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* We run mostly with the original cookie spec, as hardly anyone implements * We run mostly with the original cookie spec, as hardly anyone implements
* anything else. * anything else.
*/ */
data->set.cookiesession = (bool)(0 != va_arg(param, long)); data->set.cookiesession = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_COOKIELIST: case CURLOPT_COOKIELIST:
@ -1371,8 +1371,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* the DIGEST_IE bit is only used to set a special marker, for all the /* the DIGEST_IE bit is only used to set a special marker, for all the
rest we need to handle it as normal DIGEST */ rest we need to handle it as normal DIGEST */
data->state.authhost.iestyle = (bool)((auth & CURLAUTH_DIGEST_IE)? data->state.authhost.iestyle = (auth & CURLAUTH_DIGEST_IE)?TRUE:FALSE;
TRUE:FALSE);
if(auth & CURLAUTH_DIGEST_IE) { if(auth & CURLAUTH_DIGEST_IE) {
auth |= CURLAUTH_DIGEST; /* set standard digest bit */ auth |= CURLAUTH_DIGEST; /* set standard digest bit */
@ -1417,7 +1416,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* Tunnel operations through the proxy instead of normal proxy use * Tunnel operations through the proxy instead of normal proxy use
*/ */
data->set.tunnel_thru_httpproxy = (bool)(0 != va_arg(param, long)); data->set.tunnel_thru_httpproxy = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_PROXYPORT: case CURLOPT_PROXYPORT:
@ -1436,8 +1435,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* the DIGEST_IE bit is only used to set a special marker, for all the /* the DIGEST_IE bit is only used to set a special marker, for all the
rest we need to handle it as normal DIGEST */ rest we need to handle it as normal DIGEST */
data->state.authproxy.iestyle = (bool)((auth & CURLAUTH_DIGEST_IE)? data->state.authproxy.iestyle = (auth & CURLAUTH_DIGEST_IE)?TRUE:FALSE;
TRUE:FALSE);
if(auth & CURLAUTH_DIGEST_IE) { if(auth & CURLAUTH_DIGEST_IE) {
auth |= CURLAUTH_DIGEST; /* set standard digest bit */ auth |= CURLAUTH_DIGEST; /* set standard digest bit */
@ -1514,7 +1512,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* set flag for nec socks5 support * set flag for nec socks5 support
*/ */
data->set.socks5_gssapi_nec = (bool)(0 != va_arg(param, long)); data->set.socks5_gssapi_nec = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
#endif #endif
@ -1543,19 +1541,20 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
*/ */
result = setstropt(&data->set.str[STRING_FTPPORT], result = setstropt(&data->set.str[STRING_FTPPORT],
va_arg(param, char *)); va_arg(param, char *));
data->set.ftp_use_port = (bool)(NULL != data->set.str[STRING_FTPPORT]); data->set.ftp_use_port = (NULL != data->set.str[STRING_FTPPORT]) ?
TRUE:FALSE;
break; break;
case CURLOPT_FTP_USE_EPRT: case CURLOPT_FTP_USE_EPRT:
data->set.ftp_use_eprt = (bool)(0 != va_arg(param, long)); data->set.ftp_use_eprt = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FTP_USE_EPSV: case CURLOPT_FTP_USE_EPSV:
data->set.ftp_use_epsv = (bool)(0 != va_arg(param, long)); data->set.ftp_use_epsv = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FTP_USE_PRET: case CURLOPT_FTP_USE_PRET:
data->set.ftp_use_pret = (bool)(0 != va_arg(param, long)); data->set.ftp_use_pret = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FTP_SSL_CCC: case CURLOPT_FTP_SSL_CCC:
@ -1567,7 +1566,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Enable or disable FTP_SKIP_PASV_IP, which will disable/enable the * Enable or disable FTP_SKIP_PASV_IP, which will disable/enable the
* bypass of the IP address in PASV responses. * bypass of the IP address in PASV responses.
*/ */
data->set.ftp_skip_ip = (bool)(0 != va_arg(param, long)); data->set.ftp_skip_ip = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_INFILE: case CURLOPT_INFILE:
@ -1937,7 +1936,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* Kludgy option to enable CRLF conversions. Subject for removal. * Kludgy option to enable CRLF conversions. Subject for removal.
*/ */
data->set.crlf = (bool)(0 != va_arg(param, long)); data->set.crlf = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_INTERFACE: case CURLOPT_INTERFACE:
@ -1966,7 +1965,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
*/ */
result = setstropt(&data->set.str[STRING_KRB_LEVEL], result = setstropt(&data->set.str[STRING_KRB_LEVEL],
va_arg(param, char *)); va_arg(param, char *));
data->set.krb = (bool)(NULL != data->set.str[STRING_KRB_LEVEL]); data->set.krb = (NULL != data->set.str[STRING_KRB_LEVEL])?TRUE:FALSE;
break; break;
case CURLOPT_GSSAPI_DELEGATION: case CURLOPT_GSSAPI_DELEGATION:
/* /*
@ -2004,7 +2003,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
data->set.ssl.fsslctxp = va_arg(param, void *); data->set.ssl.fsslctxp = va_arg(param, void *);
break; break;
case CURLOPT_CERTINFO: case CURLOPT_CERTINFO:
data->set.ssl.certinfo = (bool)(0 != va_arg(param, long)); data->set.ssl.certinfo = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
#endif #endif
case CURLOPT_CAINFO: case CURLOPT_CAINFO:
@ -2064,7 +2063,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* The application asks not to set any signal() or alarm() handlers, * The application asks not to set any signal() or alarm() handlers,
* even when using a timeout. * even when using a timeout.
*/ */
data->set.no_signal = (bool)(0 != va_arg(param, long)); data->set.no_signal = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_SHARE: case CURLOPT_SHARE:
@ -2168,7 +2167,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Enable or disable TCP_NODELAY, which will disable/enable the Nagle * Enable or disable TCP_NODELAY, which will disable/enable the Nagle
* algorithm * algorithm
*/ */
data->set.tcp_nodelay = (bool)(0 != va_arg(param, long)); data->set.tcp_nodelay = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FTP_ACCOUNT: case CURLOPT_FTP_ACCOUNT:
@ -2177,14 +2176,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
break; break;
case CURLOPT_IGNORE_CONTENT_LENGTH: case CURLOPT_IGNORE_CONTENT_LENGTH:
data->set.ignorecl = (bool)(0 != va_arg(param, long)); data->set.ignorecl = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_CONNECT_ONLY: case CURLOPT_CONNECT_ONLY:
/* /*
* No data transfer, set up connection and let application use the socket * No data transfer, set up connection and let application use the socket
*/ */
data->set.connect_only = (bool)(0 != va_arg(param, long)); data->set.connect_only = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_FTP_ALTERNATIVE_TO_USER: case CURLOPT_FTP_ALTERNATIVE_TO_USER:
@ -2237,7 +2236,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
break; break;
case CURLOPT_SSL_SESSIONID_CACHE: case CURLOPT_SSL_SESSIONID_CACHE:
data->set.ssl.sessionid = (bool)(0 != va_arg(param, long)); data->set.ssl.sessionid = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
#ifdef USE_LIBSSH2 #ifdef USE_LIBSSH2
@ -2298,14 +2297,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* disable libcurl transfer encoding is used * disable libcurl transfer encoding is used
*/ */
data->set.http_te_skip = (bool)(0 == va_arg(param, long)); data->set.http_te_skip = (0 == va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_HTTP_CONTENT_DECODING: case CURLOPT_HTTP_CONTENT_DECODING:
/* /*
* raw data passed to the application when content encoding is used * raw data passed to the application when content encoding is used
*/ */
data->set.http_ce_skip = (bool)(0 == va_arg(param, long)); data->set.http_ce_skip = (0 == va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_NEW_FILE_PERMS: case CURLOPT_NEW_FILE_PERMS:
@ -2467,7 +2466,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
break; break;
case CURLOPT_WILDCARDMATCH: case CURLOPT_WILDCARDMATCH:
data->set.wildcardmatch = (bool)(0 != va_arg(param, long)); data->set.wildcardmatch = (0 != va_arg(param, long))?TRUE:FALSE;
break; break;
case CURLOPT_CHUNK_BGN_FUNCTION: case CURLOPT_CHUNK_BGN_FUNCTION:
data->set.chunk_bgn = va_arg(param, curl_chunk_bgn_callback); data->set.chunk_bgn = va_arg(param, curl_chunk_bgn_callback);
@ -2766,11 +2765,11 @@ static struct SessionHandle* gethandleathead(struct curl_llist *pipeline)
void Curl_getoff_all_pipelines(struct SessionHandle *data, void Curl_getoff_all_pipelines(struct SessionHandle *data,
struct connectdata *conn) struct connectdata *conn)
{ {
bool recv_head = (bool)(conn->readchannel_inuse && bool recv_head = (conn->readchannel_inuse &&
(gethandleathead(conn->recv_pipe) == data)); (gethandleathead(conn->recv_pipe) == data)) ? TRUE : FALSE;
bool send_head = (bool)(conn->writechannel_inuse && bool send_head = (conn->writechannel_inuse &&
(gethandleathead(conn->send_pipe) == data)); (gethandleathead(conn->send_pipe) == data)) ? TRUE : FALSE;
if(Curl_removeHandleFromPipeline(data, conn->recv_pipe) && recv_head) if(Curl_removeHandleFromPipeline(data, conn->recv_pipe) && recv_head)
conn->readchannel_inuse = FALSE; conn->readchannel_inuse = FALSE;
@ -3505,18 +3504,18 @@ static struct connectdata *allocate_conn(struct SessionHandle *data)
/* note that these two proxy bits are now just on what looks to be /* note that these two proxy bits are now just on what looks to be
requested, they may be altered down the road */ requested, they may be altered down the road */
conn->bits.proxy = (bool)(data->set.str[STRING_PROXY] && conn->bits.proxy = (data->set.str[STRING_PROXY] &&
*data->set.str[STRING_PROXY]); *data->set.str[STRING_PROXY])?TRUE:FALSE;
conn->bits.httpproxy = (bool)(conn->bits.proxy && conn->bits.httpproxy = (conn->bits.proxy &&
(conn->proxytype == CURLPROXY_HTTP || (conn->proxytype == CURLPROXY_HTTP ||
conn->proxytype == CURLPROXY_HTTP_1_0)); conn->proxytype == CURLPROXY_HTTP_1_0))?TRUE:FALSE;
conn->bits.proxy_user_passwd = conn->bits.proxy_user_passwd =
(bool)(NULL != data->set.str[STRING_PROXYUSERNAME]); (NULL != data->set.str[STRING_PROXYUSERNAME])?TRUE:FALSE;
conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy; conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy;
#endif /* CURL_DISABLE_PROXY */ #endif /* CURL_DISABLE_PROXY */
conn->bits.user_passwd = (bool)(NULL != data->set.str[STRING_USERNAME]); conn->bits.user_passwd = (NULL != data->set.str[STRING_USERNAME])?TRUE:FALSE;
conn->bits.ftp_use_epsv = data->set.ftp_use_epsv; conn->bits.ftp_use_epsv = data->set.ftp_use_epsv;
conn->bits.ftp_use_eprt = data->set.ftp_use_eprt; conn->bits.ftp_use_eprt = data->set.ftp_use_eprt;
@ -3860,7 +3859,7 @@ static CURLcode setup_range(struct SessionHandle *data)
else else
s->range = strdup(data->set.str[STRING_SET_RANGE]); s->range = strdup(data->set.str[STRING_SET_RANGE]);
s->rangestringalloc = (bool)(s->range?TRUE:FALSE); s->rangestringalloc = (s->range)?TRUE:FALSE;
if(!s->range) if(!s->range)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;

View File

@ -2139,7 +2139,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
config->disable_epsv = toggle; config->disable_epsv = toggle;
break; break;
case 'E': /* --epsv */ case 'E': /* --epsv */
config->disable_epsv = (bool)(!toggle); config->disable_epsv = (!toggle)?TRUE:FALSE;
break; break;
#ifdef USE_ENVIRONMENT #ifdef USE_ENVIRONMENT
case 'f': case 'f':
@ -2325,7 +2325,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
config->disable_eprt = toggle; config->disable_eprt = toggle;
break; break;
case 'Z': /* --eprt */ case 'Z': /* --eprt */
config->disable_eprt = (bool)(!toggle); config->disable_eprt = (!toggle)?TRUE:FALSE;
break; break;
default: /* the URL! */ default: /* the URL! */
@ -2456,7 +2456,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
config->ftp_ssl_reqd = toggle; config->ftp_ssl_reqd = toggle;
break; break;
case 'w': /* --no-sessionid */ case 'w': /* --no-sessionid */
config->disable_sessionid = (bool)(!toggle); config->disable_sessionid = (!toggle)?TRUE:FALSE;
break; break;
case 'x': /* --ftp-ssl-control */ case 'x': /* --ftp-ssl-control */
if(toggle && !(curlinfo->features & CURL_VERSION_SSL)) if(toggle && !(curlinfo->features & CURL_VERSION_SSL))
@ -2482,7 +2482,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
config->post301 = toggle; config->post301 = toggle;
break; break;
case '1': /* --no-keepalive */ case '1': /* --no-keepalive */
config->nokeepalive = (bool)(!toggle); config->nokeepalive = (!toggle)?TRUE:FALSE;
break; break;
case '3': /* --keepalive-time */ case '3': /* --keepalive-time */
if(str2num(&config->alivetime, nextarg)) if(str2num(&config->alivetime, nextarg))
@ -2894,7 +2894,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
nextarg, nextarg,
&config->httppost, &config->httppost,
&config->last_post, &config->last_post,
(bool) (subletter=='s'))) /* 's' means literal string */ (subletter=='s')?TRUE:FALSE)) /* 's' means literal string */
return PARAM_BAD_USE; return PARAM_BAD_USE;
if(SetHTTPrequest(config, HTTPREQ_POST, &config->httpreq)) if(SetHTTPrequest(config, HTTPREQ_POST, &config->httpreq))
return PARAM_BAD_USE; return PARAM_BAD_USE;
@ -3004,7 +3004,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
/* disable the output I/O buffering. note that the option is called /* disable the output I/O buffering. note that the option is called
--buffer but is mostly used in the negative form: --no-buffer */ --buffer but is mostly used in the negative form: --no-buffer */
if(longopt) if(longopt)
config->nobuffer = (bool)(!toggle); config->nobuffer = (!toggle)?TRUE:FALSE;
else else
config->nobuffer = toggle; config->nobuffer = toggle;
break; break;
@ -3130,7 +3130,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
config->mute = config->noprogress = TRUE; config->mute = config->noprogress = TRUE;
else else
config->mute = config->noprogress = FALSE; config->mute = config->noprogress = FALSE;
config->showerror = (bool)(!toggle); /* toggle off */ config->showerror = (!toggle)?TRUE:FALSE; /* toggle off */
break; break;
case 'S': case 'S':
/* show errors */ /* show errors */
@ -3995,7 +3995,7 @@ int my_trace(CURL *handle, curl_infotype type,
if(!newl) if(!newl)
fprintf(output, "%s%s ", timebuf, s_infotype[type]); fprintf(output, "%s%s ", timebuf, s_infotype[type]);
(void)fwrite(data+st, i-st+1, 1, output); (void)fwrite(data+st, i-st+1, 1, output);
newl = (bool)(size && (data[size-1] != '\n')); newl = (size && (data[size-1] != '\n'))?TRUE:FALSE;
traced_data = FALSE; traced_data = FALSE;
break; break;
case CURLINFO_TEXT: case CURLINFO_TEXT:
@ -4003,7 +4003,7 @@ int my_trace(CURL *handle, curl_infotype type,
if(!newl) if(!newl)
fprintf(output, "%s%s ", timebuf, s_infotype[type]); fprintf(output, "%s%s ", timebuf, s_infotype[type]);
(void)fwrite(data, size, 1, output); (void)fwrite(data, size, 1, output);
newl = (bool)(size && (data[size-1] != '\n')); newl = (size && (data[size-1] != '\n'))?TRUE:FALSE;
traced_data = FALSE; traced_data = FALSE;
break; break;
case CURLINFO_DATA_OUT: case CURLINFO_DATA_OUT:
@ -4395,8 +4395,8 @@ static void dumpeasycode(struct Configurable *config)
static bool stdin_upload(const char *uploadfile) static bool stdin_upload(const char *uploadfile)
{ {
return (bool)(curlx_strequal(uploadfile, "-") || return (curlx_strequal(uploadfile, "-") ||
curlx_strequal(uploadfile, ".")); curlx_strequal(uploadfile, ".")) ? TRUE : FALSE;
} }
/* Adds the file name to the URL if it doesn't already have one. /* Adds the file name to the URL if it doesn't already have one.

View File

@ -254,7 +254,7 @@ void ourWriteOut(CURL *curl, const char *writeinfo)
break; break;
} }
} }
if(FALSE == match) { if(!match) {
fprintf(stderr, "curl: unknown --write-out variable: '%s'\n", ptr); fprintf(stderr, "curl: unknown --write-out variable: '%s'\n", ptr);
} }
ptr=end+1; /* pass the end */ ptr=end+1; /* pass the end */

View File

@ -166,7 +166,7 @@ int main(int argc, char *argv[])
logmsg("fake_ntlm (user: %s) (proto: %s) (domain: %s) (cached creds: %s)", logmsg("fake_ntlm (user: %s) (proto: %s) (domain: %s) (cached creds: %s)",
helper_user, helper_proto, helper_domain, helper_user, helper_proto, helper_domain,
(use_cached_creds == TRUE) ? "yes" : "no"); (use_cached_creds) ? "yes" : "no");
env = getenv("CURL_NTLM_AUTH_TESTNUM"); env = getenv("CURL_NTLM_AUTH_TESTNUM");
if (env) { if (env) {