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

@ -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 */