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
This commit is contained in:
Viktor Szakats 2026-01-01 16:38:56 +01:00
parent 57ff2d6c91
commit 85c841cb45
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
32 changed files with 73 additions and 73 deletions

View file

@ -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;