win: fix some compiler warnings (#5070)

* win: initialize INIT_ONCE field with dedicated initializer
Fixes: abc9767034 ("win: simplify uv_once implementation")
* win: indendation fixes
* win: squash some compiler warnings
This commit is contained in:
Benjamin Gilbert 2026-03-16 21:19:14 -07:00 committed by GitHub
parent 919b92d944
commit fa38eb43df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 8 deletions

View File

@ -279,7 +279,7 @@ typedef struct {
DWORD tls_index;
} uv_key_t;
#define UV_ONCE_INIT { 0, { NULL } }
#define UV_ONCE_INIT { 0, INIT_ONCE_STATIC_INIT }
typedef struct uv_once_s {
unsigned char unused;

View File

@ -215,7 +215,8 @@ int uv__stdio_create(uv_loop_t* loop,
* handles in the stdio buffer are initialized with.
* INVALID_HANDLE_VALUE, which should be okay. */
if (i <= 2) {
HANDLE nul;
/* Redundantly initialize to make the compiler happy. */
HANDLE nul = INVALID_HANDLE_VALUE;
DWORD access = (i == 0) ? FILE_GENERIC_READ :
FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES;

View File

@ -508,8 +508,8 @@ int uv_uptime(double* uptime) {
unsigned int uv_available_parallelism(void) {
DWORD_PTR procmask;
DWORD_PTR sysmask;
unsigned count;
unsigned i;
int count;
unsigned int i;
/* TODO(bnoordhuis) Use GetLogicalProcessorInformationEx() to support systems
* with > 64 CPUs? See https://github.com/libuv/libuv/pull/3458