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

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