From: Viktor Szakats Date: Thu, 1 Jan 2026 15:38:56 +0000 (+0100) Subject: msvc: drop exception, make `BIT()` a bitfield with Visual Studio X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85c841cb45e5fe99ed3420adfa9c556fb397aefb;p=thirdparty%2Fcurl.git msvc: drop exception, make `BIT()` a bitfield with Visual Studio Add casts to `bool`, or use `bit` type in local variables, where neccessary to avoid MSVC compiler warnings C4242. Note: There may remain places needing the above updates, where not tested in CI, and missed in manual review. Also: - urldata: convert struct field `connect_only` to bitfield to match its counterpart in another struct. - rename curl-specific `bit` type to `curl_bit`. Closes #20142 --- diff --git a/lib/asyn-thrdd.c b/lib/asyn-thrdd.c index 55f65cd5ae..3bafaf04a8 100644 --- a/lib/asyn-thrdd.c +++ b/lib/asyn-thrdd.c @@ -199,7 +199,7 @@ err_exit: 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; @@ -301,7 +301,7 @@ static void async_thrdd_destroy(struct Curl_easy *data) #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 @@ -462,7 +462,7 @@ static void async_thrdd_shutdown(struct Curl_easy *data) { 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; @@ -569,7 +569,7 @@ CURLcode Curl_async_is_resolved(struct Curl_easy *data, 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; @@ -666,7 +666,7 @@ CURLcode Curl_async_pollset(struct Curl_easy *data, struct easy_pollset *ps) { 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; diff --git a/lib/cf-ip-happy.c b/lib/cf-ip-happy.c index 0644c13cf8..a802ddacb4 100644 --- a/lib/cf-ip-happy.c +++ b/lib/cf-ip-happy.c @@ -228,7 +228,7 @@ static CURLcode cf_ip_attempt_connect(struct cf_ip_attempt *a, 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); diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 251a603db2..837f72e9af 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -1263,7 +1263,7 @@ static CURLcode cf_tcp_connect(struct Curl_cfilter *cf, } /* 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...", diff --git a/lib/cfilters.c b/lib/cfilters.c index 76c24e7a68..c6aa06a3b8 100644 --- a/lib/cfilters.c +++ b/lib/cfilters.c @@ -513,7 +513,7 @@ CURLcode Curl_conn_connect(struct Curl_easy *data, return CURLE_FAILED_INIT; } - *done = cf->connected; + *done = (bool)cf->connected; if(*done) return CURLE_OK; @@ -610,7 +610,7 @@ bool Curl_conn_is_connected(struct connectdata *conn, int sockindex) 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; diff --git a/lib/connect.c b/lib/connect.c index 681ead7227..c832f86086 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -317,7 +317,7 @@ void Curl_conncontrol(struct connectdata *conn, ((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 */ } diff --git a/lib/cookie.c b/lib/cookie.c index c8072228b9..e385f6e9e9 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -1169,7 +1169,7 @@ CURLcode Curl_cookie_loadfiles(struct Curl_easy *data) 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; diff --git a/lib/cshutdn.c b/lib/cshutdn.c index b2c62e1309..84db4e717c 100644 --- a/lib/cshutdn.c +++ b/lib/cshutdn.c @@ -59,7 +59,7 @@ static void cshutdn_run_conn_handler(struct Curl_easy *data, 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; diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index abcb3315b1..6197ea007f 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -332,8 +332,8 @@ static bool sasl_choose_krb5(struct Curl_easy *data, struct sasl_ctx *sctx) 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; } @@ -712,7 +712,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data, 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; @@ -728,7 +728,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data, 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; @@ -801,7 +801,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *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 */ diff --git a/lib/curl_setup_once.h b/lib/curl_setup_once.h index 06ccc98639..df20b72937 100644 --- a/lib/curl_setup_once.h +++ b/lib/curl_setup_once.h @@ -233,13 +233,8 @@ struct timeval { #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 diff --git a/lib/cw-out.c b/lib/cw-out.c index 786d7509cd..3936cf0276 100644 --- a/lib/cw-out.c +++ b/lib/cw-out.c @@ -458,7 +458,7 @@ bool Curl_cw_out_is_paused(struct Curl_easy *data) 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, diff --git a/lib/ftp.c b/lib/ftp.c index 858fb7539c..42ac5f5c74 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1519,7 +1519,7 @@ static CURLcode ftp_state_type(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! */ @@ -1529,7 +1529,8 @@ static CURLcode ftp_state_type(struct Curl_easy *data, /* 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; } @@ -1570,7 +1571,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data, 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)) { @@ -2239,7 +2240,7 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep) } } 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; @@ -2284,7 +2285,7 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep) 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) @@ -2417,7 +2418,7 @@ static CURLcode client_write_header(struct Curl_easy *data, * 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; diff --git a/lib/http.c b/lib/http.c index 76d904c05a..4334428bec 100644 --- a/lib/http.c +++ b/lib/http.c @@ -527,7 +527,7 @@ static bool http_should_fail(struct Curl_easy *data, int httpcode) return TRUE; #endif - return data->state.authproblem; + return (bool)data->state.authproblem; } /* @@ -806,7 +806,7 @@ Curl_http_output_auth(struct Curl_easy *data, #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; diff --git a/lib/http2.c b/lib/http2.c index 302f2feff7..c4c9825538 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -986,7 +986,8 @@ static CURLcode on_stream_frame(struct Curl_cfilter *cf, 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; diff --git a/lib/http_chunks.c b/lib/http_chunks.c index f78a89e54f..c950346b2d 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -228,7 +228,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data, 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; @@ -602,7 +602,7 @@ static CURLcode cr_chunked_read(struct Curl_easy *data, 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)) { diff --git a/lib/http_proxy.c b/lib/http_proxy.c index 1e30d21d96..e9dfb8dbb3 100644 --- a/lib/http_proxy.c +++ b/lib/http_proxy.c @@ -187,7 +187,7 @@ void Curl_http_proxy_get_destination(struct Curl_cfilter *cf, 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 { diff --git a/lib/imap.c b/lib/imap.c index c28395634c..7eb6880740 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -710,7 +710,8 @@ static CURLcode imap_perform_authentication(struct Curl_easy *data, } /* 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) diff --git a/lib/mime.c b/lib/mime.c index de811eddb1..4d8177c066 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -2037,7 +2037,7 @@ static CURLcode cr_mime_read(struct Curl_easy *data, 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; } diff --git a/lib/multi.c b/lib/multi.c index e0e37f8edd..594c39aff8 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -623,7 +623,7 @@ static void multi_done_locked(struct connectdata *conn, 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", @@ -632,7 +632,7 @@ static void multi_done_locked(struct connectdata *conn, 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 @@ -640,7 +640,7 @@ static void multi_done_locked(struct connectdata *conn, " 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 */ @@ -1629,7 +1629,7 @@ CURLMcode curl_multi_wakeup(CURLM *m) */ 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; diff --git a/lib/pop3.c b/lib/pop3.c index 0ba601d6af..6faad63c97 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -271,9 +271,9 @@ static bool pop3_is_multiline(const char *cmdline) 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 diff --git a/lib/ratelimit.c b/lib/ratelimit.c index 7abbde87cc..1b1fb6cced 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c @@ -189,7 +189,7 @@ bool Curl_rlimit_active(struct Curl_rlimit *r) 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, diff --git a/lib/sendf.c b/lib/sendf.c index 2cd62efb48..674b0a4573 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -117,7 +117,7 @@ CURLcode Curl_client_start(struct Curl_easy *data) 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) @@ -727,7 +727,7 @@ static CURLcode cr_in_read(struct Curl_easy *data, 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 @@ -742,7 +742,7 @@ static bool cr_in_needs_rewind(struct Curl_easy *data, { 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, @@ -903,7 +903,7 @@ static bool cr_in_is_paused(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 = { @@ -1013,7 +1013,7 @@ static CURLcode cr_lc_read(struct Curl_easy *data, if(ctx->read_eos) ctx->eos = TRUE; *pnread = nread; - *peos = ctx->eos; + *peos = (bool)ctx->eos; goto out; } diff --git a/lib/smtp.c b/lib/smtp.c index 5c376dfce9..70fdba8cc6 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -431,7 +431,7 @@ static CURLcode cr_eob_read(struct Curl_easy *data, 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; diff --git a/lib/socks.c b/lib/socks.c index 5ad7d99015..35765d7aba 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -1308,7 +1308,7 @@ static CURLcode socks_proxy_cf_connect(struct Curl_cfilter *cf, cf->connected = TRUE; out: - *done = cf->connected; + *done = (bool)cf->connected; return result; } diff --git a/lib/url.c b/lib/url.c index 05b0b714d8..c8f36450a6 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1309,8 +1309,8 @@ static bool ConnectionExists(struct Curl_easy *data, /* 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; } @@ -1367,7 +1367,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data) 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 */ @@ -3157,7 +3157,7 @@ static CURLcode resolve_unix(struct Curl_easy *data, 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 */ diff --git a/lib/urldata.h b/lib/urldata.h index a7261c7aca..04a7385e03 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -724,8 +724,8 @@ struct connectdata { /* 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 diff --git a/lib/vquic/curl_ngtcp2.c b/lib/vquic/curl_ngtcp2.c index 1d17d4a832..57a1543be3 100644 --- a/lib/vquic/curl_ngtcp2.c +++ b/lib/vquic/curl_ngtcp2.c @@ -1158,7 +1158,8 @@ static int cb_h3_end_headers(nghttp3_conn *conn, int64_t stream_id, 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); diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 5e7d6a50fe..c88e2b81d9 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -3240,7 +3240,7 @@ static X509_STORE *ossl_get_cached_x509_store(struct Curl_cfilter *cf, !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; @@ -3333,7 +3333,7 @@ CURLcode Curl_ssl_setup_x509_store(struct Curl_cfilter *cf, 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); } } @@ -5017,7 +5017,7 @@ static bool ossl_data_pending(struct Curl_cfilter *cf, { 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, diff --git a/lib/vtls/rustls.c b/lib/vtls/rustls.c index 0751a2db7a..b7793ebdb7 100644 --- a/lib/vtls/rustls.c +++ b/lib/vtls/rustls.c @@ -83,7 +83,7 @@ static bool cr_data_pending(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 { diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index f11b11f8b9..6e336b0b8d 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -1716,7 +1716,7 @@ static CURLcode cf_ssl_create(struct Curl_cfilter **pcf, #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; @@ -1767,7 +1767,7 @@ static CURLcode cf_ssl_proxy_create(struct Curl_cfilter **pcf, 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; diff --git a/lib/ws.c b/lib/ws.c index dd3c996ceb..d3e004fcf0 100644 --- a/lib/ws.c +++ b/lib/ws.c @@ -836,14 +836,15 @@ static CURLcode ws_enc_add_frame(struct Curl_easy *data, 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) { @@ -1177,7 +1178,7 @@ static CURLcode cr_ws_read(struct Curl_easy *data, if(ctx->read_eos) ctx->eos = TRUE; *pnread = nread; - *peos = ctx->eos; + *peos = (bool)ctx->eos; goto out; } diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index 8d686b6d58..17c7d80b0f 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -244,7 +244,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata) 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; diff --git a/src/tool_operate.c b/src/tool_operate.c index 554027734c..13ebe83fee 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1166,8 +1166,8 @@ static CURLcode create_single(struct OperationConfig *config, 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; @@ -2174,8 +2174,8 @@ static CURLcode run_all_transfers(CURLSH *share, 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 */