blob: 917d375e5e1bf3489614250a71a347cf448126aa [file] [log] [blame]
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
James Kuszmaulcf324122023-01-14 14:07:17 -08002From: PJ Reiniger <pj.reiniger@gmail.com>
3Date: Tue, 26 Apr 2022 15:01:25 -0400
Maxwell Henderson80bec322024-01-09 15:48:44 -08004Subject: [PATCH 2/9] Fix missing casts
James Kuszmaulcf324122023-01-14 14:07:17 -08005
6---
James Kuszmaulb13e13f2023-11-22 20:44:04 -08007 src/fs-poll.c | 10 ++++----
Maxwell Henderson80bec322024-01-09 15:48:44 -08008 src/idna.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -08009 src/inet.c | 11 ++++----
James Kuszmaulcf324122023-01-14 14:07:17 -080010 src/strscpy.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080011 src/thread-common.c | 2 +-
James Kuszmaulcf324122023-01-14 14:07:17 -080012 src/threadpool.c | 2 +-
13 src/unix/bsd-ifaddrs.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080014 src/unix/core.c | 18 ++++++-------
15 src/unix/darwin-proctitle.c | 5 ++--
James Kuszmaulcf324122023-01-14 14:07:17 -080016 src/unix/darwin.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080017 src/unix/freebsd.c | 4 +--
18 src/unix/fs.c | 20 +++++++--------
19 src/unix/fsevents.c | 34 ++++++++++++-------------
20 src/unix/getaddrinfo.c | 8 +++---
James Kuszmaulcf324122023-01-14 14:07:17 -080021 src/unix/ibmi.c | 2 +-
22 src/unix/kqueue.c | 6 ++---
James Kuszmaulb13e13f2023-11-22 20:44:04 -080023 src/unix/linux.c | 46 +++++++++++++++++-----------------
James Kuszmaulcf324122023-01-14 14:07:17 -080024 src/unix/loop.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080025 src/unix/netbsd.c | 4 +--
26 src/unix/openbsd.c | 4 +--
27 src/unix/pipe.c | 4 +--
28 src/unix/poll.c | 4 +--
James Kuszmaulcf324122023-01-14 14:07:17 -080029 src/unix/posix-poll.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080030 src/unix/process.c | 4 +--
James Kuszmaulcf324122023-01-14 14:07:17 -080031 src/unix/proctitle.c | 2 +-
32 src/unix/random-sysctl-linux.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080033 src/unix/stream.c | 31 ++++++++++++-----------
Maxwell Henderson80bec322024-01-09 15:48:44 -080034 src/unix/tcp.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080035 src/unix/thread.c | 5 ++--
36 src/unix/udp.c | 8 +++---
37 src/uv-common.c | 16 ++++++------
38 src/win/core.c | 8 +++---
Maxwell Henderson80bec322024-01-09 15:48:44 -080039 src/win/dl.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080040 src/win/fs-event.c | 4 +--
James Kuszmaulcf324122023-01-14 14:07:17 -080041 src/win/fs-fd-hash-inl.h | 2 +-
Maxwell Henderson80bec322024-01-09 15:48:44 -080042 src/win/fs.c | 38 ++++++++++++++--------------
43 src/win/getaddrinfo.c | 12 ++++-----
44 src/win/pipe.c | 8 +++---
45 src/win/process.c | 22 ++++++++--------
James Kuszmaulcf324122023-01-14 14:07:17 -080046 src/win/tcp.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080047 src/win/thread.c | 4 +--
Maxwell Henderson80bec322024-01-09 15:48:44 -080048 src/win/tty.c | 6 ++---
49 src/win/util.c | 35 +++++++++++++-------------
50 43 files changed, 207 insertions(+), 202 deletions(-)
James Kuszmaulcf324122023-01-14 14:07:17 -080051
James Kuszmaulcf324122023-01-14 14:07:17 -080052diff --git a/src/fs-poll.c b/src/fs-poll.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -080053index 1bac1c568e36cadd0b68451926c6f045f88342d2..5a39daed095502b2db34f23fcaf0ab04f31f96ff 100644
James Kuszmaulcf324122023-01-14 14:07:17 -080054--- a/src/fs-poll.c
55+++ b/src/fs-poll.c
56@@ -77,7 +77,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
57
58 loop = handle->loop;
59 len = strlen(path);
60- ctx = uv__calloc(1, sizeof(*ctx) + len);
61+ ctx = (struct poll_ctx*)uv__calloc(1, sizeof(*ctx) + len);
62
63 if (ctx == NULL)
64 return UV_ENOMEM;
65@@ -101,7 +101,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
66 goto error;
67
68 if (handle->poll_ctx != NULL)
69- ctx->previous = handle->poll_ctx;
70+ ctx->previous = (struct poll_ctx*)handle->poll_ctx;
71 handle->poll_ctx = ctx;
72 uv__handle_start(handle);
73
74@@ -119,7 +119,7 @@ int uv_fs_poll_stop(uv_fs_poll_t* handle) {
75 if (!uv_is_active((uv_handle_t*)handle))
76 return 0;
77
78- ctx = handle->poll_ctx;
79+ ctx = (struct poll_ctx*)handle->poll_ctx;
80 assert(ctx != NULL);
81 assert(ctx->parent_handle == handle);
82
83@@ -144,7 +144,7 @@ int uv_fs_poll_getpath(uv_fs_poll_t* handle, char* buffer, size_t* size) {
84 return UV_EINVAL;
85 }
86
87- ctx = handle->poll_ctx;
88+ ctx = (struct poll_ctx*)handle->poll_ctx;
89 assert(ctx != NULL);
90
91 required_len = strlen(ctx->path);
92@@ -244,7 +244,7 @@ static void timer_close_cb(uv_handle_t* timer) {
93 if (handle->poll_ctx == NULL && uv__is_closing(handle))
94 uv__make_close_pending((uv_handle_t*)handle);
95 } else {
96- for (last = handle->poll_ctx, it = last->previous;
97+ for (last = (struct poll_ctx*)handle->poll_ctx, it = last->previous;
98 it != ctx;
99 last = it, it = it->previous) {
100 assert(last->previous != NULL);
Maxwell Henderson80bec322024-01-09 15:48:44 -0800101diff --git a/src/idna.c b/src/idna.c
102index 1c0a60cf3e3becc1badafa394e7c422af7f56833..0c952cf605a88136ed9035f9385f9b1080c30c28 100644
103--- a/src/idna.c
104+++ b/src/idna.c
105@@ -477,7 +477,7 @@ int uv_utf16_to_wtf8(const uint16_t* w_source_ptr,
106 return 0;
107
108 if (*target_ptr == NULL) {
109- target = uv__malloc(target_len + 1);
110+ target = (char*)uv__malloc(target_len + 1);
111 if (target == NULL) {
112 return UV_ENOMEM;
113 }
James Kuszmaulcf324122023-01-14 14:07:17 -0800114diff --git a/src/inet.c b/src/inet.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800115index cd77496846e90e8b8e61c63c10f498f153344fe5..dd94bea3886ca37945fcad7909d765e3700e3c21 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800116--- a/src/inet.c
117+++ b/src/inet.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800118@@ -35,9 +35,9 @@ static int inet_pton6(const char *src, unsigned char *dst);
James Kuszmaulcf324122023-01-14 14:07:17 -0800119 int uv_inet_ntop(int af, const void* src, char* dst, size_t size) {
120 switch (af) {
121 case AF_INET:
122- return (inet_ntop4(src, dst, size));
123+ return (inet_ntop4((const unsigned char*)src, dst, size));
124 case AF_INET6:
125- return (inet_ntop6(src, dst, size));
126+ return (inet_ntop6((const unsigned char*)src, dst, size));
127 default:
128 return UV_EAFNOSUPPORT;
129 }
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800130@@ -149,10 +149,11 @@ int uv_inet_pton(int af, const char* src, void* dst) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800131
132 switch (af) {
133 case AF_INET:
134- return (inet_pton4(src, dst));
135+ return (inet_pton4(src, (unsigned char*)dst));
136 case AF_INET6: {
137 int len;
138- char tmp[UV__INET6_ADDRSTRLEN], *s, *p;
139+ char tmp[UV__INET6_ADDRSTRLEN], *s;
140+ const char *p;
141 s = (char*) src;
142 p = strchr(src, '%');
143 if (p != NULL) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800144@@ -163,7 +164,7 @@ int uv_inet_pton(int af, const char* src, void* dst) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800145 memcpy(s, src, len);
146 s[len] = '\0';
147 }
148- return inet_pton6(s, dst);
149+ return inet_pton6(s, (unsigned char*)dst);
150 }
151 default:
152 return UV_EAFNOSUPPORT;
153diff --git a/src/strscpy.c b/src/strscpy.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800154index 20df6fcbed29e9d944c866ddbcd5c09345a426b3..6b4cc3bc741b40b9c2b13d4c06e7090f8083a7ba 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800155--- a/src/strscpy.c
156+++ b/src/strscpy.c
157@@ -27,7 +27,7 @@ ssize_t uv__strscpy(char* d, const char* s, size_t n) {
158
159 for (i = 0; i < n; i++)
160 if ('\0' == (d[i] = s[i]))
161- return i > SSIZE_MAX ? UV_E2BIG : (ssize_t) i;
162+ return i > SSIZE_MAX ? (ssize_t) UV_E2BIG : (ssize_t) i;
163
164 if (i == 0)
165 return 0;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800166diff --git a/src/thread-common.c b/src/thread-common.c
167index c67c0a7dd7279af6c67b7d5d4a623c47bdf3fff2..c0e39b543df229dd8cb8492bb695e61e40911453 100644
168--- a/src/thread-common.c
169+++ b/src/thread-common.c
170@@ -49,7 +49,7 @@ int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
171 if (barrier == NULL || count == 0)
172 return UV_EINVAL;
173
174- b = uv__malloc(sizeof(*b));
175+ b = (struct _uv_barrier *)uv__malloc(sizeof(*b));
176 if (b == NULL)
177 return UV_ENOMEM;
178 #endif
James Kuszmaulcf324122023-01-14 14:07:17 -0800179diff --git a/src/threadpool.c b/src/threadpool.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800180index dbef67f2f10f1df498f228c21eba2a71ceceee29..f572de5aaf1a1b150e58c7b989949441cac279c4 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800181--- a/src/threadpool.c
182+++ b/src/threadpool.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800183@@ -207,7 +207,7 @@ static void init_threads(void) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800184
185 threads = default_threads;
186 if (nthreads > ARRAY_SIZE(default_threads)) {
187- threads = uv__malloc(nthreads * sizeof(threads[0]));
188+ threads = (uv_thread_t*)uv__malloc(nthreads * sizeof(threads[0]));
189 if (threads == NULL) {
190 nthreads = ARRAY_SIZE(default_threads);
191 threads = default_threads;
192diff --git a/src/unix/bsd-ifaddrs.c b/src/unix/bsd-ifaddrs.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800193index 11ca95591fc38244e931fecd9dd4038d3968af7a..c3dd71a1889bfae08cfdf95acda61e6c3472bd2c 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800194--- a/src/unix/bsd-ifaddrs.c
195+++ b/src/unix/bsd-ifaddrs.c
196@@ -92,7 +92,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
197 }
198
199 /* Make sure the memory is initiallized to zero using calloc() */
200- *addresses = uv__calloc(*count, sizeof(**addresses));
201+ *addresses = (uv_interface_address_t*)uv__calloc(*count, sizeof(**addresses));
202
203 if (*addresses == NULL) {
204 freeifaddrs(addrs);
205diff --git a/src/unix/core.c b/src/unix/core.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800206index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f128c5a573c 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800207--- a/src/unix/core.c
208+++ b/src/unix/core.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800209@@ -855,7 +855,7 @@ static unsigned int next_power_of_two(unsigned int val) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800210 }
211
212 static void maybe_resize(uv_loop_t* loop, unsigned int len) {
213- uv__io_t** watchers;
214+ void** watchers;
215 void* fake_watcher_list;
216 void* fake_watcher_count;
217 unsigned int nwatchers;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800218@@ -874,8 +874,8 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800219 }
220
221 nwatchers = next_power_of_two(len + 2) - 2;
222- watchers = uv__reallocf(loop->watchers,
223- (nwatchers + 2) * sizeof(loop->watchers[0]));
224+ watchers = (void**)
225+ uv__reallocf(loop->watchers, (nwatchers + 2) * sizeof(loop->watchers[0]));
226
227 if (watchers == NULL)
228 abort();
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800229@@ -884,7 +884,7 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
230 watchers[nwatchers] = fake_watcher_list;
231 watchers[nwatchers + 1] = fake_watcher_count;
232
233- loop->watchers = watchers;
234+ loop->watchers = (uv__io_t**)watchers;
235 loop->nwatchers = nwatchers;
236 }
237
238@@ -1216,7 +1216,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800239 * is frequently 1024 or 4096, so we can just use that directly. The pwent
240 * will not usually be large. */
241 for (bufsize = 2000;; bufsize *= 2) {
242- buf = uv__malloc(bufsize);
243+ buf = (char*)uv__malloc(bufsize);
244
245 if (buf == NULL)
246 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800247@@ -1242,7 +1242,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800248 name_size = strlen(pw.pw_name) + 1;
249 homedir_size = strlen(pw.pw_dir) + 1;
250 shell_size = strlen(pw.pw_shell) + 1;
251- pwd->username = uv__malloc(name_size + homedir_size + shell_size);
252+ pwd->username = (char*)uv__malloc(name_size + homedir_size + shell_size);
253
254 if (pwd->username == NULL) {
255 uv__free(buf);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800256@@ -1292,7 +1292,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) {
257 * is frequently 1024 or 4096, so we can just use that directly. The pwent
258 * will not usually be large. */
259 for (bufsize = 2000;; bufsize *= 2) {
260- buf = uv__malloc(bufsize);
261+ buf = (char*)uv__malloc(bufsize);
262
263 if (buf == NULL)
264 return UV_ENOMEM;
265@@ -1323,7 +1323,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) {
266 members++;
267 }
268
269- gr_mem = uv__malloc(name_size + mem_size);
270+ gr_mem = (char*)uv__malloc(name_size + mem_size);
271 if (gr_mem == NULL) {
272 uv__free(buf);
273 return UV_ENOMEM;
274@@ -1380,7 +1380,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800275
276 for (i = 0; environ[i] != NULL; i++);
277
278- *envitems = uv__calloc(i, sizeof(**envitems));
279+ *envitems = (uv_env_item_s*)uv__calloc(i, sizeof(**envitems));
280
281 if (*envitems == NULL)
282 return UV_ENOMEM;
283diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800284index 5288083ef04fd78d90c34071cc76281adbc310d8..9bd55dd764b845cf8ea441d525b4e136699eb52e 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800285--- a/src/unix/darwin-proctitle.c
286+++ b/src/unix/darwin-proctitle.c
287@@ -128,8 +128,9 @@ int uv__set_process_title(const char* title) {
288 if (pLSSetApplicationInformationItem == NULL)
289 goto out;
290
291- display_name_key = pCFBundleGetDataPointerForName(launch_services_bundle,
292- S("_kLSDisplayNameKey"));
293+ display_name_key = (CFStringRef*)
294+ pCFBundleGetDataPointerForName(launch_services_bundle,
295+ S("_kLSDisplayNameKey"));
296
297 if (display_name_key == NULL || *display_name_key == NULL)
298 goto out;
299diff --git a/src/unix/darwin.c b/src/unix/darwin.c
Maxwell Henderson80bec322024-01-09 15:48:44 -0800300index 5e764a65ee4c71efd61876c70b0e999420f24f61..dc93d236b6b7c6da62dc7aa66cb42ddc125575a2 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800301--- a/src/unix/darwin.c
302+++ b/src/unix/darwin.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800303@@ -217,7 +217,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800304 return UV_EINVAL; /* FIXME(bnoordhuis) Translate error. */
305 }
306
307- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
308+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
309 if (!(*cpu_infos)) {
310 vm_deallocate(mach_task_self(), (vm_address_t)info, msg_type);
311 return UV_ENOMEM;
James Kuszmaulcf324122023-01-14 14:07:17 -0800312diff --git a/src/unix/freebsd.c b/src/unix/freebsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800313index 191bc8bc213ffddb15c5e04baa66e2a0a8d69a3d..1bd63886b823be6451ac013d94e29885795375b7 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800314--- a/src/unix/freebsd.c
315+++ b/src/unix/freebsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800316@@ -220,7 +220,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800317 if (sysctlbyname("hw.ncpu", &numcpus, &size, NULL, 0))
318 return UV__ERR(errno);
319
320- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
321+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
322 if (!(*cpu_infos))
323 return UV_ENOMEM;
324
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800325@@ -237,7 +237,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800326
327 size = maxcpus * CPUSTATES * sizeof(long);
328
329- cp_times = uv__malloc(size);
330+ cp_times = (long*)uv__malloc(size);
331 if (cp_times == NULL) {
332 uv__free(*cpu_infos);
333 return UV_ENOMEM;
334diff --git a/src/unix/fs.c b/src/unix/fs.c
Maxwell Henderson80bec322024-01-09 15:48:44 -0800335index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d758dbc423b 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800336--- a/src/unix/fs.c
337+++ b/src/unix/fs.c
Maxwell Henderson80bec322024-01-09 15:48:44 -0800338@@ -134,7 +134,7 @@ extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */
James Kuszmaulcf324122023-01-14 14:07:17 -0800339 size_t new_path_len; \
340 path_len = strlen(path) + 1; \
341 new_path_len = strlen(new_path) + 1; \
342- req->path = uv__malloc(path_len + new_path_len); \
343+ req->path = (char*)uv__malloc(path_len + new_path_len); \
344 if (req->path == NULL) \
345 return UV_ENOMEM; \
346 req->new_path = req->path + path_len; \
Maxwell Henderson80bec322024-01-09 15:48:44 -0800347@@ -496,7 +496,7 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800348 static int uv__fs_opendir(uv_fs_t* req) {
349 uv_dir_t* dir;
350
351- dir = uv__malloc(sizeof(*dir));
352+ dir = (uv_dir_t*)uv__malloc(sizeof(*dir));
353 if (dir == NULL)
354 goto error;
355
Maxwell Henderson80bec322024-01-09 15:48:44 -0800356@@ -520,7 +520,7 @@ static int uv__fs_readdir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800357 unsigned int dirent_idx;
358 unsigned int i;
359
360- dir = req->ptr;
361+ dir = (uv_dir_t*)req->ptr;
362 dirent_idx = 0;
363
364 while (dirent_idx < dir->nentries) {
Maxwell Henderson80bec322024-01-09 15:48:44 -0800365@@ -562,7 +562,7 @@ error:
James Kuszmaulcf324122023-01-14 14:07:17 -0800366 static int uv__fs_closedir(uv_fs_t* req) {
367 uv_dir_t* dir;
368
369- dir = req->ptr;
370+ dir = (uv_dir_t*)req->ptr;
371
372 if (dir->dir != NULL) {
373 closedir(dir->dir);
Maxwell Henderson80bec322024-01-09 15:48:44 -0800374@@ -591,7 +591,7 @@ static int uv__fs_statfs(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800375 #endif /* defined(__sun) */
376 return -1;
377
378- stat_fs = uv__malloc(sizeof(*stat_fs));
379+ stat_fs = (uv_statfs_t*)uv__malloc(sizeof(*stat_fs));
380 if (stat_fs == NULL) {
381 errno = ENOMEM;
382 return -1;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800383@@ -655,7 +655,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800384 maxlen = uv__fs_pathmax_size(req->path);
385 #endif
386
387- buf = uv__malloc(maxlen);
388+ buf = (char*)uv__malloc(maxlen);
389
390 if (buf == NULL) {
391 errno = ENOMEM;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800392@@ -675,7 +675,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800393
394 /* Uncommon case: resize to make room for the trailing nul byte. */
395 if (len == maxlen) {
396- buf = uv__reallocf(buf, len + 1);
397+ buf = (char*)uv__reallocf(buf, len + 1);
398
399 if (buf == NULL)
400 return -1;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800401@@ -698,7 +698,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800402 ssize_t len;
403
404 len = uv__fs_pathmax_size(req->path);
405- buf = uv__malloc(len + 1);
406+ buf = (char*)uv__malloc(len + 1);
407
408 if (buf == NULL) {
409 errno = ENOMEM;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800410@@ -1886,7 +1886,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req,
411
James Kuszmaulcf324122023-01-14 14:07:17 -0800412 req->bufs = req->bufsml;
413 if (nbufs > ARRAY_SIZE(req->bufsml))
414- req->bufs = uv__malloc(nbufs * sizeof(*bufs));
415+ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
416
417 if (req->bufs == NULL)
418 return UV_ENOMEM;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800419@@ -2071,7 +2071,7 @@ int uv_fs_write(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -0800420 req->nbufs = nbufs;
421 req->bufs = req->bufsml;
422 if (nbufs > ARRAY_SIZE(req->bufsml))
423- req->bufs = uv__malloc(nbufs * sizeof(*bufs));
424+ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
425
426 if (req->bufs == NULL)
427 return UV_ENOMEM;
428diff --git a/src/unix/fsevents.c b/src/unix/fsevents.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800429index df703f3635fc95bab21debc9697dba06a2a44827..c31d08ba37cfd10672ab6a7a8fd38a1c79b952fe 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800430--- a/src/unix/fsevents.c
431+++ b/src/unix/fsevents.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800432@@ -183,7 +183,7 @@ static void (*pFSEventStreamStop)(FSEventStreamRef);
James Kuszmaulcf324122023-01-14 14:07:17 -0800433 static void uv__fsevents_cb(uv_async_t* cb) {
434 uv_fs_event_t* handle;
435
436- handle = cb->data;
437+ handle = (uv_fs_event_t*)cb->data;
438
439 UV__FSEVENTS_PROCESS(handle, {
440 handle->cb(handle, event->path[0] ? event->path : NULL, event->events, 0);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800441@@ -231,10 +231,10 @@ static void uv__fsevents_event_cb(const FSEventStreamRef streamRef,
James Kuszmaulcf324122023-01-14 14:07:17 -0800442 FSEventStreamEventFlags flags;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800443 struct uv__queue head;
James Kuszmaulcf324122023-01-14 14:07:17 -0800444
445- loop = info;
446- state = loop->cf_state;
447+ loop = (uv_loop_t*)info;
448+ state = (uv__cf_loop_state_t*)loop->cf_state;
449 assert(state != NULL);
450- paths = eventPaths;
451+ paths = (char**)eventPaths;
452
453 /* For each handle */
454 uv_mutex_lock(&state->fsevent_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800455@@ -304,7 +304,7 @@ static void uv__fsevents_event_cb(const FSEventStreamRef streamRef,
James Kuszmaulcf324122023-01-14 14:07:17 -0800456 continue;
457 }
458
459- event = uv__malloc(sizeof(*event) + len);
460+ event = (uv__fsevents_event_t*)uv__malloc(sizeof(*event) + len);
461 if (event == NULL)
462 break;
463
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800464@@ -438,7 +438,7 @@ static void uv__fsevents_reschedule(uv__cf_loop_state_t* state,
James Kuszmaulcf324122023-01-14 14:07:17 -0800465 uv_mutex_lock(&state->fsevent_mutex);
466 path_count = state->fsevent_handle_count;
467 if (path_count != 0) {
468- paths = uv__malloc(sizeof(*paths) * path_count);
469+ paths = (CFStringRef*)uv__malloc(sizeof(*paths) * path_count);
470 if (paths == NULL) {
471 uv_mutex_unlock(&state->fsevent_mutex);
472 goto final;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800473@@ -594,7 +594,7 @@ static int uv__fsevents_loop_init(uv_loop_t* loop) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800474 if (err)
475 return err;
476
477- state = uv__calloc(1, sizeof(*state));
478+ state = (uv__cf_loop_state_t*)uv__calloc(1, sizeof(*state));
479 if (state == NULL)
480 return UV_ENOMEM;
481
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800482@@ -696,7 +696,7 @@ void uv__fsevents_loop_delete(uv_loop_t* loop) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800483 }
484
485 /* Destroy state */
486- state = loop->cf_state;
487+ state = (uv__cf_loop_state_t*)loop->cf_state;
488 uv_sem_destroy(&state->fsevent_sem);
489 uv_mutex_destroy(&state->fsevent_mutex);
490 pCFRelease(state->signal_source);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800491@@ -710,8 +710,8 @@ static void* uv__cf_loop_runner(void* arg) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800492 uv_loop_t* loop;
493 uv__cf_loop_state_t* state;
494
495- loop = arg;
496- state = loop->cf_state;
497+ loop = (uv_loop_t*)arg;
498+ state = (uv__cf_loop_state_t*)loop->cf_state;
499 state->loop = pCFRunLoopGetCurrent();
500
501 pCFRunLoopAddSource(state->loop,
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800502@@ -739,8 +739,8 @@ static void uv__cf_loop_cb(void* arg) {
503 struct uv__queue split_head;
James Kuszmaulcf324122023-01-14 14:07:17 -0800504 uv__cf_loop_signal_t* s;
505
506- loop = arg;
507- state = loop->cf_state;
508+ loop = (uv_loop_t*)arg;
509+ state = (uv__cf_loop_state_t*)loop->cf_state;
510
511 uv_mutex_lock(&loop->cf_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800512 uv__queue_move(&loop->cf_signals, &split_head);
513@@ -770,7 +770,7 @@ int uv__cf_loop_signal(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -0800514 uv__cf_loop_signal_t* item;
515 uv__cf_loop_state_t* state;
516
517- item = uv__malloc(sizeof(*item));
518+ item = (uv__cf_loop_signal_t*)uv__malloc(sizeof(*item));
519 if (item == NULL)
520 return UV_ENOMEM;
521
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800522@@ -780,7 +780,7 @@ int uv__cf_loop_signal(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -0800523 uv_mutex_lock(&loop->cf_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800524 uv__queue_insert_tail(&loop->cf_signals, &item->member);
James Kuszmaulcf324122023-01-14 14:07:17 -0800525
526- state = loop->cf_state;
527+ state = (uv__cf_loop_state_t*)loop->cf_state;
528 assert(state != NULL);
529 pCFRunLoopSourceSignal(state->signal_source);
530 pCFRunLoopWakeUp(state->loop);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800531@@ -814,7 +814,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800532 * Events will occur in other thread.
533 * Initialize callback for getting them back into event loop's thread
534 */
535- handle->cf_cb = uv__malloc(sizeof(*handle->cf_cb));
536+ handle->cf_cb = (uv_async_t*)uv__malloc(sizeof(*handle->cf_cb));
537 if (handle->cf_cb == NULL) {
538 err = UV_ENOMEM;
539 goto fail_cf_cb_malloc;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800540@@ -830,7 +830,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800541 goto fail_cf_mutex_init;
542
543 /* Insert handle into the list */
544- state = handle->loop->cf_state;
545+ state = (uv__cf_loop_state_t*)handle->loop->cf_state;
546 uv_mutex_lock(&state->fsevent_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800547 uv__queue_insert_tail(&state->fsevent_handles, &handle->cf_member);
James Kuszmaulcf324122023-01-14 14:07:17 -0800548 state->fsevent_handle_count++;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800549@@ -870,7 +870,7 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800550 return UV_EINVAL;
551
552 /* Remove handle from the list */
553- state = handle->loop->cf_state;
554+ state = (uv__cf_loop_state_t*)handle->loop->cf_state;
555 uv_mutex_lock(&state->fsevent_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800556 uv__queue_remove(&handle->cf_member);
James Kuszmaulcf324122023-01-14 14:07:17 -0800557 state->fsevent_handle_count--;
558diff --git a/src/unix/getaddrinfo.c b/src/unix/getaddrinfo.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800559index 77337ace9454e032a392c97cb9aa311f15518956..41dc3909969a643e129847ae3a3252d51feadb27 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800560--- a/src/unix/getaddrinfo.c
561+++ b/src/unix/getaddrinfo.c
562@@ -172,7 +172,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
563 hostname_len = hostname ? strlen(hostname) + 1 : 0;
564 service_len = service ? strlen(service) + 1 : 0;
565 hints_len = hints ? sizeof(*hints) : 0;
566- buf = uv__malloc(hostname_len + service_len + hints_len);
567+ buf = (char*)uv__malloc(hostname_len + service_len + hints_len);
568
569 if (buf == NULL)
570 return UV_ENOMEM;
571@@ -190,17 +190,17 @@ int uv_getaddrinfo(uv_loop_t* loop,
572 len = 0;
573
574 if (hints) {
575- req->hints = memcpy(buf + len, hints, sizeof(*hints));
576+ req->hints = (struct addrinfo*)memcpy(buf + len, hints, sizeof(*hints));
577 len += sizeof(*hints);
578 }
579
580 if (service) {
581- req->service = memcpy(buf + len, service, service_len);
582+ req->service = (char*)memcpy(buf + len, service, service_len);
583 len += service_len;
584 }
585
586 if (hostname)
587- req->hostname = memcpy(buf + len, hostname, hostname_len);
588+ req->hostname = (char*)memcpy(buf + len, hostname, hostname_len);
589
590 if (cb) {
591 uv__work_submit(loop,
592diff --git a/src/unix/ibmi.c b/src/unix/ibmi.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800593index 837bba6e2fef7b834a8d104d263bef47eaed0950..5e0fa98d104428534e5264a1c6358e3f68c58b82 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800594--- a/src/unix/ibmi.c
595+++ b/src/unix/ibmi.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800596@@ -293,7 +293,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800597
598 numcpus = sysconf(_SC_NPROCESSORS_ONLN);
599
600- *cpu_infos = uv__malloc(numcpus * sizeof(uv_cpu_info_t));
601+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(uv_cpu_info_t));
602 if (!*cpu_infos) {
603 return UV_ENOMEM;
604 }
605diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c
Maxwell Henderson80bec322024-01-09 15:48:44 -0800606index 94ace58680cf391707f68357d7927173cb1db08e..06fbdb24b4adc4adb781d32150d40836fa745531 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800607--- a/src/unix/kqueue.c
608+++ b/src/unix/kqueue.c
Maxwell Henderson80bec322024-01-09 15:48:44 -0800609@@ -303,8 +303,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800610 nevents = 0;
611
612 assert(loop->watchers != NULL);
613- loop->watchers[loop->nwatchers] = (void*) events;
614- loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
615+ loop->watchers[loop->nwatchers] = (uv__io_t*) events;
616+ loop->watchers[loop->nwatchers + 1] = (uv__io_t*) (uintptr_t) nfds;
617 for (i = 0; i < nfds; i++) {
618 ev = events + i;
619 fd = ev->ident;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800620@@ -326,7 +326,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800621 /* Skip invalidated events, see uv__platform_invalidate_fd */
622 if (fd == -1)
623 continue;
624- w = loop->watchers[fd];
625+ w = (uv__io_t*)loop->watchers[fd];
626
627 if (w == NULL) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800628 /* File descriptor that we've stopped watching, disarm it. */
629diff --git a/src/unix/linux.c b/src/unix/linux.c
Maxwell Henderson80bec322024-01-09 15:48:44 -0800630index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6da258a24 100644
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800631--- a/src/unix/linux.c
632+++ b/src/unix/linux.c
Maxwell Henderson80bec322024-01-09 15:48:44 -0800633@@ -518,8 +518,8 @@ static void uv__iou_init(int epollfd,
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800634 char* sqe;
635 int ringfd;
James Kuszmaulcf324122023-01-14 14:07:17 -0800636
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800637- sq = MAP_FAILED;
638- sqe = MAP_FAILED;
639+ sq = (char*)MAP_FAILED;
640+ sqe = (char*)MAP_FAILED;
James Kuszmaulcf324122023-01-14 14:07:17 -0800641
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800642 if (!uv__use_io_uring())
643 return;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800644@@ -558,14 +558,14 @@ static void uv__iou_init(int epollfd,
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800645 maxlen = sqlen < cqlen ? cqlen : sqlen;
646 sqelen = params.sq_entries * sizeof(struct uv__io_uring_sqe);
James Kuszmaulcf324122023-01-14 14:07:17 -0800647
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800648- sq = mmap(0,
649+ sq = (char*)mmap(0,
650 maxlen,
651 PROT_READ | PROT_WRITE,
652 MAP_SHARED | MAP_POPULATE,
653 ringfd,
654 0); /* IORING_OFF_SQ_RING */
James Kuszmaulcf324122023-01-14 14:07:17 -0800655
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800656- sqe = mmap(0,
657+ sqe = (char*)mmap(0,
658 sqelen,
659 PROT_READ | PROT_WRITE,
660 MAP_SHARED | MAP_POPULATE,
Maxwell Henderson80bec322024-01-09 15:48:44 -0800661@@ -705,7 +705,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800662 int i;
663
664 lfields = uv__get_internal_fields(loop);
665- inv = lfields->inv;
666+ inv = (uv__invalidate*)lfields->inv;
667
668 /* Invalidate events with same file descriptor */
669 if (inv != NULL)
Maxwell Henderson80bec322024-01-09 15:48:44 -0800670@@ -780,7 +780,7 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou,
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800671 return NULL; /* No room in ring buffer. TODO(bnoordhuis) maybe flush it? */
672
673 slot = tail & mask;
674- sqe = iou->sqe;
675+ sqe = (uv__io_uring_sqe*)iou->sqe;
676 sqe = &sqe[slot];
677 memset(sqe, 0, sizeof(*sqe));
678 sqe->user_data = (uintptr_t) req;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800679@@ -1057,7 +1057,7 @@ int uv__iou_fs_statx(uv_loop_t* loop,
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800680 struct uv__statx* statxbuf;
681 struct uv__iou* iou;
682
683- statxbuf = uv__malloc(sizeof(*statxbuf));
684+ statxbuf = (struct uv__statx*)uv__malloc(sizeof(*statxbuf));
685 if (statxbuf == NULL)
686 return 0;
687
Maxwell Henderson80bec322024-01-09 15:48:44 -0800688@@ -1121,7 +1121,7 @@ static void uv__iou_fs_statx_post(uv_fs_t* req) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800689 uv_stat_t* buf;
690
691 buf = &req->statbuf;
692- statxbuf = req->ptr;
693+ statxbuf = (struct uv__statx*)req->ptr;
694 req->ptr = NULL;
695
696 if (req->result == 0) {
Maxwell Henderson80bec322024-01-09 15:48:44 -0800697@@ -1150,7 +1150,7 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800698 tail = atomic_load_explicit((_Atomic uint32_t*) iou->cqtail,
699 memory_order_acquire);
700 mask = iou->cqmask;
701- cqe = iou->cqe;
702+ cqe = (uv__io_uring_cqe*)iou->cqe;
703 nevents = 0;
704
705 for (i = head; i != tail; i++) {
Maxwell Henderson80bec322024-01-09 15:48:44 -0800706@@ -1241,7 +1241,7 @@ static void uv__epoll_ctl_prep(int epollfd,
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800707 pe = &(*events)[slot];
708 *pe = *e;
709
710- sqe = ctl->sqe;
711+ sqe = (uv__io_uring_sqe*)ctl->sqe;
712 sqe = &sqe[slot];
713
714 memset(sqe, 0, sizeof(*sqe));
Maxwell Henderson80bec322024-01-09 15:48:44 -0800715@@ -1297,7 +1297,7 @@ static void uv__epoll_ctl_flush(int epollfd,
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800716 while (*ctl->cqhead != *ctl->cqtail) {
717 slot = (*ctl->cqhead)++ & ctl->cqmask;
718
719- cqe = ctl->cqe;
720+ cqe = (uv__io_uring_cqe*)ctl->cqe;
721 cqe = &cqe[slot];
722
723 if (cqe->res == 0)
Maxwell Henderson80bec322024-01-09 15:48:44 -0800724@@ -1758,7 +1758,7 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800725 snprintf(*models, sizeof(*models), "unknown");
726 maxcpu = 0;
727
728- cpus = uv__calloc(ARRAY_SIZE(*cpus), sizeof(**cpus));
729+ cpus = (decltype(cpus))uv__calloc(ARRAY_SIZE(*cpus), sizeof(**cpus));
730 if (cpus == NULL)
731 return UV_ENOMEM;
732
Maxwell Henderson80bec322024-01-09 15:48:44 -0800733@@ -1816,9 +1816,9 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800734
735 /* arm64: translate CPU part code to model name. */
736 if (*parts) {
737- p = memmem(parts, sizeof(parts) - 1, p, n + 1);
738+ p = (char*)memmem(parts, sizeof(parts) - 1, p, n + 1);
739 if (p == NULL)
740- p = "unknown";
741+ p = const_cast<char*>("unknown");
742 else
743 p += n + 1;
744 n = (int) strcspn(p, "\n");
Maxwell Henderson80bec322024-01-09 15:48:44 -0800745@@ -1868,7 +1868,7 @@ nocpuinfo:
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800746 }
747
748 size = n * sizeof(**ci) + sizeof(models);
749- *ci = uv__malloc(size);
750+ *ci = (uv_cpu_info_t*)uv__malloc(size);
751 *count = 0;
752
753 if (*ci == NULL) {
Maxwell Henderson80bec322024-01-09 15:48:44 -0800754@@ -1877,7 +1877,7 @@ nocpuinfo:
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800755 }
756
757 *count = n;
758- p = memcpy(*ci + n, models, sizeof(models));
759+ p = (char*)memcpy(*ci + n, models, sizeof(models));
760
761 i = 0;
762 for (cpu = 0; cpu < maxcpu; cpu++) {
Maxwell Henderson80bec322024-01-09 15:48:44 -0800763@@ -1886,19 +1886,19 @@ nocpuinfo:
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800764
765 c = *cpus + cpu;
766
767- (*ci)[i++] = (uv_cpu_info_t) {
768+ (*ci)[i++] = uv_cpu_info_t{
769 .model = p + c->model * sizeof(*model),
770- .speed = c->freq / 1000,
771+ .speed = (int)(c->freq / 1000),
772 /* Note: sysconf(_SC_CLK_TCK) is fixed at 100 Hz,
773 * therefore the multiplier is always 1000/100 = 10.
774 */
775- .cpu_times = (struct uv_cpu_times_s) {
776+ .cpu_times = {
777 .user = 10 * c->user,
778 .nice = 10 * c->nice,
779 .sys = 10 * c->sys,
780 .idle = 10 * c->idle,
781 .irq = 10 * c->irq,
782- },
783+ }
784 };
785 }
786
Maxwell Henderson80bec322024-01-09 15:48:44 -0800787@@ -1955,7 +1955,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800788 }
789
790 /* Make sure the memory is initiallized to zero using calloc() */
791- *addresses = uv__calloc(*count, sizeof(**addresses));
792+ *addresses = (uv_interface_address_t*)uv__calloc(*count, sizeof(**addresses));
793 if (!(*addresses)) {
794 freeifaddrs(addrs);
795 return UV_ENOMEM;
Maxwell Henderson80bec322024-01-09 15:48:44 -0800796@@ -2523,12 +2523,12 @@ int uv_fs_event_start(uv_fs_event_t* handle,
James Kuszmaulcf324122023-01-14 14:07:17 -0800797 goto no_insert;
798
799 len = strlen(path) + 1;
800- w = uv__malloc(sizeof(*w) + len);
801+ w = (watcher_list*)uv__malloc(sizeof(*w) + len);
802 if (w == NULL)
803 return UV_ENOMEM;
804
805 w->wd = wd;
806- w->path = memcpy(w + 1, path, len);
807+ w->path = (char*)memcpy(w + 1, path, len);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800808 uv__queue_init(&w->watchers);
James Kuszmaulcf324122023-01-14 14:07:17 -0800809 w->iterating = 0;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800810 RB_INSERT(watcher_root, uv__inotify_watchers(loop), w);
James Kuszmaulcf324122023-01-14 14:07:17 -0800811diff --git a/src/unix/loop.c b/src/unix/loop.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800812index a9468e8e19cbede795032980c47eb83aee1e0c68..3babe4d701949ebc69d74f7dedee33c777d89892 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800813--- a/src/unix/loop.c
814+++ b/src/unix/loop.c
815@@ -148,7 +148,7 @@ int uv_loop_fork(uv_loop_t* loop) {
816
817 /* Rearm all the watchers that aren't re-queued by the above. */
818 for (i = 0; i < loop->nwatchers; i++) {
819- w = loop->watchers[i];
820+ w = (uv__io_t*)loop->watchers[i];
821 if (w == NULL)
822 continue;
823
824diff --git a/src/unix/netbsd.c b/src/unix/netbsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800825index fa21e98e41aec8b7d8bc46c299c4c20a7a0c3f0c..4c6d5a24fe896d89e3b2f1db1dc2b1dd7d010aec 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800826--- a/src/unix/netbsd.c
827+++ b/src/unix/netbsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800828@@ -211,14 +211,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800829 cpuspeed = 0;
830
831 size = numcpus * CPUSTATES * sizeof(*cp_times);
832- cp_times = uv__malloc(size);
833+ cp_times = (u_int64_t*)uv__malloc(size);
834 if (cp_times == NULL)
835 return UV_ENOMEM;
836
837 if (sysctlbyname("kern.cp_time", cp_times, &size, NULL, 0))
838 return UV__ERR(errno);
839
840- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
841+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
842 if (!(*cpu_infos)) {
843 uv__free(cp_times);
844 uv__free(*cpu_infos);
845diff --git a/src/unix/openbsd.c b/src/unix/openbsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800846index 9c863b6c90dad9864cb8341c2b6203c1390a9487..2aa61e2ee3321d91ba84887c7ed6dcfa23d00ccf 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800847--- a/src/unix/openbsd.c
848+++ b/src/unix/openbsd.c
849@@ -72,7 +72,7 @@ int uv_exepath(char* buffer, size_t* size) {
850 mypid = getpid();
851 for (;;) {
852 err = UV_ENOMEM;
853- argsbuf = uv__reallocf(argsbuf, argsbuf_size);
854+ argsbuf = (char**)uv__reallocf(argsbuf, argsbuf_size);
855 if (argsbuf == NULL)
856 goto out;
857 mib[0] = CTL_KERN;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800858@@ -202,7 +202,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800859 if (sysctl(which, ARRAY_SIZE(which), &numcpus, &size, NULL, 0))
860 return UV__ERR(errno);
861
862- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
863+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
864 if (!(*cpu_infos))
865 return UV_ENOMEM;
866
867diff --git a/src/unix/pipe.c b/src/unix/pipe.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800868index d332f3518303d6ef1dee1d835c392bb60b935bad..a60b1a0e442bb3c482575da117f30e9f119f55d3 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800869--- a/src/unix/pipe.c
870+++ b/src/unix/pipe.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800871@@ -377,7 +377,7 @@ int uv_pipe_pending_count(uv_pipe_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800872 if (handle->queued_fds == NULL)
873 return 1;
874
875- queued_fds = handle->queued_fds;
876+ queued_fds = (uv__stream_queued_fds_t*)(handle->queued_fds);
877 return queued_fds->offset + 1;
878 }
879
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800880@@ -414,7 +414,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800881 if (r != UV_ENOBUFS)
882 return r;
883
884- name_buffer = uv__malloc(name_len);
885+ name_buffer = (char*)uv__malloc(name_len);
886 if (name_buffer == NULL)
887 return UV_ENOMEM;
888
889diff --git a/src/unix/poll.c b/src/unix/poll.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800890index 7a12e2d1488a9d48712439e62c6637b9e1161f69..c21722b2e8eef4d16c523f7319fb57c3167d8dd9 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800891--- a/src/unix/poll.c
892+++ b/src/unix/poll.c
893@@ -117,7 +117,7 @@ int uv_poll_stop(uv_poll_t* handle) {
894
895
896 int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
897- uv__io_t** watchers;
898+ void** watchers;
899 uv__io_t* w;
900 int events;
901
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800902@@ -125,7 +125,7 @@ int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
903 UV_PRIORITIZED)) == 0);
904 assert(!uv__is_closing(handle));
905
906- watchers = handle->loop->watchers;
907+ watchers = (void**)handle->loop->watchers;
908 w = &handle->io_watcher;
909
910 if (uv__fd_exists(handle->loop, w->fd))
James Kuszmaulcf324122023-01-14 14:07:17 -0800911diff --git a/src/unix/posix-poll.c b/src/unix/posix-poll.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800912index 2e016c2fbaed2eeccd78080969a86aff821a4251..b71eee3f01a3f30b3b5efef539194139f258009a 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800913--- a/src/unix/posix-poll.c
914+++ b/src/unix/posix-poll.c
915@@ -61,7 +61,7 @@ static void uv__pollfds_maybe_resize(uv_loop_t* loop) {
916 return;
917
918 n = loop->poll_fds_size ? loop->poll_fds_size * 2 : 64;
919- p = uv__reallocf(loop->poll_fds, n * sizeof(*loop->poll_fds));
920+ p = (struct pollfd*)uv__reallocf(loop->poll_fds, n * sizeof(*loop->poll_fds));
921 if (p == NULL)
922 abort();
923
924diff --git a/src/unix/process.c b/src/unix/process.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800925index dd58c18d9b9359fca1a924698c39bd6390dafbe0..2d622c956de6d7b6f8a04be3ecd311f39602b241 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800926--- a/src/unix/process.c
927+++ b/src/unix/process.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800928@@ -423,7 +423,7 @@ static int posix_spawn_can_use_setsid;
James Kuszmaulcf324122023-01-14 14:07:17 -0800929 static void uv__spawn_init_posix_spawn_fncs(void) {
930 /* Try to locate all non-portable functions at runtime */
931 posix_spawn_fncs.file_actions.addchdir_np =
932- dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
933+ (int (*)(void* const*, const char*)) dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
934 }
935
936
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800937@@ -988,7 +988,7 @@ int uv_spawn(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -0800938 err = UV_ENOMEM;
939 pipes = pipes_storage;
940 if (stdio_count > (int) ARRAY_SIZE(pipes_storage))
941- pipes = uv__malloc(stdio_count * sizeof(*pipes));
942+ pipes = (int (*)[2])uv__malloc(stdio_count * sizeof(*pipes));
943
944 if (pipes == NULL)
945 goto error;
946diff --git a/src/unix/proctitle.c b/src/unix/proctitle.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800947index 9d1f00ddf66e291abd40d0c0052a7f9bd5c03017..8cdec753d003ebe16485db2b47ffb3863a9473ff 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800948--- a/src/unix/proctitle.c
949+++ b/src/unix/proctitle.c
950@@ -65,7 +65,7 @@ char** uv_setup_args(int argc, char** argv) {
951 /* Add space for the argv pointers. */
952 size += (argc + 1) * sizeof(char*);
953
954- new_argv = uv__malloc(size);
955+ new_argv = (char**)uv__malloc(size);
956 if (new_argv == NULL)
957 return argv;
958
959diff --git a/src/unix/random-sysctl-linux.c b/src/unix/random-sysctl-linux.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800960index 66ba8d74ec22b72d318b91d82365f5b9693feb3c..9ef18df01a51aa6a26ae6d1d9660a819d18604d0 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800961--- a/src/unix/random-sysctl-linux.c
962+++ b/src/unix/random-sysctl-linux.c
963@@ -48,7 +48,7 @@ int uv__random_sysctl(void* buf, size_t buflen) {
964 char* pe;
965 size_t n;
966
967- p = buf;
968+ p = (char*)buf;
969 pe = p + buflen;
970
971 while (p < pe) {
972diff --git a/src/unix/stream.c b/src/unix/stream.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800973index 28c4d5463c4622725a433b8807e5e7bde580dadd..265ddade7aec129eb9dbf07cde2a16a0e341d1a7 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800974--- a/src/unix/stream.c
975+++ b/src/unix/stream.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800976@@ -123,7 +123,7 @@ static void uv__stream_osx_interrupt_select(uv_stream_t* stream) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800977 uv__stream_select_t* s;
978 int r;
979
980- s = stream->select;
981+ s = (uv__stream_select_t*)stream->select;
982 if (s == NULL)
983 return;
984
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800985@@ -152,8 +152,8 @@ static void uv__stream_osx_select(void* arg) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800986 int r;
987 int max_fd;
988
989- stream = arg;
990- s = stream->select;
991+ stream = (uv_stream_t*)arg;
992+ s = (uv__stream_select_t*)stream->select;
993 fd = s->fd;
994
995 if (fd > s->int_fd)
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800996@@ -330,7 +330,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800997 sread_sz = ROUND_UP(max_fd + 1, sizeof(uint32_t) * NBBY) / NBBY;
998 swrite_sz = sread_sz;
999
1000- s = uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
1001+ s = (uv__stream_select_t*)uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
1002 if (s == NULL) {
1003 err = UV_ENOMEM;
1004 goto failed_malloc;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001005@@ -573,7 +573,7 @@ done:
James Kuszmaulcf324122023-01-14 14:07:17 -08001006 if (server->queued_fds != NULL) {
1007 uv__stream_queued_fds_t* queued_fds;
1008
1009- queued_fds = server->queued_fds;
1010+ queued_fds = (uv__stream_queued_fds_t*)(server->queued_fds);
1011
1012 /* Read first */
1013 server->accepted_fd = queued_fds->fds[0];
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001014@@ -942,11 +942,12 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001015 uv__stream_queued_fds_t* queued_fds;
1016 unsigned int queue_size;
1017
1018- queued_fds = stream->queued_fds;
1019+ queued_fds = (uv__stream_queued_fds_t*)stream->queued_fds;
1020 if (queued_fds == NULL) {
1021 queue_size = 8;
1022- queued_fds = uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
1023- sizeof(*queued_fds));
1024+ queued_fds = (uv__stream_queued_fds_t*)
1025+ uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
1026+ sizeof(*queued_fds));
1027 if (queued_fds == NULL)
1028 return UV_ENOMEM;
1029 queued_fds->size = queue_size;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001030@@ -956,9 +957,9 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001031 /* Grow */
1032 } else if (queued_fds->size == queued_fds->offset) {
1033 queue_size = queued_fds->size + 8;
1034- queued_fds = uv__realloc(queued_fds,
1035- (queue_size - 1) * sizeof(*queued_fds->fds) +
1036- sizeof(*queued_fds));
1037+ queued_fds = (uv__stream_queued_fds_t*)
1038+ uv__realloc(queued_fds, (queue_size - 1) * sizeof(*queued_fds->fds) +
1039+ sizeof(*queued_fds));
1040
1041 /*
1042 * Allocation failure, report back.
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001043@@ -1356,7 +1357,7 @@ int uv_write2(uv_write_t* req,
James Kuszmaulcf324122023-01-14 14:07:17 -08001044
1045 req->bufs = req->bufsml;
1046 if (nbufs > ARRAY_SIZE(req->bufsml))
1047- req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
1048+ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(bufs[0]));
1049
1050 if (req->bufs == NULL)
1051 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001052@@ -1490,7 +1491,7 @@ int uv___stream_fd(const uv_stream_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001053 handle->type == UV_TTY ||
1054 handle->type == UV_NAMED_PIPE);
1055
1056- s = handle->select;
1057+ s = (const uv__stream_select_t*)handle->select;
1058 if (s != NULL)
1059 return s->fd;
1060
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001061@@ -1508,7 +1509,7 @@ void uv__stream_close(uv_stream_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001062 if (handle->select != NULL) {
1063 uv__stream_select_t* s;
1064
1065- s = handle->select;
1066+ s = (uv__stream_select_t*)handle->select;
1067
1068 uv_sem_post(&s->close_sem);
1069 uv_sem_post(&s->async_sem);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001070@@ -1543,7 +1544,7 @@ void uv__stream_close(uv_stream_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001071
1072 /* Close all queued fds */
1073 if (handle->queued_fds != NULL) {
1074- queued_fds = handle->queued_fds;
1075+ queued_fds = (uv__stream_queued_fds_t*)(handle->queued_fds);
1076 for (i = 0; i < queued_fds->offset; i++)
1077 uv__close(queued_fds->fds[i]);
1078 uv__free(handle->queued_fds);
Maxwell Henderson80bec322024-01-09 15:48:44 -08001079diff --git a/src/unix/tcp.c b/src/unix/tcp.c
1080index a6b53e5913271d0c83e1d7f7e4cb8140f5f3936d..4c4213a4241b51d245146f1a37a371448d57b3b8 100644
1081--- a/src/unix/tcp.c
1082+++ b/src/unix/tcp.c
1083@@ -274,7 +274,7 @@ int uv__tcp_connect(uv_connect_t* req,
1084 memcpy(&tmp6, addr, sizeof(tmp6));
1085 if (tmp6.sin6_scope_id == 0) {
1086 tmp6.sin6_scope_id = uv__ipv6_link_local_scope_id();
1087- addr = (void*) &tmp6;
1088+ addr = (const struct sockaddr*) &tmp6;
1089 }
1090 }
1091
James Kuszmaulcf324122023-01-14 14:07:17 -08001092diff --git a/src/unix/thread.c b/src/unix/thread.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001093index f05e6fe0f7dd5ac579f6a9d6f93bffb99e1bcbc2..20409541de3cb300504b823472a73bc95fa38f62 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001094--- a/src/unix/thread.c
1095+++ b/src/unix/thread.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001096@@ -168,8 +168,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
James Kuszmaulcf324122023-01-14 14:07:17 -08001097 abort();
1098 }
1099
1100- f.in = entry;
1101- err = pthread_create(tid, attr, f.out, arg);
1102+ err = pthread_create(tid, attr, (void*(*)(void*)) (void(*)(void)) entry, arg);
1103
1104 if (attr != NULL)
1105 pthread_attr_destroy(attr);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001106@@ -540,7 +539,7 @@ static int uv__custom_sem_init(uv_sem_t* sem_, unsigned int value) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001107 int err;
1108 uv_semaphore_t* sem;
1109
1110- sem = uv__malloc(sizeof(*sem));
1111+ sem = (uv_semaphore_t*)uv__malloc(sizeof(*sem));
1112 if (sem == NULL)
1113 return UV_ENOMEM;
1114
1115diff --git a/src/unix/udp.c b/src/unix/udp.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001116index c2814512a5f507ceb9e764cdb7c6ff3d36e77974..cbee16b22a36b1c82e74f6a81c3811052e9b8482 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001117--- a/src/unix/udp.c
1118+++ b/src/unix/udp.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001119@@ -191,11 +191,11 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001120 if (msgs[k].msg_hdr.msg_flags & MSG_TRUNC)
1121 flags |= UV_UDP_PARTIAL;
1122
1123- chunk_buf = uv_buf_init(iov[k].iov_base, iov[k].iov_len);
1124+ chunk_buf = uv_buf_init((char*) iov[k].iov_base, iov[k].iov_len);
1125 handle->recv_cb(handle,
1126 msgs[k].msg_len,
1127 &chunk_buf,
1128- msgs[k].msg_hdr.msg_name,
1129+ (const sockaddr*) msgs[k].msg_hdr.msg_name,
1130 flags);
1131 }
1132
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001133@@ -245,7 +245,7 @@ static void uv__udp_recvmsg(uv_udp_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001134 memset(&peer, 0, sizeof(peer));
1135 h.msg_name = &peer;
1136 h.msg_namelen = sizeof(peer);
1137- h.msg_iov = (void*) &buf;
1138+ h.msg_iov = (iovec*) &buf;
1139 h.msg_iovlen = 1;
1140
1141 do {
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001142@@ -719,7 +719,7 @@ int uv__udp_send(uv_udp_send_t* req,
James Kuszmaulcf324122023-01-14 14:07:17 -08001143
1144 req->bufs = req->bufsml;
1145 if (nbufs > ARRAY_SIZE(req->bufsml))
1146- req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
1147+ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(bufs[0]));
1148
1149 if (req->bufs == NULL) {
1150 uv__req_unregister(handle->loop, req);
1151diff --git a/src/uv-common.c b/src/uv-common.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001152index 2200fe3f0a41e295acb426f39ccc9f0133994675..69e95801a18104ea910abf86db236d85f62afb66 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001153--- a/src/uv-common.c
1154+++ b/src/uv-common.c
1155@@ -54,10 +54,10 @@ static uv__allocator_t uv__allocator = {
1156
1157 char* uv__strdup(const char* s) {
1158 size_t len = strlen(s) + 1;
1159- char* m = uv__malloc(len);
1160+ char* m = (char*)uv__malloc(len);
1161 if (m == NULL)
1162 return NULL;
1163- return memcpy(m, s, len);
1164+ return (char*)memcpy(m, s, len);
1165 }
1166
1167 char* uv__strndup(const char* s, size_t n) {
1168@@ -65,11 +65,11 @@ char* uv__strndup(const char* s, size_t n) {
1169 size_t len = strlen(s);
1170 if (n < len)
1171 len = n;
1172- m = uv__malloc(len + 1);
1173+ m = (char*)uv__malloc(len + 1);
1174 if (m == NULL)
1175 return NULL;
1176 m[len] = '\0';
1177- return memcpy(m, s, len);
1178+ return (char*)memcpy(m, s, len);
1179 }
1180
1181 void* uv__malloc(size_t size) {
Maxwell Henderson80bec322024-01-09 15:48:44 -08001182@@ -691,7 +691,7 @@ void uv__fs_scandir_cleanup(uv_fs_t* req) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001183 unsigned int n;
James Kuszmaulcf324122023-01-14 14:07:17 -08001184
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001185 if (req->result >= 0) {
1186- dents = req->ptr;
1187+ dents = (uv__dirent_t**)(req->ptr);
1188 nbufs = uv__get_nbufs(req);
James Kuszmaulcf324122023-01-14 14:07:17 -08001189
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001190 i = 0;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001191@@ -724,7 +724,7 @@ int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001192 nbufs = uv__get_nbufs(req);
1193 assert(nbufs);
1194
1195- dents = req->ptr;
1196+ dents = (uv__dirent_t**)(req->ptr);
1197
1198 /* Free previous entity */
1199 if (*nbufs > 0)
Maxwell Henderson80bec322024-01-09 15:48:44 -08001200@@ -789,7 +789,7 @@ void uv__fs_readdir_cleanup(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001201 if (req->ptr == NULL)
1202 return;
1203
1204- dir = req->ptr;
1205+ dir = (uv_dir_t*)req->ptr;
1206 dirents = dir->dirents;
1207 req->ptr = NULL;
1208
Maxwell Henderson80bec322024-01-09 15:48:44 -08001209@@ -835,7 +835,7 @@ uv_loop_t* uv_default_loop(void) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001210 uv_loop_t* uv_loop_new(void) {
1211 uv_loop_t* loop;
1212
1213- loop = uv__malloc(sizeof(*loop));
1214+ loop = (uv_loop_t*)uv__malloc(sizeof(*loop));
1215 if (loop == NULL)
1216 return NULL;
1217
1218diff --git a/src/win/core.c b/src/win/core.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001219index e9885a0f1ff3890a8d957c8793e22b01cedc0e97..87ade7ad65243ee3ff940320f84e1960390300e1 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001220--- a/src/win/core.c
1221+++ b/src/win/core.c
1222@@ -98,7 +98,8 @@ static int uv__loops_add(uv_loop_t* loop) {
1223
1224 if (uv__loops_size == uv__loops_capacity) {
1225 new_capacity = uv__loops_capacity + UV__LOOPS_CHUNK_SIZE;
1226- new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity);
1227+ new_loops = (uv_loop_t**)
1228+ uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity);
1229 if (!new_loops)
1230 goto failed_loops_realloc;
1231 uv__loops = new_loops;
1232@@ -152,7 +153,8 @@ static void uv__loops_remove(uv_loop_t* loop) {
1233 smaller_capacity = uv__loops_capacity / 2;
1234 if (uv__loops_size >= smaller_capacity)
1235 goto loop_removed;
1236- new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity);
1237+ new_loops = (uv_loop_t**)
1238+ uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity);
1239 if (!new_loops)
1240 goto loop_removed;
1241 uv__loops = new_loops;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001242@@ -264,7 +266,7 @@ int uv_loop_init(uv_loop_t* loop) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001243
1244 loop->endgame_handles = NULL;
1245
1246- loop->timer_heap = timer_heap = uv__malloc(sizeof(*timer_heap));
1247+ loop->timer_heap = timer_heap = (heap*)uv__malloc(sizeof(*timer_heap));
1248 if (timer_heap == NULL) {
1249 err = UV_ENOMEM;
1250 goto fail_timers_alloc;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001251diff --git a/src/win/dl.c b/src/win/dl.c
1252index 7880c9595be1f66ea0dcbdbcc4a91ce40577587f..d88400f0e819d74998e13f60f13c67a606dec398 100644
1253--- a/src/win/dl.c
1254+++ b/src/win/dl.c
1255@@ -37,7 +37,7 @@ int uv_dlopen(const char* filename, uv_lib_t* lib) {
1256 return uv__dlerror(lib, filename, ERROR_NO_UNICODE_TRANSLATION);
1257 if ((size_t) r > ARRAY_SIZE(filename_w))
1258 return uv__dlerror(lib, filename, ERROR_INSUFFICIENT_BUFFER);
1259- uv_wtf8_to_utf16(filename, filename_w, r);
1260+ uv_wtf8_to_utf16(filename, (uint16_t*)filename_w, r);
1261
1262 lib->handle = LoadLibraryExW(filename_w, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
1263 if (lib->handle == NULL) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001264diff --git a/src/win/fs-event.c b/src/win/fs-event.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001265index 4a0ca1f70a22b6342e208124838d6ecf3173f1a8..5a07acfe54efe90cf2ab0bca5b5998a961e72ebd 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001266--- a/src/win/fs-event.c
1267+++ b/src/win/fs-event.c
1268@@ -73,7 +73,7 @@ static void uv__relative_path(const WCHAR* filename,
1269 if (dirlen > 0 && dir[dirlen - 1] == '\\')
1270 dirlen--;
1271 relpathlen = filenamelen - dirlen - 1;
1272- *relpath = uv__malloc((relpathlen + 1) * sizeof(WCHAR));
1273+ *relpath = (WCHAR*)uv__malloc((relpathlen + 1) * sizeof(WCHAR));
1274 if (!*relpath)
1275 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1276 wcsncpy(*relpath, filename + dirlen + 1, relpathlen);
Maxwell Henderson80bec322024-01-09 15:48:44 -08001277@@ -229,7 +229,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
James Kuszmaulcf324122023-01-14 14:07:17 -08001278 if (short_path_buffer_len == 0) {
1279 goto short_path_done;
1280 }
1281- short_path_buffer = uv__malloc(short_path_buffer_len * sizeof(WCHAR));
1282+ short_path_buffer = (WCHAR*)uv__malloc(short_path_buffer_len * sizeof(WCHAR));
1283 if (short_path_buffer == NULL) {
1284 goto short_path_done;
1285 }
1286diff --git a/src/win/fs-fd-hash-inl.h b/src/win/fs-fd-hash-inl.h
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001287index 0b532af12d4371c2311bd50a66913287a0716f43..703a8d8f87de1089ac8b18bd817d416d48dc442e 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001288--- a/src/win/fs-fd-hash-inl.h
1289+++ b/src/win/fs-fd-hash-inl.h
1290@@ -146,7 +146,7 @@ INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) {
1291
1292 if (bucket_ptr->size != 0 && i == 0) {
1293 struct uv__fd_hash_entry_group_s* new_group_ptr =
1294- uv__malloc(sizeof(*new_group_ptr));
1295+ (struct uv__fd_hash_entry_group_s*)uv__malloc(sizeof(*new_group_ptr));
1296 if (new_group_ptr == NULL) {
1297 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1298 }
1299diff --git a/src/win/fs.c b/src/win/fs.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001300index 99c8a2bf8bf1244f0db7114c1eaa8bff22564996..d9c2a4f728c7fb491995c6153b2a63a835b206b7 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001301--- a/src/win/fs.c
1302+++ b/src/win/fs.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001303@@ -280,7 +280,7 @@ INLINE static int fs__readlink_handle(HANDLE handle,
1304 }
1305
1306 assert(target_ptr == NULL || *target_ptr == NULL);
1307- return uv_utf16_to_wtf8(w_target, w_target_len, target_ptr, target_len_ptr);
1308+ return uv_utf16_to_wtf8((const uint16_t*)w_target, w_target_len, target_ptr, target_len_ptr);
1309 }
1310
1311
1312@@ -323,7 +323,7 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
James Kuszmaulcf324122023-01-14 14:07:17 -08001313 return 0;
1314 }
1315
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001316- buf = uv__malloc(buf_sz);
Maxwell Henderson80bec322024-01-09 15:48:44 -08001317+ buf = (WCHAR*)uv__malloc(buf_sz);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001318 if (buf == NULL) {
1319 return ERROR_OUTOFMEMORY;
1320 }
Maxwell Henderson80bec322024-01-09 15:48:44 -08001321@@ -331,7 +331,7 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
1322 pos = buf;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001323
Maxwell Henderson80bec322024-01-09 15:48:44 -08001324 if (path != NULL) {
1325- uv_wtf8_to_utf16(path, pos, pathw_len);
1326+ uv_wtf8_to_utf16(path, (uint16_t*)pos, pathw_len);
1327 req->file.pathw = pos;
1328 pos += pathw_len;
1329 } else {
1330@@ -339,7 +339,7 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
1331 }
1332
1333 if (new_path != NULL) {
1334- uv_wtf8_to_utf16(new_path, pos, new_pathw_len);
1335+ uv_wtf8_to_utf16(new_path, (uint16_t*)pos, new_pathw_len);
1336 req->fs.info.new_pathw = pos;
1337 pos += new_pathw_len;
1338 } else {
1339@@ -1390,13 +1390,13 @@ void fs__scandir(uv_fs_t* req) {
1340 continue;
1341
1342 /* Compute the space required to store the filename as WTF-8. */
1343- wtf8_len = uv_utf16_length_as_wtf8(&info->FileName[0], wchar_len);
1344+ wtf8_len = uv_utf16_length_as_wtf8((const uint16_t*)&info->FileName[0], wchar_len);
1345
1346 /* Resize the dirent array if needed. */
James Kuszmaulcf324122023-01-14 14:07:17 -08001347 if (dirents_used >= dirents_size) {
1348 size_t new_dirents_size =
1349 dirents_size == 0 ? dirents_initial_size : dirents_size << 1;
1350- uv__dirent_t** new_dirents =
1351+ uv__dirent_t** new_dirents = (uv__dirent_t**)
1352 uv__realloc(dirents, new_dirents_size * sizeof *dirents);
1353
1354 if (new_dirents == NULL)
Maxwell Henderson80bec322024-01-09 15:48:44 -08001355@@ -1410,7 +1410,7 @@ void fs__scandir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001356 * includes room for the first character of the filename, but `utf8_len`
1357 * doesn't count the NULL terminator at this point.
1358 */
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001359- dirent = uv__malloc(sizeof *dirent + wtf8_len);
1360+ dirent = (uv__dirent_t*)uv__malloc(sizeof *dirent + wtf8_len);
James Kuszmaulcf324122023-01-14 14:07:17 -08001361 if (dirent == NULL)
1362 goto out_of_memory_error;
1363
Maxwell Henderson80bec322024-01-09 15:48:44 -08001364@@ -1418,7 +1418,7 @@ void fs__scandir(uv_fs_t* req) {
1365
1366 /* Convert file name to UTF-8. */
1367 wtf8 = &dirent->d_name[0];
1368- if (uv_utf16_to_wtf8(&info->FileName[0], wchar_len, &wtf8, &wtf8_len) != 0)
1369+ if (uv_utf16_to_wtf8((const uint16_t*)&info->FileName[0], wchar_len, &wtf8, &wtf8_len) != 0)
1370 goto out_of_memory_error;
1371
1372 /* Fill out the type field. */
1373@@ -1512,7 +1512,7 @@ void fs__opendir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001374 goto error;
1375 }
1376
1377- dir = uv__malloc(sizeof(*dir));
1378+ dir = (uv_dir_t*)uv__malloc(sizeof(*dir));
1379 if (dir == NULL) {
1380 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1381 goto error;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001382@@ -1527,7 +1527,7 @@ void fs__opendir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001383 else
1384 fmt = L"%s\\*";
1385
1386- find_path = uv__malloc(sizeof(WCHAR) * (len + 4));
1387+ find_path = (WCHAR*)uv__malloc(sizeof(WCHAR) * (len + 4));
1388 if (find_path == NULL) {
1389 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1390 goto error;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001391@@ -1564,7 +1564,7 @@ void fs__readdir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001392 int r;
1393
1394 req->flags |= UV_FS_FREE_PTR;
1395- dir = req->ptr;
1396+ dir = (uv_dir_t*)req->ptr;
1397 dirents = dir->dirents;
1398 memset(dirents, 0, dir->nentries * sizeof(*dir->dirents));
1399 find_data = &dir->find_data;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001400@@ -1621,7 +1621,7 @@ error:
James Kuszmaulcf324122023-01-14 14:07:17 -08001401 void fs__closedir(uv_fs_t* req) {
1402 uv_dir_t* dir;
1403
1404- dir = req->ptr;
1405+ dir = (uv_dir_t*)req->ptr;
1406 FindClose(dir->dir_handle);
1407 uv__free(req->ptr);
1408 SET_REQ_RESULT(req, 0);
Maxwell Henderson80bec322024-01-09 15:48:44 -08001409@@ -2612,7 +2612,7 @@ static ssize_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001410 return -1;
1411 }
1412
1413- w_realpath_buf = uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
1414+ w_realpath_buf = (WCHAR*)uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
1415 if (w_realpath_buf == NULL) {
1416 SetLastError(ERROR_OUTOFMEMORY);
1417 return -1;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001418@@ -2645,7 +2645,7 @@ static ssize_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) {
1419 }
1420
1421 assert(*realpath_ptr == NULL);
1422- r = uv_utf16_to_wtf8(w_realpath_ptr, w_realpath_len, realpath_ptr, NULL);
1423+ r = uv_utf16_to_wtf8((const uint16_t*)w_realpath_ptr, w_realpath_len, realpath_ptr, NULL);
1424 uv__free(w_realpath_buf);
1425 return r;
1426 }
1427@@ -2725,7 +2725,7 @@ retry_get_disk_free_space:
James Kuszmaulcf324122023-01-14 14:07:17 -08001428 }
1429
1430 len = MAX_PATH + 1;
1431- pathw = uv__malloc(len * sizeof(*pathw));
1432+ pathw = (WCHAR*)uv__malloc(len * sizeof(*pathw));
1433 if (pathw == NULL) {
1434 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1435 return;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001436@@ -2741,7 +2741,7 @@ retry_get_full_path_name:
James Kuszmaulcf324122023-01-14 14:07:17 -08001437 return;
1438 } else if (ret > len) {
1439 len = ret;
1440- pathw = uv__reallocf(pathw, len * sizeof(*pathw));
1441+ pathw = (WCHAR*)uv__reallocf(pathw, len * sizeof(*pathw));
1442 if (pathw == NULL) {
1443 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1444 return;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001445@@ -2757,7 +2757,7 @@ retry_get_full_path_name:
James Kuszmaulcf324122023-01-14 14:07:17 -08001446 uv__free(pathw);
1447 }
1448
1449- stat_fs = uv__malloc(sizeof(*stat_fs));
1450+ stat_fs = (uv_statfs_t*)uv__malloc(sizeof(*stat_fs));
1451 if (stat_fs == NULL) {
1452 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1453 return;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001454@@ -2916,7 +2916,7 @@ int uv_fs_read(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -08001455 req->fs.info.nbufs = nbufs;
1456 req->fs.info.bufs = req->fs.info.bufsml;
1457 if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
1458- req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
1459+ req->fs.info.bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
1460
1461 if (req->fs.info.bufs == NULL) {
1462 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
Maxwell Henderson80bec322024-01-09 15:48:44 -08001463@@ -2949,7 +2949,7 @@ int uv_fs_write(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -08001464 req->fs.info.nbufs = nbufs;
1465 req->fs.info.bufs = req->fs.info.bufsml;
1466 if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
1467- req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
1468+ req->fs.info.bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
1469
1470 if (req->fs.info.bufs == NULL) {
1471 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
Maxwell Henderson80bec322024-01-09 15:48:44 -08001472diff --git a/src/win/getaddrinfo.c b/src/win/getaddrinfo.c
1473index 8b8406ada8e7434e291b2e50caf4ed7f36613fa0..5bc63d8e19411b967a2acf5c24b34b9b17323ccc 100644
1474--- a/src/win/getaddrinfo.c
1475+++ b/src/win/getaddrinfo.c
1476@@ -132,7 +132,7 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) {
1477 addrinfo_len += addrinfo_struct_len +
1478 ALIGNED_SIZE(addrinfow_ptr->ai_addrlen);
1479 if (addrinfow_ptr->ai_canonname != NULL) {
1480- name_len = uv_utf16_length_as_wtf8(addrinfow_ptr->ai_canonname, -1);
1481+ name_len = uv_utf16_length_as_wtf8((const uint16_t*)addrinfow_ptr->ai_canonname, -1);
1482 if (name_len < 0) {
1483 req->retcode = name_len;
1484 goto complete;
1485@@ -281,9 +281,9 @@ int uv_getaddrinfo(uv_loop_t* loop,
1486 }
1487
1488 /* allocate memory for inputs, and partition it as needed */
1489- alloc_ptr = uv__malloc(ALIGNED_SIZE(nodesize * sizeof(WCHAR)) +
1490- ALIGNED_SIZE(servicesize * sizeof(WCHAR)) +
1491- hintssize);
1492+ alloc_ptr = (char*)uv__malloc(ALIGNED_SIZE(nodesize * sizeof(WCHAR)) +
1493+ ALIGNED_SIZE(servicesize * sizeof(WCHAR)) +
1494+ hintssize);
1495 if (!alloc_ptr)
1496 return UV_ENOMEM;
1497
1498@@ -294,7 +294,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
1499 * request. The node here has been converted to ascii. */
1500 if (node != NULL) {
1501 req->node = (WCHAR*) alloc_ptr;
1502- uv_wtf8_to_utf16(node, (WCHAR*) alloc_ptr, nodesize);
1503+ uv_wtf8_to_utf16(node, (uint16_t*) alloc_ptr, nodesize);
1504 alloc_ptr += ALIGNED_SIZE(nodesize * sizeof(WCHAR));
1505 } else {
1506 req->node = NULL;
1507@@ -304,7 +304,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
1508 * the req. */
1509 if (service != NULL) {
1510 req->service = (WCHAR*) alloc_ptr;
1511- uv_wtf8_to_utf16(service, (WCHAR*) alloc_ptr, servicesize);
1512+ uv_wtf8_to_utf16(service, (uint16_t*) alloc_ptr, servicesize);
1513 alloc_ptr += ALIGNED_SIZE(servicesize * sizeof(WCHAR));
1514 } else {
1515 req->service = NULL;
James Kuszmaulcf324122023-01-14 14:07:17 -08001516diff --git a/src/win/pipe.c b/src/win/pipe.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001517index cec72ff750b5a17e139fd85080ccbdfc3c71d8c0..0f045a873073cf9b07feb457ea199990df521e5f 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001518--- a/src/win/pipe.c
1519+++ b/src/win/pipe.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001520@@ -899,7 +899,7 @@ int uv_pipe_connect2(uv_connect_t* req,
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001521 if (pipeHandle == INVALID_HANDLE_VALUE) {
1522 if (GetLastError() == ERROR_PIPE_BUSY) {
Maxwell Henderson80bec322024-01-09 15:48:44 -08001523 nameSize = (wcslen(handle->name) + 1) * sizeof(WCHAR);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001524- req->u.connect.name = uv__malloc(nameSize);
1525+ req->u.connect.name = (WCHAR *)uv__malloc(nameSize);
1526 if (!req->u.connect.name) {
1527 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1528 }
Maxwell Henderson80bec322024-01-09 15:48:44 -08001529@@ -1503,7 +1503,7 @@ static int uv__build_coalesced_write_req(uv_write_t* user_req,
James Kuszmaulcf324122023-01-14 14:07:17 -08001530 data_length; /* (c) */
1531
1532 /* Allocate buffer. */
1533- heap_buffer = uv__malloc(heap_buffer_length);
1534+ heap_buffer = (char*)uv__malloc(heap_buffer_length);
1535 if (heap_buffer == NULL)
1536 return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */
1537
Maxwell Henderson80bec322024-01-09 15:48:44 -08001538@@ -1752,7 +1752,7 @@ int uv__pipe_write_ipc(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -08001539 bufs = stack_bufs;
1540 } else {
1541 /* Use heap-allocated buffer array. */
1542- bufs = uv__calloc(buf_count, sizeof(uv_buf_t));
1543+ bufs = (uv_buf_t*)uv__calloc(buf_count, sizeof(uv_buf_t));
1544 if (bufs == NULL)
1545 return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */
1546 }
Maxwell Henderson80bec322024-01-09 15:48:44 -08001547@@ -2449,7 +2449,7 @@ static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size)
James Kuszmaulcf324122023-01-14 14:07:17 -08001548 FileNameInformation);
1549 if (nt_status == STATUS_BUFFER_OVERFLOW) {
1550 name_size = sizeof(*name_info) + tmp_name_info.FileNameLength;
1551- name_info = uv__malloc(name_size);
1552+ name_info = (FILE_NAME_INFORMATION*)uv__malloc(name_size);
1553 if (!name_info) {
1554 *size = 0;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001555 return UV_ENOMEM;
James Kuszmaulcf324122023-01-14 14:07:17 -08001556diff --git a/src/win/process.c b/src/win/process.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001557index 119b46cb3f37122395c172c6e9700d472a2173ed..0103004c565bb09b7b9c150e874f9c68486ab26c 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001558--- a/src/win/process.c
1559+++ b/src/win/process.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001560@@ -543,14 +543,14 @@ int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) {
1561 dst_len = dst_len * 2 + arg_count * 2;
1562
1563 /* Allocate buffer for the final command line. */
1564- dst = uv__malloc(dst_len * sizeof(WCHAR));
1565+ dst = (WCHAR*)uv__malloc(dst_len * sizeof(WCHAR));
1566 if (dst == NULL) {
1567 err = UV_ENOMEM;
1568 goto error;
1569 }
1570
1571 /* Allocate temporary working buffer. */
1572- temp_buffer = uv__malloc(temp_buffer_len * sizeof(WCHAR));
1573+ temp_buffer = (WCHAR*)uv__malloc(temp_buffer_len * sizeof(WCHAR));
1574 if (temp_buffer == NULL) {
1575 err = UV_ENOMEM;
1576 goto error;
1577@@ -564,7 +564,7 @@ int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) {
1578 arg_len = uv_wtf8_length_as_utf16(*arg);
1579 assert(arg_len > 0);
1580 assert(temp_buffer_len >= (size_t) arg_len);
1581- uv_wtf8_to_utf16(*arg, temp_buffer, arg_len);
1582+ uv_wtf8_to_utf16(*arg, (uint16_t*)temp_buffer, arg_len);
1583
1584 if (verbatim_arguments) {
1585 /* Copy verbatim. */
1586@@ -592,8 +592,8 @@ error:
James Kuszmaulcf324122023-01-14 14:07:17 -08001587
1588
1589 int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
1590- wchar_t* a_eq;
1591- wchar_t* b_eq;
1592+ const wchar_t* a_eq;
1593+ const wchar_t* b_eq;
1594 wchar_t* A;
1595 wchar_t* B;
1596 int nb;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001597@@ -610,8 +610,8 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001598 assert(b_eq);
1599 nb = b_eq - b;
1600
1601- A = alloca((na+1) * sizeof(wchar_t));
1602- B = alloca((nb+1) * sizeof(wchar_t));
1603+ A = (wchar_t*)alloca((na+1) * sizeof(wchar_t));
1604+ B = (wchar_t*)alloca((nb+1) * sizeof(wchar_t));
1605
1606 r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, a, na, A, na);
1607 assert(r==na);
Maxwell Henderson80bec322024-01-09 15:48:44 -08001608@@ -684,11 +684,11 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
1609 }
1610
1611 /* second pass: copy to UTF-16 environment block */
1612- dst_copy = uv__malloc(env_len * sizeof(WCHAR));
1613+ dst_copy = (WCHAR*)uv__malloc(env_len * sizeof(WCHAR));
James Kuszmaulcf324122023-01-14 14:07:17 -08001614 if (dst_copy == NULL && env_len > 0) {
Maxwell Henderson80bec322024-01-09 15:48:44 -08001615 return UV_ENOMEM;
James Kuszmaulcf324122023-01-14 14:07:17 -08001616 }
1617- env_copy = alloca(env_block_count * sizeof(WCHAR*));
1618+ env_copy = (WCHAR**)alloca(env_block_count * sizeof(WCHAR*));
1619
1620 ptr = dst_copy;
1621 ptr_copy = env_copy;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001622@@ -698,7 +698,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
1623 len = uv_wtf8_length_as_utf16(*env);
1624 assert(len > 0);
1625 assert((size_t) len <= env_len - (ptr - dst_copy));
1626- uv_wtf8_to_utf16(*env, ptr, len);
1627+ uv_wtf8_to_utf16(*env, (uint16_t*)ptr, len);
1628 *ptr_copy++ = ptr;
1629 ptr += len;
1630 }
1631@@ -736,7 +736,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001632 }
1633
1634 /* final pass: copy, in sort order, and inserting required variables */
1635- dst = uv__malloc((1+env_len) * sizeof(WCHAR));
1636+ dst = (WCHAR*)uv__malloc((1+env_len) * sizeof(WCHAR));
1637 if (!dst) {
1638 uv__free(dst_copy);
Maxwell Henderson80bec322024-01-09 15:48:44 -08001639 return UV_ENOMEM;
James Kuszmaulcf324122023-01-14 14:07:17 -08001640diff --git a/src/win/tcp.c b/src/win/tcp.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001641index 187f36e2a61c870b0d16e17e9d4a9e1161ba8851..d8da4d941a51b0625fc0c072342ec4edf74c0ea3 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001642--- a/src/win/tcp.c
1643+++ b/src/win/tcp.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001644@@ -585,7 +585,7 @@ int uv__tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001645
1646 if (handle->tcp.serv.accept_reqs == NULL) {
1647 handle->tcp.serv.accept_reqs =
1648- uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
1649+ (uv_tcp_accept_t*)uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
1650 if (!handle->tcp.serv.accept_reqs) {
1651 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1652 }
1653diff --git a/src/win/thread.c b/src/win/thread.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001654index 57c25e8f5a861c9d8a4c402c260d3ac235200423..57f1698f595e2410a51044f7f228b5a235206819 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001655--- a/src/win/thread.c
1656+++ b/src/win/thread.c
1657@@ -98,7 +98,7 @@ static UINT __stdcall uv__thread_start(void* arg) {
1658 struct thread_ctx *ctx_p;
1659 struct thread_ctx ctx;
1660
1661- ctx_p = arg;
1662+ ctx_p = (struct thread_ctx*)arg;
1663 ctx = *ctx_p;
1664 uv__free(ctx_p);
1665
1666@@ -141,7 +141,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
1667 return UV_EINVAL;
1668 }
1669
1670- ctx = uv__malloc(sizeof(*ctx));
1671+ ctx = (struct thread_ctx*)uv__malloc(sizeof(*ctx));
1672 if (ctx == NULL)
1673 return UV_ENOMEM;
1674
Maxwell Henderson80bec322024-01-09 15:48:44 -08001675diff --git a/src/win/tty.c b/src/win/tty.c
1676index ac836930d6f3a185d57ba59fb42c817496aa0fdf..3aacaaf0b514ba71755dc51f1bd7263de5cbc308 100644
1677--- a/src/win/tty.c
1678+++ b/src/win/tty.c
1679@@ -528,7 +528,7 @@ static DWORD CALLBACK uv_tty_line_read_thread(void* data) {
1680
1681 if (read_console_success) {
1682 read_bytes = bytes;
1683- uv_utf16_to_wtf8(utf16,
1684+ uv_utf16_to_wtf8((const uint16_t*)utf16,
1685 read_chars,
1686 &handle->tty.rd.read_line_buffer.base,
1687 &read_bytes);
1688@@ -827,7 +827,7 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle,
1689 WCHAR utf16_buffer[2];
1690 utf16_buffer[0] = handle->tty.rd.last_utf16_high_surrogate;
1691 utf16_buffer[1] = KEV.uChar.UnicodeChar;
1692- if (uv_utf16_to_wtf8(utf16_buffer,
1693+ if (uv_utf16_to_wtf8((const uint16_t*)utf16_buffer,
1694 2,
1695 &last_key_buf,
1696 &char_len))
1697@@ -835,7 +835,7 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle,
1698 handle->tty.rd.last_utf16_high_surrogate = 0;
1699 } else {
1700 /* Single UTF-16 character */
1701- if (uv_utf16_to_wtf8(&KEV.uChar.UnicodeChar,
1702+ if (uv_utf16_to_wtf8((const uint16_t*)&KEV.uChar.UnicodeChar,
1703 1,
1704 &last_key_buf,
1705 &char_len))
James Kuszmaulcf324122023-01-14 14:07:17 -08001706diff --git a/src/win/util.c b/src/win/util.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001707index 91d88a54fb24a613df45d7915c345b6764dd6ffd..5fbc70f52952f90b36fb22ee03ec7f70e6ed5954 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001708--- a/src/win/util.c
1709+++ b/src/win/util.c
Maxwell Henderson80bec322024-01-09 15:48:44 -08001710@@ -124,7 +124,7 @@ int uv_exepath(char* buffer, size_t* size_ptr) {
1711
1712 /* Convert to UTF-8 */
1713 utf8_len = *size_ptr - 1; /* Reserve space for NUL */
1714- err = uv_utf16_to_wtf8(utf16_buffer, utf16_len, &buffer, &utf8_len);
1715+ err = uv_utf16_to_wtf8((const uint16_t*)utf16_buffer, utf16_len, &buffer, &utf8_len);
1716 if (err == UV_ENOBUFS) {
1717 utf8_len = *size_ptr - 1;
1718 err = 0;
1719@@ -152,7 +152,7 @@ static int uv__cwd(WCHAR** buf, DWORD *len) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001720 return uv_translate_sys_error(GetLastError());
1721
1722 /* |t| is the size of the buffer _including_ nul. */
1723- p = uv__malloc(t * sizeof(*p));
1724+ p = (WCHAR *)uv__malloc(t * sizeof(*p));
1725 if (p == NULL)
1726 return UV_ENOMEM;
1727
Maxwell Henderson80bec322024-01-09 15:48:44 -08001728@@ -548,14 +548,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001729 GetSystemInfo(&system_info);
1730 cpu_count = system_info.dwNumberOfProcessors;
1731
1732- cpu_infos = uv__calloc(cpu_count, sizeof *cpu_infos);
1733+ cpu_infos = (uv_cpu_info_t*)uv__calloc(cpu_count, sizeof *cpu_infos);
1734 if (cpu_infos == NULL) {
1735 err = ERROR_OUTOFMEMORY;
1736 goto error;
1737 }
1738
1739 sppi_size = cpu_count * sizeof(*sppi);
1740- sppi = uv__malloc(sppi_size);
1741+ sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*)uv__malloc(sppi_size);
1742 if (sppi == NULL) {
1743 err = ERROR_OUTOFMEMORY;
1744 goto error;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001745@@ -699,7 +699,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
James Kuszmaulcf324122023-01-14 14:07:17 -08001746 case ERROR_BUFFER_OVERFLOW:
1747 /* This happens when win_address_buf is NULL or too small to hold all
1748 * adapters. */
1749- win_address_buf = uv__malloc(win_address_buf_size);
1750+ win_address_buf =
1751+ (IP_ADAPTER_ADDRESSES*)uv__malloc(win_address_buf_size);
1752 if (win_address_buf == NULL)
1753 return UV_ENOMEM;
1754
Maxwell Henderson80bec322024-01-09 15:48:44 -08001755@@ -707,7 +708,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
James Kuszmaulcf324122023-01-14 14:07:17 -08001756
1757 case ERROR_NO_DATA: {
1758 /* No adapters were found. */
1759- uv_address_buf = uv__malloc(1);
1760+ uv_address_buf = (uv_interface_address_t*)uv__malloc(1);
1761 if (uv_address_buf == NULL)
1762 return UV_ENOMEM;
1763
Maxwell Henderson80bec322024-01-09 15:48:44 -08001764@@ -758,7 +759,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
1765 continue;
1766
1767 /* Compute the size of the interface name. */
1768- name_size = uv_utf16_length_as_wtf8(adapter->FriendlyName, -1);
1769+ name_size = uv_utf16_length_as_wtf8((const uint16_t*)adapter->FriendlyName, -1);
1770 uv_address_buf_size += name_size + 1;
1771
1772 /* Count the number of addresses associated with this interface, and
1773@@ -773,7 +774,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
James Kuszmaulcf324122023-01-14 14:07:17 -08001774 }
1775
1776 /* Allocate space to store interface data plus adapter names. */
1777- uv_address_buf = uv__malloc(uv_address_buf_size);
1778+ uv_address_buf = (uv_interface_address_t*)uv__malloc(uv_address_buf_size);
1779 if (uv_address_buf == NULL) {
1780 uv__free(win_address_buf);
1781 return UV_ENOMEM;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001782@@ -982,7 +983,7 @@ int uv_os_tmpdir(char* buffer, size_t* size) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001783 }
1784 /* Include space for terminating null char. */
1785 len += 1;
1786- path = uv__malloc(len * sizeof(wchar_t));
1787+ path = (wchar_t*)uv__malloc(len * sizeof(wchar_t));
1788 if (path == NULL) {
1789 return UV_ENOMEM;
1790 }
Maxwell Henderson80bec322024-01-09 15:48:44 -08001791@@ -1019,7 +1020,7 @@ int uv__convert_utf16_to_utf8(const WCHAR* utf16, size_t utf16len, char** utf8)
1792 return UV_EINVAL;
James Kuszmaulcf324122023-01-14 14:07:17 -08001793
Maxwell Henderson80bec322024-01-09 15:48:44 -08001794 *utf8 = NULL;
1795- return uv_utf16_to_wtf8(utf16, utf16len, utf8, &utf8_len);
1796+ return uv_utf16_to_wtf8((const uint16_t*)utf16, utf16len, utf8, &utf8_len);
1797 }
1798
1799
1800@@ -1039,13 +1040,13 @@ int uv__convert_utf8_to_utf16(const char* utf8, WCHAR** utf16) {
1801 return UV__EINVAL;
1802
1803 /* Allocate the destination buffer. */
1804- *utf16 = uv__malloc(sizeof(WCHAR) * bufsize);
1805+ *utf16 = (WCHAR*)uv__malloc(sizeof(WCHAR) * bufsize);
James Kuszmaulcf324122023-01-14 14:07:17 -08001806
1807 if (*utf16 == NULL)
1808 return UV_ENOMEM;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001809
1810 /* Convert to UTF-16 */
1811- uv_wtf8_to_utf16(utf8, *utf16, bufsize);
1812+ uv_wtf8_to_utf16(utf8, (uint16_t*)*utf16, bufsize);
1813
1814 return 0;
1815 }
1816@@ -1065,11 +1066,11 @@ int uv__copy_utf16_to_utf8(const WCHAR* utf16buffer, size_t utf16len, char* utf8
1817 return UV_EINVAL;
1818
1819 if (*size == 0) {
1820- *size = uv_utf16_length_as_wtf8(utf16buffer, utf16len);
1821+ *size = uv_utf16_length_as_wtf8((const uint16_t*)utf16buffer, utf16len);
1822 r = UV_ENOBUFS;
1823 } else {
1824 *size -= 1; /* Reserve space for NUL. */
1825- r = uv_utf16_to_wtf8(utf16buffer, utf16len, &utf8, size);
1826+ r = uv_utf16_to_wtf8((const uint16_t*)utf16buffer, utf16len, &utf8, size);
1827 }
1828 if (r == UV_ENOBUFS)
1829 *size += 1; /* Add space for NUL. */
1830@@ -1099,7 +1100,7 @@ static int uv__getpwuid_r(uv_passwd_t* pwd) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001831 return uv_translate_sys_error(r);
1832 }
1833
1834- path = uv__malloc(bufsize * sizeof(wchar_t));
1835+ path = (wchar_t*)uv__malloc(bufsize * sizeof(wchar_t));
1836 if (path == NULL) {
1837 CloseHandle(token);
1838 return UV_ENOMEM;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001839@@ -1180,7 +1181,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001840
1841 for (penv = env, i = 0; *penv != L'\0'; penv += wcslen(penv) + 1, i++);
1842
1843- *envitems = uv__calloc(i, sizeof(**envitems));
1844+ *envitems = (uv_env_item_t*)uv__calloc(i, sizeof(**envitems));
1845 if (*envitems == NULL) {
1846 FreeEnvironmentStringsW(env);
1847 return UV_ENOMEM;
Maxwell Henderson80bec322024-01-09 15:48:44 -08001848@@ -1269,7 +1270,7 @@ int uv_os_getenv(const char* name, char* buffer, size_t* size) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001849 uv__free(var);
1850
1851 varlen = 1 + len;
1852- var = uv__malloc(varlen * sizeof(*var));
1853+ var = (wchar_t*)uv__malloc(varlen * sizeof(*var));
1854
1855 if (var == NULL) {
1856 r = UV_ENOMEM;