(checkprefix("Proxy-authenticate:", header) &&
(407 == k->httpcode))) {
- bool proxy = (k->httpcode == 407) ? TRUE : FALSE;
+ bool proxy = (k->httpcode == 407);
char *auth = Curl_copy_header_value(header);
if(!auth)
return CURLE_OUT_OF_MEMORY;
cf->conn->primary = ctx->ip;
cf->conn->remote_addr = &ctx->addr;
#ifdef USE_IPV6
- cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6) ? TRUE : FALSE;
+ cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6);
#endif
}
else {
}
case CF_QUERY_IP_INFO:
#ifdef USE_IPV6
- *pres1 = (ctx->addr.family == AF_INET6) ? TRUE : FALSE;
+ *pres1 = (ctx->addr.family == AF_INET6);
#else
*pres1 = FALSE;
#endif
* domain can access the variable. Set TRUE when the cookie says
* .domain.com and to false when the domain is complete www.domain.com
*/
- co->tailmatch = strcasecompare(ptr, "TRUE") ? TRUE : FALSE;
+ co->tailmatch = !!strcasecompare(ptr, "TRUE");
break;
case 2:
/* The file format allows the path field to remain not filled in */
* headers from CONNECT should not automatically be part of the
* output. */
CURLcode result;
- int save = data->set.include_header;
+ bool save = data->set.include_header;
data->set.include_header = TRUE;
result = Curl_client_write(data, CLIENTWRITE_HEADER, buf, blen);
- data->set.include_header = save ? TRUE : FALSE;
+ data->set.include_header = save;
return result;
}
if(ftpcode/100 == 2)
/* We have enabled SSL for the data connection! */
conn->bits.ftp_use_data_ssl =
- (data->set.use_ssl != CURLUSESSL_CONTROL) ? TRUE : FALSE;
+ (data->set.use_ssl != CURLUSESSL_CONTROL);
/* FTP servers typically responds with 500 if they decide to reject
our 'P' request */
else if(data->set.use_ssl > CURLUSESSL_CONTROL)
/* Check for the state outside of the Curl_socket_check() return code checks
since at times we are in fact already in this state when this function
gets called. */
- *done = (ftpc->state == FTP_STOP) ? TRUE : FALSE;
+ *done = (ftpc->state == FTP_STOP);
return result;
}
ipv6_works = 1;
sclose(s);
}
- return (ipv6_works > 0) ? TRUE : FALSE;
+ return (ipv6_works > 0);
}
}
#endif /* USE_IPV6 */
auth, data->state.aptr.user ?
data->state.aptr.user : "");
#endif
- authstatus->multipass = (!authstatus->done) ? TRUE : FALSE;
+ authstatus->multipass = !authstatus->done;
}
else
authstatus->multipass = FALSE;
conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
strcasecompare("localhost", host) ||
!strcmp(host, "127.0.0.1") ||
- !strcmp(host, "::1") ? TRUE : FALSE;
+ !strcmp(host, "::1");
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
rc = Curl_cookie_getlist(data, data->cookies, host, data->state.up.path,
secure_context, &list);
char *persistentauth = Curl_copy_header_value(hd);
if(!persistentauth)
return CURLE_OUT_OF_MEMORY;
- negdata->noauthpersist = checkprefix("false", persistentauth) ?
- TRUE : FALSE;
+ negdata->noauthpersist = !!checkprefix("false", persistentauth);
negdata->havenoauthpersist = TRUE;
infof(data, "Negotiate: noauthpersist -> %d, header part: %s",
negdata->noauthpersist, persistentauth);
conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
strcasecompare("localhost", host) ||
!strcmp(host, "127.0.0.1") ||
- !strcmp(host, "::1") ? TRUE : FALSE;
+ !strcmp(host, "::1");
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,
CURL_LOCK_ACCESS_SINGLE);
bool Curl_http_exp100_is_selected(struct Curl_easy *data)
{
struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
- return r ? TRUE : FALSE;
+ return !!r;
}
#endif /* CURL_DISABLE_HTTP */
passwdp = "";
#if defined(USE_WINDOWS_SSPI)
- have_chlg = digest->input_token ? TRUE : FALSE;
+ have_chlg = !!digest->input_token;
#else
- have_chlg = digest->nonce ? TRUE : FALSE;
+ have_chlg = !!digest->nonce;
#endif
if(!have_chlg) {
}
result = Curl_pp_statemach(data, &imapc->pp, FALSE, FALSE);
- *done = (imapc->state == IMAP_STOP) ? TRUE : FALSE;
+ *done = (imapc->state == IMAP_STOP);
return result;
}
size_t cmd_size = 0;
CURLcode error;
enum protection_level prot_level = conn->data_prot;
- bool iscmd = (prot_level == PROT_CMD) ? TRUE : FALSE;
+ bool iscmd = (prot_level == PROT_CMD);
DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST);
* are not NULL, but no longer have the MAGIC touch. This gives
* us early warning on things only discovered by valgrind otherwise. */
#define GOOD_MULTI_HANDLE(x) \
- (((x) && (x)->magic == CURL_MULTI_HANDLE)? TRUE: \
+ (((x) && (x)->magic == CURL_MULTI_HANDLE)? TRUE: \
(DEBUGASSERT(!(x)), FALSE))
#else
#define GOOD_MULTI_HANDLE(x) \
if(multi->in_callback)
return CURLM_RECURSIVE_API_CALL;
- premature = (data->mstate < MSTATE_COMPLETED) ? TRUE : FALSE;
+ premature = (data->mstate < MSTATE_COMPLETED);
/* 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. */
*/
CURLcode ret = Curl_retry_request(data, &newurl);
if(!ret)
- retry = (newurl) ? TRUE : FALSE;
+ retry = !!newurl;
else if(!result)
result = ret;
}
result = Curl_pp_statemach(data, &pop3c->pp, FALSE, FALSE);
- *done = (pop3c->state == POP3_STOP) ? TRUE : FALSE;
+ *done = (pop3c->state == POP3_STOP);
return result;
}
(void)instate; /* no use for this yet */
- is_smtp_err = (smtpcode/100 != 2) ? TRUE : FALSE;
+ is_smtp_err = (smtpcode/100 != 2);
/* If there is multiple RCPT TO to be issued, it is possible to ignore errors
and proceed with only the valid addresses. */
- is_smtp_blocking_err =
- (is_smtp_err && !data->set.mail_rcpt_allowfails) ? TRUE : FALSE;
+ is_smtp_blocking_err = (is_smtp_err && !data->set.mail_rcpt_allowfails);
if(is_smtp_err) {
/* Remembering the last failure which we can report if all "RCPT TO" have
}
result = Curl_pp_statemach(data, &smtpc->pp, FALSE, FALSE);
- *done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE;
+ *done = (smtpc->state == SMTP_STOP);
return result;
}
{
struct connectdata *conn = cf->conn;
const bool protocol4a =
- (conn->socks_proxy.proxytype == CURLPROXY_SOCKS4A) ? TRUE : FALSE;
+ (conn->socks_proxy.proxytype == CURLPROXY_SOCKS4A);
unsigned char *socksreq = sx->buffer;
CURLcode result;
CURLproxycode presult;
CURLcode result;
CURLproxycode presult;
bool socks5_resolve_local =
- (conn->socks_proxy.proxytype == CURLPROXY_SOCKS5) ? TRUE : FALSE;
+ (conn->socks_proxy.proxytype == CURLPROXY_SOCKS5);
const size_t hostname_len = strlen(sx->hostname);
size_t len = 0;
const unsigned char auth = data->set.socks5auth;
{
time_t maxtime, timeout;
timediff_t timeout_ms;
- bool start = (state->state == TFTP_STATE_START) ? TRUE : FALSE;
+ bool start = (state->state == TFTP_STATE_START);
/* Compute drop-dead time */
timeout_ms = Curl_timeleft(state->data, NULL, start);
result = tftp_state_machine(state, event);
if(result)
return result;
- *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
+ *done = (state->state == TFTP_STATE_FIN);
if(*done)
/* Tell curl we are done */
Curl_xfer_setup_nop(data);
result = tftp_state_machine(state, state->event);
if(result)
return result;
- *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
+ *done = (state->state == TFTP_STATE_FIN);
if(*done)
/* Tell curl we are done */
Curl_xfer_setup_nop(data);
/* note that these two proxy bits are now just on what looks to be
requested, they may be altered down the road */
conn->bits.proxy = (data->set.str[STRING_PROXY] &&
- *data->set.str[STRING_PROXY]) ? TRUE : FALSE;
+ *data->set.str[STRING_PROXY]);
conn->bits.httpproxy = (conn->bits.proxy &&
(conn->http_proxy.proxytype == CURLPROXY_HTTP ||
conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0 ||
- IS_HTTPS_PROXY(conn->http_proxy.proxytype))) ?
- TRUE : FALSE;
- conn->bits.socksproxy = (conn->bits.proxy &&
- !conn->bits.httpproxy) ? TRUE : FALSE;
+ IS_HTTPS_PROXY(conn->http_proxy.proxytype)));
+ conn->bits.socksproxy = (conn->bits.proxy && !conn->bits.httpproxy);
if(data->set.str[STRING_PRE_PROXY] && *data->set.str[STRING_PRE_PROXY]) {
conn->bits.proxy = TRUE;
conn->bits.socksproxy = TRUE;
}
- conn->bits.proxy_user_passwd =
- (data->state.aptr.proxyuser) ? TRUE : FALSE;
+ conn->bits.proxy_user_passwd = !!data->state.aptr.proxyuser;
conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy;
#endif /* CURL_DISABLE_PROXY */
else
s->range = strdup(data->set.str[STRING_SET_RANGE]);
- s->rangestringalloc = (s->range) ? TRUE : FALSE;
-
if(!s->range)
return CURLE_OUT_OF_MEMORY;
+ s->rangestringalloc = TRUE;
+
/* tell ourselves to fetch this range */
s->use_range = TRUE; /* enable range download */
}
Curl_pSecFn->FreeContextBuffer(SecurityPackage);
}
- return (status == SEC_E_OK ? TRUE : FALSE);
+ return (status == SEC_E_OK);
}
/*
Curl_pSecFn->FreeContextBuffer(SecurityPackage);
}
- return (status == SEC_E_OK ? TRUE : FALSE);
+ return (status == SEC_E_OK);
}
/*
unsigned char ntresp[24]; /* fixed-size */
unsigned char *ptr_ntresp = &ntresp[0];
unsigned char *ntlmv2resp = NULL;
- bool unicode = (ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE) ? TRUE : FALSE;
+ bool unicode = (ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE);
/* The fixed hostname we provide, in order to not leak our real local host
name. Copy the name used by Firefox. */
static const char host[] = "WORKSTATION";
Curl_pSecFn->FreeContextBuffer(SecurityPackage);
}
- return (status == SEC_E_OK ? TRUE : FALSE);
+ return (status == SEC_E_OK);
}
/*
}
- return (status == SEC_E_OK ? TRUE : FALSE);
+ return (status == SEC_E_OK);
}
/*
/* Check we have a domain name or UPN present */
char *p = strpbrk(user, "\\/@");
- valid = (p != NULL && p > user && p < user + strlen(user) - 1 ? TRUE :
- FALSE);
+ valid = (p != NULL && p > user && p < user + strlen(user) - 1);
}
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
else
case SSH_S_STARTUP:
rc = ssh_connect(sshc->ssh_session);
- myssh_block2waitfor(conn, (rc == SSH_AGAIN) ? TRUE : FALSE);
+ myssh_block2waitfor(conn, (rc == SSH_AGAIN));
if(rc == SSH_AGAIN) {
DEBUGF(infof(data, "ssh_connect -> EAGAIN"));
break;
implementation */
CURLcode result = myssh_statemach_act(data, &block);
- *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
+ *done = (sshc->state == SSH_STOP);
myssh_block2waitfor(conn, block);
return result;
/* The following code is misleading, mostly added as wishful thinking
* that libssh at some point will implement non-blocking ssh_scp_write/read.
* Currently rc can only be number of bytes read or SSH_ERROR. */
- myssh_block2waitfor(conn, (rc == SSH_AGAIN) ? TRUE : FALSE);
+ myssh_block2waitfor(conn, (rc == SSH_AGAIN));
if(rc == SSH_AGAIN) {
*err = CURLE_AGAIN;
* that libssh at some point will implement non-blocking ssh_scp_write/read.
* Currently rc can only be SSH_OK or SSH_ERROR. */
- myssh_block2waitfor(conn, (nread == SSH_AGAIN) ? TRUE : FALSE);
+ myssh_block2waitfor(conn, (nread == SSH_AGAIN));
if(nread == SSH_AGAIN) {
*err = CURLE_AGAIN;
nread = -1;
mem, (uint32_t)len,
(uint32_t)conn->proto.sshc.sftp_file_index);
- myssh_block2waitfor(conn, (nread == SSH_AGAIN) ? TRUE : FALSE);
+ myssh_block2waitfor(conn, (nread == SSH_AGAIN));
if(nread == SSH_AGAIN) {
*err = CURLE_AGAIN;
implementation */
do {
result = ssh_statemachine(data, &block);
- *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
+ *done = (sshc->state == SSH_STOP);
/* if there is no error, it is not done and it did not EWOULDBLOCK, then
try again */
} while(!result && !*done && !block);
/* libssh2_channel_write() returns int! */
nwrite = (ssize_t) libssh2_channel_write(sshc->ssh_channel, mem, len);
- ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);
+ ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN));
if(nwrite == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN;
/* libssh2_channel_read() returns int */
nread = (ssize_t) libssh2_channel_read(sshc->ssh_channel, mem, len);
- ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);
+ ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN));
if(nread == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN;
nread = -1;
nwrite = libssh2_sftp_write(sshc->sftp_handle, mem, len);
- ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);
+ ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN));
if(nwrite == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN;
nread = libssh2_sftp_read(sshc->sftp_handle, mem, len);
- ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);
+ ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN));
if(nread == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN;
implementation */
do {
result = wssh_statemach_act(data, &block);
- *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
+ *done = (sshc->state == SSH_STOP);
/* if there is no error, it is not done and it did not EWOULDBLOCK, then
try again */
if(*done) {
*/
static bool rand_enough(void)
{
- return (0 != RAND_status()) ? TRUE : FALSE;
+ return (0 != RAND_status());
}
static CURLcode ossl_seed(struct Curl_easy *data)
bool Curl_ssl_supports(struct Curl_easy *data, unsigned int ssl_option)
{
(void)data;
- return (Curl_ssl->supports & ssl_option) ? TRUE : FALSE;
+ return (Curl_ssl->supports & ssl_option);
}
static struct Curl_cfilter *get_ssl_filter(struct Curl_cfilter *cf)
backend = (struct wolfssl_ctx *)ctx->backend;
if(backend->handle) /* SSL is in use */
- return (0 != wolfSSL_pending(backend->handle)) ? TRUE : FALSE;
+ return wolfSSL_pending(backend->handle);
else
return FALSE;
}
log_line_start(output, timebuf, idsbuf, type);
(void)fwrite(data + st, i - st + 1, 1, output);
}
- newl = (size && (data[size - 1] != '\n')) ? TRUE : FALSE;
+ newl = (size && (data[size - 1] != '\n'));
traced_data = FALSE;
break;
case CURLINFO_TEXT:
if(!newl)
log_line_start(output, timebuf, idsbuf, type);
(void)fwrite(data, size, 1, output);
- newl = (size && (data[size - 1] != '\n')) ? TRUE : FALSE;
+ newl = (size && (data[size - 1] != '\n'));
traced_data = FALSE;
break;
case CURLINFO_DATA_OUT:
config->disallow_username_in_url = toggle;
break;
case C_EPSV: /* --epsv */
- config->disable_epsv = (!toggle) ? TRUE : FALSE;
+ config->disable_epsv = !toggle;
break;
case C_DNS_SERVERS: /* --dns-servers */
if(!curlinfo->ares_num) /* c-ares is needed for this */
}
break;
case C_ALPN: /* --alpn */
- config->noalpn = (!toggle) ? TRUE : FALSE;
+ config->noalpn = !toggle;
break;
case C_LIMIT_RATE: /* --limit-rate */
err = GetSizeParameter(global, nextarg, "rate", &value);
config->disable_eprt = toggle;
break;
case C_EPRT: /* --eprt */
- config->disable_eprt = (!toggle) ? TRUE : FALSE;
+ config->disable_eprt = !toggle;
break;
case C_XATTR: /* --xattr */
config->xattr = toggle;
config->ftp_ssl_reqd = toggle;
break;
case C_SESSIONID: /* --sessionid */
- config->disable_sessionid = (!toggle) ? TRUE : FALSE;
+ config->disable_sessionid = !toggle;
break;
case C_FTP_SSL_CONTROL: /* --ftp-ssl-control */
if(toggle && !feature_ssl)
config->raw = toggle;
break;
case C_KEEPALIVE: /* --keepalive */
- config->nokeepalive = (!toggle) ? TRUE : FALSE;
+ config->nokeepalive = !toggle;
break;
case C_KEEPALIVE_TIME: /* --keepalive-time */
err = str2unum(&config->alivetime, nextarg);
nextarg,
&config->mimeroot,
&config->mimecurrent,
- (cmd == C_FORM_STRING) ? TRUE : FALSE)) /* literal string */
+ (cmd == C_FORM_STRING))) /* literal string */
err = PARAM_BAD_USE;
else if(SetHTTPrequest(config, TOOL_HTTPREQ_MIMEPOST, &config->httpreq))
err = PARAM_BAD_USE;
all_added++;
*addedp = TRUE;
}
- *morep = (per || sleeping) ? TRUE : FALSE;
+ *morep = (per || sleeping);
return CURLE_OK;
}
bool stdin_upload(const char *uploadfile)
{
- return (!strcmp(uploadfile, "-") ||
- !strcmp(uploadfile, ".")) ? TRUE : FALSE;
+ return (!strcmp(uploadfile, "-") || !strcmp(uploadfile, "."));
}
/* Convert a CURLUcode into a CURLcode */
option = line;
/* the option starts with a dash? */
- dashed_option = (option[0] == '-') ? TRUE : FALSE;
+ dashed_option = (option[0] == '-');
while(*line && !ISSPACE(*line) && !ISSEP(*line, dashed_option))
line++;
occurs while no characters have been read. */
if(!fgets(buf, sizeof(buf), fp))
/* only if there is data in the line, return TRUE */
- return curlx_dyn_len(db) ? TRUE : FALSE;
+ return curlx_dyn_len(db);
if(curlx_dyn_add(db, buf)) {
*error = TRUE; /* error */
return FALSE; /* stop reading */