static CURL_THREAD_RETURN_T CURL_STDCALL getaddrinfo_thread(void *arg)
{
struct async_thrdd_addr_ctx *addr_ctx = arg;
- bool do_abort;
+ curl_bit do_abort;
Curl_mutex_acquire(&addr_ctx->mutx);
do_abort = addr_ctx->do_abort;
#endif
if(thrdd->addr && (thrdd->addr->thread_hnd != curl_thread_t_null)) {
- bool done;
+ curl_bit done;
Curl_mutex_acquire(&addr->mutx);
#ifndef CURL_DISABLE_SOCKETPAIR
{
struct async_thrdd_ctx *thrdd = &data->state.async.thrdd;
struct async_thrdd_addr_ctx *addr_ctx = thrdd->addr;
- bool done;
+ curl_bit done;
if(!addr_ctx)
return;
struct Curl_dns_entry **dns)
{
struct async_thrdd_ctx *thrdd = &data->state.async.thrdd;
- bool done = FALSE;
+ curl_bit done = FALSE;
DEBUGASSERT(dns);
*dns = NULL;
{
struct async_thrdd_ctx *thrdd = &data->state.async.thrdd;
CURLcode result = CURLE_OK;
- bool thrd_done;
+ curl_bit thrd_done;
#if !defined(USE_HTTPSRR_ARES) && defined(CURL_DISABLE_SOCKETPAIR)
(void)ps;
struct Curl_easy *data,
bool *connected)
{
- *connected = a->connected;
+ *connected = (bool)a->connected;
if(!a->result && !*connected) {
/* evaluate again */
a->result = Curl_conn_cf_connect(a->cf, data, connected);
}
/* Connect TCP socket */
- rc = do_connect(cf, data, cf->conn->bits.tcp_fastopen);
+ rc = do_connect(cf, data, (bool)cf->conn->bits.tcp_fastopen);
error = SOCKERRNO;
set_local_ip(cf, data);
CURL_TRC_CF(data, cf, "local address %s port %d...",
return CURLE_FAILED_INIT;
}
- *done = cf->connected;
+ *done = (bool)cf->connected;
if(*done)
return CURLE_OK;
return FALSE;
cf = conn->cfilter[sockindex];
if(cf)
- return cf->connected;
+ return (bool)cf->connected;
else if(conn->handler->flags & PROTOPT_NONETWORK)
return TRUE;
return FALSE;
((ctrl == CONNCTRL_STREAM) && !is_multiplex);
if((ctrl == CONNCTRL_STREAM) && is_multiplex)
; /* stream signal on multiplex conn never affects close state */
- else if((bit)closeit != conn->bits.close) {
+ else if((curl_bit)closeit != conn->bits.close) {
conn->bits.close = closeit; /* the only place in the source code that
should assign this bit */
}
data->state.cookie_engine = TRUE;
while(list) {
result = cookie_load(data, list->data, data->cookies,
- data->set.cookiesession);
+ (bool)data->set.cookiesession);
if(result)
break;
list = list->next;
conn->connection_id, conn->bits.aborted));
/* There are protocol handlers that block on retrieving
* server responses here (FTP). Set a short timeout. */
- conn->handler->disconnect(data, conn, conn->bits.aborted);
+ conn->handler->disconnect(data, conn, (bool)conn->bits.aborted);
}
conn->bits.shutdown_handler = TRUE;
Curl_auth_create_gssapi_user_message(data, sctx->conn->user,
sctx->conn->passwd,
service, sctx->conn->host.name,
- sctx->sasl->mutual_auth, NULL,
- krb5, &sctx->resp);
+ (bool)sctx->sasl->mutual_auth,
+ NULL, krb5, &sctx->resp);
}
return TRUE;
}
result = !krb5 ? CURLE_OUT_OF_MEMORY :
Curl_auth_create_gssapi_user_message(data, conn->user, conn->passwd,
service, conn->host.name,
- sasl->mutual_auth, NULL,
+ (bool)sasl->mutual_auth, NULL,
krb5, &resp);
newstate = SASL_GSSAPI_TOKEN;
break;
message */
result = Curl_auth_create_gssapi_user_message(data, NULL, NULL,
NULL, NULL,
- sasl->mutual_auth,
+ (bool)sasl->mutual_auth,
&serverdata,
krb5, &resp);
newstate = SASL_GSSAPI_NO_DATA;
sasl->curmech = NULL;
/* Start an alternative SASL authentication */
- return Curl_sasl_start(sasl, data, sasl->force_ir, progress);
+ return Curl_sasl_start(sasl, data, (bool)sasl->force_ir, progress);
default:
failf(data, "Unsupported SASL authentication mechanism");
result = CURLE_UNSUPPORTED_PROTOCOL; /* Should not happen */
#endif
/* the type we use for storing a single boolean bit */
-#ifdef _MSC_VER
-typedef bool bit;
-#define BIT(x) bool x
-#else
-typedef unsigned int bit;
-#define BIT(x) bit x:1
-#endif
+typedef unsigned int curl_bit;
+#define BIT(x) curl_bit x:1
/*
* Redefine TRUE and FALSE too, to catch current use. With this
return FALSE;
ctx = (struct cw_out_ctx *)cw_out;
- return ctx->paused;
+ return (bool)ctx->paused;
}
static CURLcode cw_out_flush(struct Curl_easy *data,
information. Which in FTP cannot be much more than the file size and
date. */
if(data->req.no_body && ftpc->file &&
- ftp_need_type(ftpc, data->state.prefer_ascii)) {
+ ftp_need_type(ftpc, (bool)data->state.prefer_ascii)) {
/* The SIZE command is _not_ RFC 959 specified, and therefore many servers
may not support it! It is however the only way we have to get a file's
size! */
/* Some servers return different sizes for different modes, and thus we
must set the proper type before we check the size */
- result = ftp_nb_type(data, ftpc, ftp, data->state.prefer_ascii, FTP_TYPE);
+ result = ftp_nb_type(data, ftpc, ftp, (bool)data->state.prefer_ascii,
+ FTP_TYPE);
if(result)
return result;
}
bool sizechecked)
{
CURLcode result = CURLE_OK;
- bool append = data->set.remote_append;
+ curl_bit append = data->set.remote_append;
if((data->state.resume_from && !sizechecked) ||
((data->state.resume_from > 0) && sizechecked)) {
}
}
else if(data->state.upload) {
- result = ftp_nb_type(data, ftpc, ftp, data->state.prefer_ascii,
+ result = ftp_nb_type(data, ftpc, ftp, (bool)data->state.prefer_ascii,
FTP_STOR_TYPE);
if(result)
return result;
FTP_RETR_LIST_TYPE);
}
else {
- result = ftp_nb_type(data, ftpc, ftp, data->state.prefer_ascii,
+ result = ftp_nb_type(data, ftpc, ftp, (bool)data->state.prefer_ascii,
FTP_RETR_TYPE);
}
if(result)
* headers from CONNECT should not automatically be part of the
* output. */
CURLcode result;
- bool save = data->set.include_header;
+ bool save = (bool)data->set.include_header;
data->set.include_header = TRUE;
result = Curl_client_write(data, CLIENTWRITE_HEADER, buf, blen);
data->set.include_header = save;
return TRUE;
#endif
- return data->state.authproblem;
+ return (bool)data->state.authproblem;
}
/*
#ifndef CURL_DISABLE_PROXY
/* Send proxy authentication header if needed */
if(conn->bits.httpproxy &&
- (conn->bits.tunnel_proxy == (bit)proxytunnel)) {
+ (conn->bits.tunnel_proxy == (curl_bit)proxytunnel)) {
result = output_auth_headers(data, conn, authproxy, request, path, TRUE);
if(result)
return result;
else
stream->status_code = -1;
- h2_xfer_write_resp_hd(cf, data, stream, STRCONST("\r\n"), stream->closed);
+ h2_xfer_write_resp_hd(cf, data, stream, STRCONST("\r\n"),
+ (bool)stream->closed);
if(stream->status_code / 100 != 1) {
stream->resp_hds_complete = TRUE;
case CHUNK_POSTLF:
if(*buf == 0x0a) {
/* The last one before we go back to hex state and start all over. */
- Curl_httpchunk_reset(data, ch, ch->ignore_body);
+ Curl_httpchunk_reset(data, ch, (bool)ch->ignore_body);
}
else if(*buf != 0x0d) {
ch->state = CHUNK_FAILED;
CURLcode result = CURLE_READ_ERROR;
*pnread = 0;
- *peos = ctx->eos;
+ *peos = (bool)ctx->eos;
if(!ctx->eos) {
if(!ctx->read_eos && Curl_bufq_is_empty(&ctx->chunkbuf)) {
if(*phostname != cf->conn->host.name)
*pipv6_ip = (strchr(*phostname, ':') != NULL);
else
- *pipv6_ip = cf->conn->bits.ipv6_ip;
+ *pipv6_ip = (bool)cf->conn->bits.ipv6_ip;
}
struct cf_proxy_ctx {
}
/* Calculate the SASL login details */
- result = Curl_sasl_start(&imapc->sasl, data, imapc->ir_supported, &progress);
+ result = Curl_sasl_start(&imapc->sasl, data, (bool)imapc->ir_supported,
+ &progress);
if(!result) {
if(progress == SASL_INPROGRESS)
if(ctx->total_len >= 0)
ctx->seen_eos = (ctx->read_len >= ctx->total_len);
*pnread = nread;
- *peos = ctx->seen_eos;
+ *peos = (bool)ctx->seen_eos;
break;
}
Curl_resolv_unlink(data, &data->state.dns[1]);
Curl_dnscache_prune(data);
- if(multi_conn_should_close(conn, data, mdctx->premature)) {
+ if(multi_conn_should_close(conn, data, (bool)mdctx->premature)) {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
CURL_TRC_M(data, "multi_done, terminating conn #%" FMT_OFF_T " to %s:%d, "
"forbid=%d, close=%d, premature=%d, conn_multiplex=%d",
Curl_conn_is_multiplex(conn, FIRSTSOCKET));
#endif
connclose(conn, "disconnecting");
- Curl_conn_terminate(data, conn, mdctx->premature);
+ Curl_conn_terminate(data, conn, (bool)mdctx->premature);
}
else if(!Curl_conn_get_max_concurrent(data, conn, FIRSTSOCKET)) {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
" by server, not reusing", conn->connection_id, host, port);
#endif
connclose(conn, "server shutdown");
- Curl_conn_terminate(data, conn, mdctx->premature);
+ Curl_conn_terminate(data, conn, (bool)mdctx->premature);
}
else {
/* the connection is no longer in use by any transfer */
*/
static bool multi_ischanged(struct Curl_multi *multi, bool clear)
{
- bool retval = multi->recheckstate;
+ bool retval = (bool)multi->recheckstate;
if(clear)
multi->recheckstate = FALSE;
return retval;
for(i = 0; i < CURL_ARRAYSIZE(pop3cmds); ++i) {
if(curl_strnequal(pop3cmds[i].name, cmdline, pop3cmds[i].nlen)) {
if(!cmdline[pop3cmds[i].nlen])
- return pop3cmds[i].multiline;
+ return (bool)pop3cmds[i].multiline;
else if(cmdline[pop3cmds[i].nlen] == ' ')
- return pop3cmds[i].multiline_with_args;
+ return (bool)pop3cmds[i].multiline_with_args;
}
}
/* Unknown command, assume multi-line for backward compatibility with
bool Curl_rlimit_is_blocked(struct Curl_rlimit *r)
{
- return r->blocked;
+ return (bool)r->blocked;
}
int64_t Curl_rlimit_avail(struct Curl_rlimit *r,
bool Curl_creader_will_rewind(struct Curl_easy *data)
{
- return data->req.rewind_read;
+ return (bool)data->req.rewind_read;
}
void Curl_creader_set_rewind(struct Curl_easy *data, bool enable)
if(ctx->total_len >= 0)
ctx->seen_eos = (ctx->read_len >= ctx->total_len);
*pnread = nread;
- *peos = ctx->seen_eos;
+ *peos = (bool)ctx->seen_eos;
break;
}
CURL_TRC_READ(data, "cr_in_read(len=%zu, total=%"FMT_OFF_T
{
struct cr_in_ctx *ctx = reader->ctx;
(void)data;
- return ctx->has_used_cb;
+ return (bool)ctx->has_used_cb;
}
static curl_off_t cr_in_total_length(struct Curl_easy *data,
{
struct cr_in_ctx *ctx = reader->ctx;
(void)data;
- return ctx->is_paused;
+ return (bool)ctx->is_paused;
}
static const struct Curl_crtype cr_in = {
if(ctx->read_eos)
ctx->eos = TRUE;
*pnread = nread;
- *peos = ctx->eos;
+ *peos = (bool)ctx->eos;
goto out;
}
CURL_TRC_SMTP(data, "mail body complete, returning EOS");
ctx->eos = TRUE;
}
- *peos = ctx->eos;
+ *peos = (bool)ctx->eos;
DEBUGF(infof(data, "cr_eob_read(%zu) -> %d, %zd, %d",
blen, result, *pnread, *peos));
return result;
cf->connected = TRUE;
out:
- *done = cf->connected;
+ *done = (bool)cf->connected;
return result;
}
/* wait_pipe is TRUE if we encounter a bundle that is undecided. There
* is no matching connection then, yet. */
*usethis = match.found;
- *force_reuse = match.force_reuse;
- *waitpipe = match.wait_pipe;
+ *force_reuse = (bool)match.force_reuse;
+ *waitpipe = (bool)match.wait_pipe;
return result;
}
conn->bits.ftp_use_eprt = data->set.ftp_use_eprt;
#endif
conn->ip_version = data->set.ipver;
- conn->connect_only = data->set.connect_only;
+ conn->connect_only = (bool)data->set.connect_only;
conn->transport_wanted = TRNSPRT_TCP; /* most of them are TCP streams */
/* Store the local bind parameters that will be used for this connection */
return CURLE_OUT_OF_MEMORY;
hostaddr->addr = Curl_unix2addr(unix_path, &longpath,
- conn->bits.abstract_unix_socket);
+ (bool)conn->bits.abstract_unix_socket);
if(!hostaddr->addr) {
if(longpath)
/* Long paths are not supported for now */
/* HTTP version last responded with by the server or negotiated via ALPN.
* 0 at start, then one of 09, 10, 11, etc. */
uint8_t httpversion_seen;
- uint8_t connect_only;
uint8_t gssapi_delegation; /* inherited from set.gssapi_delegation */
+ BIT(connect_only);
};
#ifndef CURL_DISABLE_PROXY
if(!stream)
return 0;
/* add a CRLF only if we have received some headers */
- h3_xfer_write_resp_hd(cf, data, stream, STRCONST("\r\n"), stream->closed);
+ h3_xfer_write_resp_hd(cf, data, stream, STRCONST("\r\n"),
+ (bool)stream->closed);
CURL_TRC_CF(data, cf, "[%" PRId64 "] end_headers, status=%d",
stream_id, stream->status_code);
!ossl_cached_x509_store_expired(data, share) &&
!ossl_cached_x509_store_different(cf, data, share)) {
store = share->store;
- *pempty = share->store_is_empty;
+ *pempty = (bool)share->store_is_empty;
}
return store;
result = ossl_populate_x509_store(cf, data, octx, store);
if(result == CURLE_OK && cache_criteria_met) {
- ossl_set_cached_x509_store(cf, data, store, octx->store_is_empty);
+ ossl_set_cached_x509_store(cf, data, store, (bool)octx->store_is_empty);
}
}
{
struct ssl_connect_data *connssl = cf->ctx;
(void)data;
- return connssl->input_pending;
+ return (bool)connssl->input_pending;
}
static CURLcode ossl_send(struct Curl_cfilter *cf,
(void)data;
DEBUGASSERT(ctx && ctx->backend);
backend = (struct rustls_ssl_backend_data *)ctx->backend;
- return backend->data_in_pending;
+ return (bool)backend->data_in_pending;
}
struct io_ctx {
#else
ctx = cf_ctx_new(data, alpn_get_spec(data->state.http_neg.wanted,
data->state.http_neg.preferred,
- conn->bits.tls_enable_alpn));
+ (bool)conn->bits.tls_enable_alpn));
#endif
if(!ctx) {
result = CURLE_OUT_OF_MEMORY;
struct ssl_connect_data *ctx;
CURLcode result;
/* ALPN is default, but if user explicitly disables it, obey */
- bool use_alpn = data->set.ssl_enable_alpn;
+ bool use_alpn = (bool)data->set.ssl_enable_alpn;
http_majors wanted = CURL_HTTP_V1x;
(void)conn;
return CURLE_SEND_ERROR;
}
- result = ws_frame_flags2firstbyte(data, flags, enc->contfragment, &firstb);
+ result = ws_frame_flags2firstbyte(data, flags, (bool)enc->contfragment,
+ &firstb);
if(result)
return result;
/* fragmentation only applies to data frames (text/binary);
* control frames (close/ping/pong) do not affect the CONT status */
if(flags & (CURLWS_TEXT | CURLWS_BINARY)) {
- enc->contfragment = (flags & CURLWS_CONT) ? (bit)TRUE : (bit)FALSE;
+ enc->contfragment = (curl_bit)((flags & CURLWS_CONT) ? TRUE : FALSE);
}
if(flags & CURLWS_PING && payload_len > WS_MAX_CNTRL_LEN) {
if(ctx->read_eos)
ctx->eos = TRUE;
*pnread = nread;
- *peos = ctx->eos;
+ *peos = (bool)ctx->eos;
goto out;
}
struct OutStruct *outs = &per->outs;
struct OperationConfig *config = per->config;
size_t bytes = sz * nmemb;
- bool is_tty = global->isatty;
+ bool is_tty = (bool)global->isatty;
#ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO console_info;
intptr_t fhnd;
CURLSH *share, struct State *state,
bool *added, bool *skipped)
{
- const bool orig_isatty = global->isatty;
- const bool orig_noprogress = global->noprogress;
+ const bool orig_isatty = (bool)global->isatty;
+ const bool orig_noprogress = (bool)global->noprogress;
CURLcode result = CURLE_OK;
while(state->urlnode) {
struct per_transfer *per = NULL;
CURLcode result)
{
/* Save the values of noprogress and isatty to restore them later on */
- bool orig_noprogress = global->noprogress;
- bool orig_isatty = global->isatty;
+ bool orig_noprogress = (bool)global->noprogress;
+ bool orig_isatty = (bool)global->isatty;
struct per_transfer *per;
/* Time to actually do the transfers */