blob: 4d9603f86299d4a74d9fb28fcb1b8042a34addfa [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
James Kuszmaulb13e13f2023-11-22 20:44:04 -08004Subject: [PATCH 02/10] 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 ++++----
8 src/inet.c | 11 ++++----
James Kuszmaulcf324122023-01-14 14:07:17 -08009 src/strscpy.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080010 src/thread-common.c | 2 +-
James Kuszmaulcf324122023-01-14 14:07:17 -080011 src/threadpool.c | 2 +-
12 src/unix/bsd-ifaddrs.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080013 src/unix/core.c | 18 ++++++-------
14 src/unix/darwin-proctitle.c | 5 ++--
James Kuszmaulcf324122023-01-14 14:07:17 -080015 src/unix/darwin.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080016 src/unix/freebsd.c | 4 +--
17 src/unix/fs.c | 20 +++++++--------
18 src/unix/fsevents.c | 34 ++++++++++++-------------
19 src/unix/getaddrinfo.c | 8 +++---
James Kuszmaulcf324122023-01-14 14:07:17 -080020 src/unix/ibmi.c | 2 +-
21 src/unix/kqueue.c | 6 ++---
James Kuszmaulb13e13f2023-11-22 20:44:04 -080022 src/unix/linux.c | 46 +++++++++++++++++-----------------
James Kuszmaulcf324122023-01-14 14:07:17 -080023 src/unix/loop.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080024 src/unix/netbsd.c | 4 +--
25 src/unix/openbsd.c | 4 +--
26 src/unix/pipe.c | 4 +--
27 src/unix/poll.c | 4 +--
James Kuszmaulcf324122023-01-14 14:07:17 -080028 src/unix/posix-poll.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080029 src/unix/process.c | 4 +--
James Kuszmaulcf324122023-01-14 14:07:17 -080030 src/unix/proctitle.c | 2 +-
31 src/unix/random-sysctl-linux.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080032 src/unix/stream.c | 31 ++++++++++++-----------
33 src/unix/thread.c | 5 ++--
34 src/unix/udp.c | 8 +++---
35 src/uv-common.c | 16 ++++++------
36 src/win/core.c | 8 +++---
37 src/win/fs-event.c | 4 +--
James Kuszmaulcf324122023-01-14 14:07:17 -080038 src/win/fs-fd-hash-inl.h | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080039 src/win/fs.c | 28 ++++++++++-----------
40 src/win/pipe.c | 12 ++++-----
41 src/win/process.c | 12 ++++-----
James Kuszmaulcf324122023-01-14 14:07:17 -080042 src/win/tcp.c | 2 +-
James Kuszmaulb13e13f2023-11-22 20:44:04 -080043 src/win/thread.c | 4 +--
44 src/win/util.c | 27 ++++++++++----------
45 38 files changed, 183 insertions(+), 178 deletions(-)
James Kuszmaulcf324122023-01-14 14:07:17 -080046
James Kuszmaulcf324122023-01-14 14:07:17 -080047diff --git a/src/fs-poll.c b/src/fs-poll.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -080048index 1bac1c568e36cadd0b68451926c6f045f88342d2..5a39daed095502b2db34f23fcaf0ab04f31f96ff 100644
James Kuszmaulcf324122023-01-14 14:07:17 -080049--- a/src/fs-poll.c
50+++ b/src/fs-poll.c
51@@ -77,7 +77,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
52
53 loop = handle->loop;
54 len = strlen(path);
55- ctx = uv__calloc(1, sizeof(*ctx) + len);
56+ ctx = (struct poll_ctx*)uv__calloc(1, sizeof(*ctx) + len);
57
58 if (ctx == NULL)
59 return UV_ENOMEM;
60@@ -101,7 +101,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
61 goto error;
62
63 if (handle->poll_ctx != NULL)
64- ctx->previous = handle->poll_ctx;
65+ ctx->previous = (struct poll_ctx*)handle->poll_ctx;
66 handle->poll_ctx = ctx;
67 uv__handle_start(handle);
68
69@@ -119,7 +119,7 @@ int uv_fs_poll_stop(uv_fs_poll_t* handle) {
70 if (!uv_is_active((uv_handle_t*)handle))
71 return 0;
72
73- ctx = handle->poll_ctx;
74+ ctx = (struct poll_ctx*)handle->poll_ctx;
75 assert(ctx != NULL);
76 assert(ctx->parent_handle == handle);
77
78@@ -144,7 +144,7 @@ int uv_fs_poll_getpath(uv_fs_poll_t* handle, char* buffer, size_t* size) {
79 return UV_EINVAL;
80 }
81
82- ctx = handle->poll_ctx;
83+ ctx = (struct poll_ctx*)handle->poll_ctx;
84 assert(ctx != NULL);
85
86 required_len = strlen(ctx->path);
87@@ -244,7 +244,7 @@ static void timer_close_cb(uv_handle_t* timer) {
88 if (handle->poll_ctx == NULL && uv__is_closing(handle))
89 uv__make_close_pending((uv_handle_t*)handle);
90 } else {
91- for (last = handle->poll_ctx, it = last->previous;
92+ for (last = (struct poll_ctx*)handle->poll_ctx, it = last->previous;
93 it != ctx;
94 last = it, it = it->previous) {
95 assert(last->previous != NULL);
96diff --git a/src/inet.c b/src/inet.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -080097index cd77496846e90e8b8e61c63c10f498f153344fe5..dd94bea3886ca37945fcad7909d765e3700e3c21 100644
James Kuszmaulcf324122023-01-14 14:07:17 -080098--- a/src/inet.c
99+++ b/src/inet.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800100@@ -35,9 +35,9 @@ static int inet_pton6(const char *src, unsigned char *dst);
James Kuszmaulcf324122023-01-14 14:07:17 -0800101 int uv_inet_ntop(int af, const void* src, char* dst, size_t size) {
102 switch (af) {
103 case AF_INET:
104- return (inet_ntop4(src, dst, size));
105+ return (inet_ntop4((const unsigned char*)src, dst, size));
106 case AF_INET6:
107- return (inet_ntop6(src, dst, size));
108+ return (inet_ntop6((const unsigned char*)src, dst, size));
109 default:
110 return UV_EAFNOSUPPORT;
111 }
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800112@@ -149,10 +149,11 @@ int uv_inet_pton(int af, const char* src, void* dst) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800113
114 switch (af) {
115 case AF_INET:
116- return (inet_pton4(src, dst));
117+ return (inet_pton4(src, (unsigned char*)dst));
118 case AF_INET6: {
119 int len;
120- char tmp[UV__INET6_ADDRSTRLEN], *s, *p;
121+ char tmp[UV__INET6_ADDRSTRLEN], *s;
122+ const char *p;
123 s = (char*) src;
124 p = strchr(src, '%');
125 if (p != NULL) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800126@@ -163,7 +164,7 @@ int uv_inet_pton(int af, const char* src, void* dst) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800127 memcpy(s, src, len);
128 s[len] = '\0';
129 }
130- return inet_pton6(s, dst);
131+ return inet_pton6(s, (unsigned char*)dst);
132 }
133 default:
134 return UV_EAFNOSUPPORT;
135diff --git a/src/strscpy.c b/src/strscpy.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800136index 20df6fcbed29e9d944c866ddbcd5c09345a426b3..6b4cc3bc741b40b9c2b13d4c06e7090f8083a7ba 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800137--- a/src/strscpy.c
138+++ b/src/strscpy.c
139@@ -27,7 +27,7 @@ ssize_t uv__strscpy(char* d, const char* s, size_t n) {
140
141 for (i = 0; i < n; i++)
142 if ('\0' == (d[i] = s[i]))
143- return i > SSIZE_MAX ? UV_E2BIG : (ssize_t) i;
144+ return i > SSIZE_MAX ? (ssize_t) UV_E2BIG : (ssize_t) i;
145
146 if (i == 0)
147 return 0;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800148diff --git a/src/thread-common.c b/src/thread-common.c
149index c67c0a7dd7279af6c67b7d5d4a623c47bdf3fff2..c0e39b543df229dd8cb8492bb695e61e40911453 100644
150--- a/src/thread-common.c
151+++ b/src/thread-common.c
152@@ -49,7 +49,7 @@ int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
153 if (barrier == NULL || count == 0)
154 return UV_EINVAL;
155
156- b = uv__malloc(sizeof(*b));
157+ b = (struct _uv_barrier *)uv__malloc(sizeof(*b));
158 if (b == NULL)
159 return UV_ENOMEM;
160 #endif
James Kuszmaulcf324122023-01-14 14:07:17 -0800161diff --git a/src/threadpool.c b/src/threadpool.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800162index dbef67f2f10f1df498f228c21eba2a71ceceee29..f572de5aaf1a1b150e58c7b989949441cac279c4 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800163--- a/src/threadpool.c
164+++ b/src/threadpool.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800165@@ -207,7 +207,7 @@ static void init_threads(void) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800166
167 threads = default_threads;
168 if (nthreads > ARRAY_SIZE(default_threads)) {
169- threads = uv__malloc(nthreads * sizeof(threads[0]));
170+ threads = (uv_thread_t*)uv__malloc(nthreads * sizeof(threads[0]));
171 if (threads == NULL) {
172 nthreads = ARRAY_SIZE(default_threads);
173 threads = default_threads;
174diff --git a/src/unix/bsd-ifaddrs.c b/src/unix/bsd-ifaddrs.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800175index 11ca95591fc38244e931fecd9dd4038d3968af7a..c3dd71a1889bfae08cfdf95acda61e6c3472bd2c 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800176--- a/src/unix/bsd-ifaddrs.c
177+++ b/src/unix/bsd-ifaddrs.c
178@@ -92,7 +92,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
179 }
180
181 /* Make sure the memory is initiallized to zero using calloc() */
182- *addresses = uv__calloc(*count, sizeof(**addresses));
183+ *addresses = (uv_interface_address_t*)uv__calloc(*count, sizeof(**addresses));
184
185 if (*addresses == NULL) {
186 freeifaddrs(addrs);
187diff --git a/src/unix/core.c b/src/unix/core.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800188index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f128c5a573c 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800189--- a/src/unix/core.c
190+++ b/src/unix/core.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800191@@ -855,7 +855,7 @@ static unsigned int next_power_of_two(unsigned int val) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800192 }
193
194 static void maybe_resize(uv_loop_t* loop, unsigned int len) {
195- uv__io_t** watchers;
196+ void** watchers;
197 void* fake_watcher_list;
198 void* fake_watcher_count;
199 unsigned int nwatchers;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800200@@ -874,8 +874,8 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800201 }
202
203 nwatchers = next_power_of_two(len + 2) - 2;
204- watchers = uv__reallocf(loop->watchers,
205- (nwatchers + 2) * sizeof(loop->watchers[0]));
206+ watchers = (void**)
207+ uv__reallocf(loop->watchers, (nwatchers + 2) * sizeof(loop->watchers[0]));
208
209 if (watchers == NULL)
210 abort();
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800211@@ -884,7 +884,7 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
212 watchers[nwatchers] = fake_watcher_list;
213 watchers[nwatchers + 1] = fake_watcher_count;
214
215- loop->watchers = watchers;
216+ loop->watchers = (uv__io_t**)watchers;
217 loop->nwatchers = nwatchers;
218 }
219
220@@ -1216,7 +1216,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800221 * is frequently 1024 or 4096, so we can just use that directly. The pwent
222 * will not usually be large. */
223 for (bufsize = 2000;; bufsize *= 2) {
224- buf = uv__malloc(bufsize);
225+ buf = (char*)uv__malloc(bufsize);
226
227 if (buf == NULL)
228 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800229@@ -1242,7 +1242,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800230 name_size = strlen(pw.pw_name) + 1;
231 homedir_size = strlen(pw.pw_dir) + 1;
232 shell_size = strlen(pw.pw_shell) + 1;
233- pwd->username = uv__malloc(name_size + homedir_size + shell_size);
234+ pwd->username = (char*)uv__malloc(name_size + homedir_size + shell_size);
235
236 if (pwd->username == NULL) {
237 uv__free(buf);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800238@@ -1292,7 +1292,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) {
239 * 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;
247@@ -1323,7 +1323,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) {
248 members++;
249 }
250
251- gr_mem = uv__malloc(name_size + mem_size);
252+ gr_mem = (char*)uv__malloc(name_size + mem_size);
253 if (gr_mem == NULL) {
254 uv__free(buf);
255 return UV_ENOMEM;
256@@ -1380,7 +1380,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800257
258 for (i = 0; environ[i] != NULL; i++);
259
260- *envitems = uv__calloc(i, sizeof(**envitems));
261+ *envitems = (uv_env_item_s*)uv__calloc(i, sizeof(**envitems));
262
263 if (*envitems == NULL)
264 return UV_ENOMEM;
265diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800266index 5288083ef04fd78d90c34071cc76281adbc310d8..9bd55dd764b845cf8ea441d525b4e136699eb52e 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800267--- a/src/unix/darwin-proctitle.c
268+++ b/src/unix/darwin-proctitle.c
269@@ -128,8 +128,9 @@ int uv__set_process_title(const char* title) {
270 if (pLSSetApplicationInformationItem == NULL)
271 goto out;
272
273- display_name_key = pCFBundleGetDataPointerForName(launch_services_bundle,
274- S("_kLSDisplayNameKey"));
275+ display_name_key = (CFStringRef*)
276+ pCFBundleGetDataPointerForName(launch_services_bundle,
277+ S("_kLSDisplayNameKey"));
278
279 if (display_name_key == NULL || *display_name_key == NULL)
280 goto out;
281diff --git a/src/unix/darwin.c b/src/unix/darwin.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800282index 90790d701c4327518d17230c5aa69b9a74112e73..9ee5cd8eb9d02fb8b71986c47fe8a686f0983847 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800283--- a/src/unix/darwin.c
284+++ b/src/unix/darwin.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800285@@ -217,7 +217,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800286 return UV_EINVAL; /* FIXME(bnoordhuis) Translate error. */
287 }
288
289- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
290+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
291 if (!(*cpu_infos)) {
292 vm_deallocate(mach_task_self(), (vm_address_t)info, msg_type);
293 return UV_ENOMEM;
James Kuszmaulcf324122023-01-14 14:07:17 -0800294diff --git a/src/unix/freebsd.c b/src/unix/freebsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800295index 191bc8bc213ffddb15c5e04baa66e2a0a8d69a3d..1bd63886b823be6451ac013d94e29885795375b7 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800296--- a/src/unix/freebsd.c
297+++ b/src/unix/freebsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800298@@ -220,7 +220,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800299 if (sysctlbyname("hw.ncpu", &numcpus, &size, NULL, 0))
300 return UV__ERR(errno);
301
302- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
303+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
304 if (!(*cpu_infos))
305 return UV_ENOMEM;
306
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800307@@ -237,7 +237,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800308
309 size = maxcpus * CPUSTATES * sizeof(long);
310
311- cp_times = uv__malloc(size);
312+ cp_times = (long*)uv__malloc(size);
313 if (cp_times == NULL) {
314 uv__free(*cpu_infos);
315 return UV_ENOMEM;
316diff --git a/src/unix/fs.c b/src/unix/fs.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800317index 6b051c124f2fd9b0f72b41d7d7ba9c715e9686e1..e25d02e54dbe93e4b9c22b0140108c99ae2cb4f7 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800318--- a/src/unix/fs.c
319+++ b/src/unix/fs.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800320@@ -140,7 +140,7 @@ extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */
James Kuszmaulcf324122023-01-14 14:07:17 -0800321 size_t new_path_len; \
322 path_len = strlen(path) + 1; \
323 new_path_len = strlen(new_path) + 1; \
324- req->path = uv__malloc(path_len + new_path_len); \
325+ req->path = (char*)uv__malloc(path_len + new_path_len); \
326 if (req->path == NULL) \
327 return UV_ENOMEM; \
328 req->new_path = req->path + path_len; \
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800329@@ -568,7 +568,7 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800330 static int uv__fs_opendir(uv_fs_t* req) {
331 uv_dir_t* dir;
332
333- dir = uv__malloc(sizeof(*dir));
334+ dir = (uv_dir_t*)uv__malloc(sizeof(*dir));
335 if (dir == NULL)
336 goto error;
337
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800338@@ -592,7 +592,7 @@ static int uv__fs_readdir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800339 unsigned int dirent_idx;
340 unsigned int i;
341
342- dir = req->ptr;
343+ dir = (uv_dir_t*)req->ptr;
344 dirent_idx = 0;
345
346 while (dirent_idx < dir->nentries) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800347@@ -634,7 +634,7 @@ error:
James Kuszmaulcf324122023-01-14 14:07:17 -0800348 static int uv__fs_closedir(uv_fs_t* req) {
349 uv_dir_t* dir;
350
351- dir = req->ptr;
352+ dir = (uv_dir_t*)req->ptr;
353
354 if (dir->dir != NULL) {
355 closedir(dir->dir);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800356@@ -663,7 +663,7 @@ static int uv__fs_statfs(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800357 #endif /* defined(__sun) */
358 return -1;
359
360- stat_fs = uv__malloc(sizeof(*stat_fs));
361+ stat_fs = (uv_statfs_t*)uv__malloc(sizeof(*stat_fs));
362 if (stat_fs == NULL) {
363 errno = ENOMEM;
364 return -1;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800365@@ -727,7 +727,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800366 maxlen = uv__fs_pathmax_size(req->path);
367 #endif
368
369- buf = uv__malloc(maxlen);
370+ buf = (char*)uv__malloc(maxlen);
371
372 if (buf == NULL) {
373 errno = ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800374@@ -747,7 +747,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800375
376 /* Uncommon case: resize to make room for the trailing nul byte. */
377 if (len == maxlen) {
378- buf = uv__reallocf(buf, len + 1);
379+ buf = (char*)uv__reallocf(buf, len + 1);
380
381 if (buf == NULL)
382 return -1;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800383@@ -770,7 +770,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800384 ssize_t len;
385
386 len = uv__fs_pathmax_size(req->path);
387- buf = uv__malloc(len + 1);
388+ buf = (char*)uv__malloc(len + 1);
389
390 if (buf == NULL) {
391 errno = ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800392@@ -1984,7 +1984,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req,
James Kuszmaulcf324122023-01-14 14:07:17 -0800393 req->nbufs = nbufs;
394 req->bufs = req->bufsml;
395 if (nbufs > ARRAY_SIZE(req->bufsml))
396- req->bufs = uv__malloc(nbufs * sizeof(*bufs));
397+ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
398
399 if (req->bufs == NULL)
400 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800401@@ -2171,7 +2171,7 @@ int uv_fs_write(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -0800402 req->nbufs = nbufs;
403 req->bufs = req->bufsml;
404 if (nbufs > ARRAY_SIZE(req->bufsml))
405- req->bufs = uv__malloc(nbufs * sizeof(*bufs));
406+ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
407
408 if (req->bufs == NULL)
409 return UV_ENOMEM;
410diff --git a/src/unix/fsevents.c b/src/unix/fsevents.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800411index df703f3635fc95bab21debc9697dba06a2a44827..c31d08ba37cfd10672ab6a7a8fd38a1c79b952fe 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800412--- a/src/unix/fsevents.c
413+++ b/src/unix/fsevents.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800414@@ -183,7 +183,7 @@ static void (*pFSEventStreamStop)(FSEventStreamRef);
James Kuszmaulcf324122023-01-14 14:07:17 -0800415 static void uv__fsevents_cb(uv_async_t* cb) {
416 uv_fs_event_t* handle;
417
418- handle = cb->data;
419+ handle = (uv_fs_event_t*)cb->data;
420
421 UV__FSEVENTS_PROCESS(handle, {
422 handle->cb(handle, event->path[0] ? event->path : NULL, event->events, 0);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800423@@ -231,10 +231,10 @@ static void uv__fsevents_event_cb(const FSEventStreamRef streamRef,
James Kuszmaulcf324122023-01-14 14:07:17 -0800424 FSEventStreamEventFlags flags;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800425 struct uv__queue head;
James Kuszmaulcf324122023-01-14 14:07:17 -0800426
427- loop = info;
428- state = loop->cf_state;
429+ loop = (uv_loop_t*)info;
430+ state = (uv__cf_loop_state_t*)loop->cf_state;
431 assert(state != NULL);
432- paths = eventPaths;
433+ paths = (char**)eventPaths;
434
435 /* For each handle */
436 uv_mutex_lock(&state->fsevent_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800437@@ -304,7 +304,7 @@ static void uv__fsevents_event_cb(const FSEventStreamRef streamRef,
James Kuszmaulcf324122023-01-14 14:07:17 -0800438 continue;
439 }
440
441- event = uv__malloc(sizeof(*event) + len);
442+ event = (uv__fsevents_event_t*)uv__malloc(sizeof(*event) + len);
443 if (event == NULL)
444 break;
445
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800446@@ -438,7 +438,7 @@ static void uv__fsevents_reschedule(uv__cf_loop_state_t* state,
James Kuszmaulcf324122023-01-14 14:07:17 -0800447 uv_mutex_lock(&state->fsevent_mutex);
448 path_count = state->fsevent_handle_count;
449 if (path_count != 0) {
450- paths = uv__malloc(sizeof(*paths) * path_count);
451+ paths = (CFStringRef*)uv__malloc(sizeof(*paths) * path_count);
452 if (paths == NULL) {
453 uv_mutex_unlock(&state->fsevent_mutex);
454 goto final;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800455@@ -594,7 +594,7 @@ static int uv__fsevents_loop_init(uv_loop_t* loop) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800456 if (err)
457 return err;
458
459- state = uv__calloc(1, sizeof(*state));
460+ state = (uv__cf_loop_state_t*)uv__calloc(1, sizeof(*state));
461 if (state == NULL)
462 return UV_ENOMEM;
463
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800464@@ -696,7 +696,7 @@ void uv__fsevents_loop_delete(uv_loop_t* loop) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800465 }
466
467 /* Destroy state */
468- state = loop->cf_state;
469+ state = (uv__cf_loop_state_t*)loop->cf_state;
470 uv_sem_destroy(&state->fsevent_sem);
471 uv_mutex_destroy(&state->fsevent_mutex);
472 pCFRelease(state->signal_source);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800473@@ -710,8 +710,8 @@ static void* uv__cf_loop_runner(void* arg) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800474 uv_loop_t* loop;
475 uv__cf_loop_state_t* state;
476
477- loop = arg;
478- state = loop->cf_state;
479+ loop = (uv_loop_t*)arg;
480+ state = (uv__cf_loop_state_t*)loop->cf_state;
481 state->loop = pCFRunLoopGetCurrent();
482
483 pCFRunLoopAddSource(state->loop,
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800484@@ -739,8 +739,8 @@ static void uv__cf_loop_cb(void* arg) {
485 struct uv__queue split_head;
James Kuszmaulcf324122023-01-14 14:07:17 -0800486 uv__cf_loop_signal_t* s;
487
488- loop = arg;
489- state = loop->cf_state;
490+ loop = (uv_loop_t*)arg;
491+ state = (uv__cf_loop_state_t*)loop->cf_state;
492
493 uv_mutex_lock(&loop->cf_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800494 uv__queue_move(&loop->cf_signals, &split_head);
495@@ -770,7 +770,7 @@ int uv__cf_loop_signal(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -0800496 uv__cf_loop_signal_t* item;
497 uv__cf_loop_state_t* state;
498
499- item = uv__malloc(sizeof(*item));
500+ item = (uv__cf_loop_signal_t*)uv__malloc(sizeof(*item));
501 if (item == NULL)
502 return UV_ENOMEM;
503
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800504@@ -780,7 +780,7 @@ int uv__cf_loop_signal(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -0800505 uv_mutex_lock(&loop->cf_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800506 uv__queue_insert_tail(&loop->cf_signals, &item->member);
James Kuszmaulcf324122023-01-14 14:07:17 -0800507
508- state = loop->cf_state;
509+ state = (uv__cf_loop_state_t*)loop->cf_state;
510 assert(state != NULL);
511 pCFRunLoopSourceSignal(state->signal_source);
512 pCFRunLoopWakeUp(state->loop);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800513@@ -814,7 +814,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800514 * Events will occur in other thread.
515 * Initialize callback for getting them back into event loop's thread
516 */
517- handle->cf_cb = uv__malloc(sizeof(*handle->cf_cb));
518+ handle->cf_cb = (uv_async_t*)uv__malloc(sizeof(*handle->cf_cb));
519 if (handle->cf_cb == NULL) {
520 err = UV_ENOMEM;
521 goto fail_cf_cb_malloc;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800522@@ -830,7 +830,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800523 goto fail_cf_mutex_init;
524
525 /* Insert handle into the list */
526- state = handle->loop->cf_state;
527+ state = (uv__cf_loop_state_t*)handle->loop->cf_state;
528 uv_mutex_lock(&state->fsevent_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800529 uv__queue_insert_tail(&state->fsevent_handles, &handle->cf_member);
James Kuszmaulcf324122023-01-14 14:07:17 -0800530 state->fsevent_handle_count++;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800531@@ -870,7 +870,7 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800532 return UV_EINVAL;
533
534 /* Remove handle from the list */
535- state = handle->loop->cf_state;
536+ state = (uv__cf_loop_state_t*)handle->loop->cf_state;
537 uv_mutex_lock(&state->fsevent_mutex);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800538 uv__queue_remove(&handle->cf_member);
James Kuszmaulcf324122023-01-14 14:07:17 -0800539 state->fsevent_handle_count--;
540diff --git a/src/unix/getaddrinfo.c b/src/unix/getaddrinfo.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800541index 77337ace9454e032a392c97cb9aa311f15518956..41dc3909969a643e129847ae3a3252d51feadb27 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800542--- a/src/unix/getaddrinfo.c
543+++ b/src/unix/getaddrinfo.c
544@@ -172,7 +172,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
545 hostname_len = hostname ? strlen(hostname) + 1 : 0;
546 service_len = service ? strlen(service) + 1 : 0;
547 hints_len = hints ? sizeof(*hints) : 0;
548- buf = uv__malloc(hostname_len + service_len + hints_len);
549+ buf = (char*)uv__malloc(hostname_len + service_len + hints_len);
550
551 if (buf == NULL)
552 return UV_ENOMEM;
553@@ -190,17 +190,17 @@ int uv_getaddrinfo(uv_loop_t* loop,
554 len = 0;
555
556 if (hints) {
557- req->hints = memcpy(buf + len, hints, sizeof(*hints));
558+ req->hints = (struct addrinfo*)memcpy(buf + len, hints, sizeof(*hints));
559 len += sizeof(*hints);
560 }
561
562 if (service) {
563- req->service = memcpy(buf + len, service, service_len);
564+ req->service = (char*)memcpy(buf + len, service, service_len);
565 len += service_len;
566 }
567
568 if (hostname)
569- req->hostname = memcpy(buf + len, hostname, hostname_len);
570+ req->hostname = (char*)memcpy(buf + len, hostname, hostname_len);
571
572 if (cb) {
573 uv__work_submit(loop,
574diff --git a/src/unix/ibmi.c b/src/unix/ibmi.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800575index 837bba6e2fef7b834a8d104d263bef47eaed0950..5e0fa98d104428534e5264a1c6358e3f68c58b82 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800576--- a/src/unix/ibmi.c
577+++ b/src/unix/ibmi.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800578@@ -293,7 +293,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800579
580 numcpus = sysconf(_SC_NPROCESSORS_ONLN);
581
582- *cpu_infos = uv__malloc(numcpus * sizeof(uv_cpu_info_t));
583+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(uv_cpu_info_t));
584 if (!*cpu_infos) {
585 return UV_ENOMEM;
586 }
587diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800588index b78242d3be4e3cf6b7b998f56dc65213982d4bc7..28e55aae6c613576ede7024a5c73d746e134d865 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800589--- a/src/unix/kqueue.c
590+++ b/src/unix/kqueue.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800591@@ -299,8 +299,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800592 nevents = 0;
593
594 assert(loop->watchers != NULL);
595- loop->watchers[loop->nwatchers] = (void*) events;
596- loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
597+ loop->watchers[loop->nwatchers] = (uv__io_t*) events;
598+ loop->watchers[loop->nwatchers + 1] = (uv__io_t*) (uintptr_t) nfds;
599 for (i = 0; i < nfds; i++) {
600 ev = events + i;
601 fd = ev->ident;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800602@@ -322,7 +322,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800603 /* Skip invalidated events, see uv__platform_invalidate_fd */
604 if (fd == -1)
605 continue;
606- w = loop->watchers[fd];
607+ w = (uv__io_t*)loop->watchers[fd];
608
609 if (w == NULL) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800610 /* File descriptor that we've stopped watching, disarm it. */
611diff --git a/src/unix/linux.c b/src/unix/linux.c
612index 48b9c2c43e104079d3ccb5d830d1d79f891fb1a3..9173850bd158eaf9c41deca38f9ba84762a027a1 100644
613--- a/src/unix/linux.c
614+++ b/src/unix/linux.c
615@@ -456,8 +456,8 @@ static void uv__iou_init(int epollfd,
616 char* sqe;
617 int ringfd;
James Kuszmaulcf324122023-01-14 14:07:17 -0800618
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800619- sq = MAP_FAILED;
620- sqe = MAP_FAILED;
621+ sq = (char*)MAP_FAILED;
622+ sqe = (char*)MAP_FAILED;
James Kuszmaulcf324122023-01-14 14:07:17 -0800623
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800624 if (!uv__use_io_uring())
625 return;
626@@ -496,14 +496,14 @@ static void uv__iou_init(int epollfd,
627 maxlen = sqlen < cqlen ? cqlen : sqlen;
628 sqelen = params.sq_entries * sizeof(struct uv__io_uring_sqe);
James Kuszmaulcf324122023-01-14 14:07:17 -0800629
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800630- sq = mmap(0,
631+ sq = (char*)mmap(0,
632 maxlen,
633 PROT_READ | PROT_WRITE,
634 MAP_SHARED | MAP_POPULATE,
635 ringfd,
636 0); /* IORING_OFF_SQ_RING */
James Kuszmaulcf324122023-01-14 14:07:17 -0800637
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800638- sqe = mmap(0,
639+ sqe = (char*)mmap(0,
640 sqelen,
641 PROT_READ | PROT_WRITE,
642 MAP_SHARED | MAP_POPULATE,
643@@ -643,7 +643,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
644 int i;
645
646 lfields = uv__get_internal_fields(loop);
647- inv = lfields->inv;
648+ inv = (uv__invalidate*)lfields->inv;
649
650 /* Invalidate events with same file descriptor */
651 if (inv != NULL)
652@@ -718,7 +718,7 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou,
653 return NULL; /* No room in ring buffer. TODO(bnoordhuis) maybe flush it? */
654
655 slot = tail & mask;
656- sqe = iou->sqe;
657+ sqe = (uv__io_uring_sqe*)iou->sqe;
658 sqe = &sqe[slot];
659 memset(sqe, 0, sizeof(*sqe));
660 sqe->user_data = (uintptr_t) req;
661@@ -986,7 +986,7 @@ int uv__iou_fs_statx(uv_loop_t* loop,
662 struct uv__statx* statxbuf;
663 struct uv__iou* iou;
664
665- statxbuf = uv__malloc(sizeof(*statxbuf));
666+ statxbuf = (struct uv__statx*)uv__malloc(sizeof(*statxbuf));
667 if (statxbuf == NULL)
668 return 0;
669
670@@ -1050,7 +1050,7 @@ static void uv__iou_fs_statx_post(uv_fs_t* req) {
671 uv_stat_t* buf;
672
673 buf = &req->statbuf;
674- statxbuf = req->ptr;
675+ statxbuf = (struct uv__statx*)req->ptr;
676 req->ptr = NULL;
677
678 if (req->result == 0) {
679@@ -1079,7 +1079,7 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) {
680 tail = atomic_load_explicit((_Atomic uint32_t*) iou->cqtail,
681 memory_order_acquire);
682 mask = iou->cqmask;
683- cqe = iou->cqe;
684+ cqe = (uv__io_uring_cqe*)iou->cqe;
685 nevents = 0;
686
687 for (i = head; i != tail; i++) {
688@@ -1170,7 +1170,7 @@ static void uv__epoll_ctl_prep(int epollfd,
689 pe = &(*events)[slot];
690 *pe = *e;
691
692- sqe = ctl->sqe;
693+ sqe = (uv__io_uring_sqe*)ctl->sqe;
694 sqe = &sqe[slot];
695
696 memset(sqe, 0, sizeof(*sqe));
697@@ -1226,7 +1226,7 @@ static void uv__epoll_ctl_flush(int epollfd,
698 while (*ctl->cqhead != *ctl->cqtail) {
699 slot = (*ctl->cqhead)++ & ctl->cqmask;
700
701- cqe = ctl->cqe;
702+ cqe = (uv__io_uring_cqe*)ctl->cqe;
703 cqe = &cqe[slot];
704
705 if (cqe->res == 0)
706@@ -1708,7 +1708,7 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) {
707 snprintf(*models, sizeof(*models), "unknown");
708 maxcpu = 0;
709
710- cpus = uv__calloc(ARRAY_SIZE(*cpus), sizeof(**cpus));
711+ cpus = (decltype(cpus))uv__calloc(ARRAY_SIZE(*cpus), sizeof(**cpus));
712 if (cpus == NULL)
713 return UV_ENOMEM;
714
715@@ -1764,9 +1764,9 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) {
716
717 /* arm64: translate CPU part code to model name. */
718 if (*parts) {
719- p = memmem(parts, sizeof(parts) - 1, p, n + 1);
720+ p = (char*)memmem(parts, sizeof(parts) - 1, p, n + 1);
721 if (p == NULL)
722- p = "unknown";
723+ p = const_cast<char*>("unknown");
724 else
725 p += n + 1;
726 n = (int) strcspn(p, "\n");
727@@ -1815,7 +1815,7 @@ nocpuinfo:
728 }
729
730 size = n * sizeof(**ci) + sizeof(models);
731- *ci = uv__malloc(size);
732+ *ci = (uv_cpu_info_t*)uv__malloc(size);
733 *count = 0;
734
735 if (*ci == NULL) {
736@@ -1824,7 +1824,7 @@ nocpuinfo:
737 }
738
739 *count = n;
740- p = memcpy(*ci + n, models, sizeof(models));
741+ p = (char*)memcpy(*ci + n, models, sizeof(models));
742
743 i = 0;
744 for (cpu = 0; cpu < maxcpu; cpu++) {
745@@ -1833,19 +1833,19 @@ nocpuinfo:
746
747 c = *cpus + cpu;
748
749- (*ci)[i++] = (uv_cpu_info_t) {
750+ (*ci)[i++] = uv_cpu_info_t{
751 .model = p + c->model * sizeof(*model),
752- .speed = c->freq / 1000,
753+ .speed = (int)(c->freq / 1000),
754 /* Note: sysconf(_SC_CLK_TCK) is fixed at 100 Hz,
755 * therefore the multiplier is always 1000/100 = 10.
756 */
757- .cpu_times = (struct uv_cpu_times_s) {
758+ .cpu_times = {
759 .user = 10 * c->user,
760 .nice = 10 * c->nice,
761 .sys = 10 * c->sys,
762 .idle = 10 * c->idle,
763 .irq = 10 * c->irq,
764- },
765+ }
766 };
767 }
768
769@@ -1902,7 +1902,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800770 }
771
772 /* Make sure the memory is initiallized to zero using calloc() */
773- *addresses = uv__calloc(*count, sizeof(**addresses));
774+ *addresses = (uv_interface_address_t*)uv__calloc(*count, sizeof(**addresses));
775 if (!(*addresses)) {
776 freeifaddrs(addrs);
777 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800778@@ -2470,12 +2470,12 @@ int uv_fs_event_start(uv_fs_event_t* handle,
James Kuszmaulcf324122023-01-14 14:07:17 -0800779 goto no_insert;
780
781 len = strlen(path) + 1;
782- w = uv__malloc(sizeof(*w) + len);
783+ w = (watcher_list*)uv__malloc(sizeof(*w) + len);
784 if (w == NULL)
785 return UV_ENOMEM;
786
787 w->wd = wd;
788- w->path = memcpy(w + 1, path, len);
789+ w->path = (char*)memcpy(w + 1, path, len);
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800790 uv__queue_init(&w->watchers);
James Kuszmaulcf324122023-01-14 14:07:17 -0800791 w->iterating = 0;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800792 RB_INSERT(watcher_root, uv__inotify_watchers(loop), w);
James Kuszmaulcf324122023-01-14 14:07:17 -0800793diff --git a/src/unix/loop.c b/src/unix/loop.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800794index a9468e8e19cbede795032980c47eb83aee1e0c68..3babe4d701949ebc69d74f7dedee33c777d89892 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800795--- a/src/unix/loop.c
796+++ b/src/unix/loop.c
797@@ -148,7 +148,7 @@ int uv_loop_fork(uv_loop_t* loop) {
798
799 /* Rearm all the watchers that aren't re-queued by the above. */
800 for (i = 0; i < loop->nwatchers; i++) {
801- w = loop->watchers[i];
802+ w = (uv__io_t*)loop->watchers[i];
803 if (w == NULL)
804 continue;
805
806diff --git a/src/unix/netbsd.c b/src/unix/netbsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800807index fa21e98e41aec8b7d8bc46c299c4c20a7a0c3f0c..4c6d5a24fe896d89e3b2f1db1dc2b1dd7d010aec 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800808--- a/src/unix/netbsd.c
809+++ b/src/unix/netbsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800810@@ -211,14 +211,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800811 cpuspeed = 0;
812
813 size = numcpus * CPUSTATES * sizeof(*cp_times);
814- cp_times = uv__malloc(size);
815+ cp_times = (u_int64_t*)uv__malloc(size);
816 if (cp_times == NULL)
817 return UV_ENOMEM;
818
819 if (sysctlbyname("kern.cp_time", cp_times, &size, NULL, 0))
820 return UV__ERR(errno);
821
822- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
823+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
824 if (!(*cpu_infos)) {
825 uv__free(cp_times);
826 uv__free(*cpu_infos);
827diff --git a/src/unix/openbsd.c b/src/unix/openbsd.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800828index 9c863b6c90dad9864cb8341c2b6203c1390a9487..2aa61e2ee3321d91ba84887c7ed6dcfa23d00ccf 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800829--- a/src/unix/openbsd.c
830+++ b/src/unix/openbsd.c
831@@ -72,7 +72,7 @@ int uv_exepath(char* buffer, size_t* size) {
832 mypid = getpid();
833 for (;;) {
834 err = UV_ENOMEM;
835- argsbuf = uv__reallocf(argsbuf, argsbuf_size);
836+ argsbuf = (char**)uv__reallocf(argsbuf, argsbuf_size);
837 if (argsbuf == NULL)
838 goto out;
839 mib[0] = CTL_KERN;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800840@@ -202,7 +202,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800841 if (sysctl(which, ARRAY_SIZE(which), &numcpus, &size, NULL, 0))
842 return UV__ERR(errno);
843
844- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
845+ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
846 if (!(*cpu_infos))
847 return UV_ENOMEM;
848
849diff --git a/src/unix/pipe.c b/src/unix/pipe.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800850index d332f3518303d6ef1dee1d835c392bb60b935bad..a60b1a0e442bb3c482575da117f30e9f119f55d3 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800851--- a/src/unix/pipe.c
852+++ b/src/unix/pipe.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800853@@ -377,7 +377,7 @@ int uv_pipe_pending_count(uv_pipe_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800854 if (handle->queued_fds == NULL)
855 return 1;
856
857- queued_fds = handle->queued_fds;
858+ queued_fds = (uv__stream_queued_fds_t*)(handle->queued_fds);
859 return queued_fds->offset + 1;
860 }
861
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800862@@ -414,7 +414,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800863 if (r != UV_ENOBUFS)
864 return r;
865
866- name_buffer = uv__malloc(name_len);
867+ name_buffer = (char*)uv__malloc(name_len);
868 if (name_buffer == NULL)
869 return UV_ENOMEM;
870
871diff --git a/src/unix/poll.c b/src/unix/poll.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800872index 7a12e2d1488a9d48712439e62c6637b9e1161f69..c21722b2e8eef4d16c523f7319fb57c3167d8dd9 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800873--- a/src/unix/poll.c
874+++ b/src/unix/poll.c
875@@ -117,7 +117,7 @@ int uv_poll_stop(uv_poll_t* handle) {
876
877
878 int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
879- uv__io_t** watchers;
880+ void** watchers;
881 uv__io_t* w;
882 int events;
883
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800884@@ -125,7 +125,7 @@ int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
885 UV_PRIORITIZED)) == 0);
886 assert(!uv__is_closing(handle));
887
888- watchers = handle->loop->watchers;
889+ watchers = (void**)handle->loop->watchers;
890 w = &handle->io_watcher;
891
892 if (uv__fd_exists(handle->loop, w->fd))
James Kuszmaulcf324122023-01-14 14:07:17 -0800893diff --git a/src/unix/posix-poll.c b/src/unix/posix-poll.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800894index 2e016c2fbaed2eeccd78080969a86aff821a4251..b71eee3f01a3f30b3b5efef539194139f258009a 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800895--- a/src/unix/posix-poll.c
896+++ b/src/unix/posix-poll.c
897@@ -61,7 +61,7 @@ static void uv__pollfds_maybe_resize(uv_loop_t* loop) {
898 return;
899
900 n = loop->poll_fds_size ? loop->poll_fds_size * 2 : 64;
901- p = uv__reallocf(loop->poll_fds, n * sizeof(*loop->poll_fds));
902+ p = (struct pollfd*)uv__reallocf(loop->poll_fds, n * sizeof(*loop->poll_fds));
903 if (p == NULL)
904 abort();
905
906diff --git a/src/unix/process.c b/src/unix/process.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800907index dd58c18d9b9359fca1a924698c39bd6390dafbe0..2d622c956de6d7b6f8a04be3ecd311f39602b241 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800908--- a/src/unix/process.c
909+++ b/src/unix/process.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800910@@ -423,7 +423,7 @@ static int posix_spawn_can_use_setsid;
James Kuszmaulcf324122023-01-14 14:07:17 -0800911 static void uv__spawn_init_posix_spawn_fncs(void) {
912 /* Try to locate all non-portable functions at runtime */
913 posix_spawn_fncs.file_actions.addchdir_np =
914- dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
915+ (int (*)(void* const*, const char*)) dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
916 }
917
918
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800919@@ -988,7 +988,7 @@ int uv_spawn(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -0800920 err = UV_ENOMEM;
921 pipes = pipes_storage;
922 if (stdio_count > (int) ARRAY_SIZE(pipes_storage))
923- pipes = uv__malloc(stdio_count * sizeof(*pipes));
924+ pipes = (int (*)[2])uv__malloc(stdio_count * sizeof(*pipes));
925
926 if (pipes == NULL)
927 goto error;
928diff --git a/src/unix/proctitle.c b/src/unix/proctitle.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800929index 9d1f00ddf66e291abd40d0c0052a7f9bd5c03017..8cdec753d003ebe16485db2b47ffb3863a9473ff 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800930--- a/src/unix/proctitle.c
931+++ b/src/unix/proctitle.c
932@@ -65,7 +65,7 @@ char** uv_setup_args(int argc, char** argv) {
933 /* Add space for the argv pointers. */
934 size += (argc + 1) * sizeof(char*);
935
936- new_argv = uv__malloc(size);
937+ new_argv = (char**)uv__malloc(size);
938 if (new_argv == NULL)
939 return argv;
940
941diff --git a/src/unix/random-sysctl-linux.c b/src/unix/random-sysctl-linux.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800942index 66ba8d74ec22b72d318b91d82365f5b9693feb3c..9ef18df01a51aa6a26ae6d1d9660a819d18604d0 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800943--- a/src/unix/random-sysctl-linux.c
944+++ b/src/unix/random-sysctl-linux.c
945@@ -48,7 +48,7 @@ int uv__random_sysctl(void* buf, size_t buflen) {
946 char* pe;
947 size_t n;
948
949- p = buf;
950+ p = (char*)buf;
951 pe = p + buflen;
952
953 while (p < pe) {
954diff --git a/src/unix/stream.c b/src/unix/stream.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800955index 28c4d5463c4622725a433b8807e5e7bde580dadd..265ddade7aec129eb9dbf07cde2a16a0e341d1a7 100644
James Kuszmaulcf324122023-01-14 14:07:17 -0800956--- a/src/unix/stream.c
957+++ b/src/unix/stream.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800958@@ -123,7 +123,7 @@ static void uv__stream_osx_interrupt_select(uv_stream_t* stream) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800959 uv__stream_select_t* s;
960 int r;
961
962- s = stream->select;
963+ s = (uv__stream_select_t*)stream->select;
964 if (s == NULL)
965 return;
966
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800967@@ -152,8 +152,8 @@ static void uv__stream_osx_select(void* arg) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800968 int r;
969 int max_fd;
970
971- stream = arg;
972- s = stream->select;
973+ stream = (uv_stream_t*)arg;
974+ s = (uv__stream_select_t*)stream->select;
975 fd = s->fd;
976
977 if (fd > s->int_fd)
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800978@@ -330,7 +330,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800979 sread_sz = ROUND_UP(max_fd + 1, sizeof(uint32_t) * NBBY) / NBBY;
980 swrite_sz = sread_sz;
981
982- s = uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
983+ s = (uv__stream_select_t*)uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
984 if (s == NULL) {
985 err = UV_ENOMEM;
986 goto failed_malloc;
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800987@@ -573,7 +573,7 @@ done:
James Kuszmaulcf324122023-01-14 14:07:17 -0800988 if (server->queued_fds != NULL) {
989 uv__stream_queued_fds_t* queued_fds;
990
991- queued_fds = server->queued_fds;
992+ queued_fds = (uv__stream_queued_fds_t*)(server->queued_fds);
993
994 /* Read first */
995 server->accepted_fd = queued_fds->fds[0];
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800996@@ -942,11 +942,12 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
James Kuszmaulcf324122023-01-14 14:07:17 -0800997 uv__stream_queued_fds_t* queued_fds;
998 unsigned int queue_size;
999
1000- queued_fds = stream->queued_fds;
1001+ queued_fds = (uv__stream_queued_fds_t*)stream->queued_fds;
1002 if (queued_fds == NULL) {
1003 queue_size = 8;
1004- queued_fds = uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
1005- sizeof(*queued_fds));
1006+ queued_fds = (uv__stream_queued_fds_t*)
1007+ uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
1008+ sizeof(*queued_fds));
1009 if (queued_fds == NULL)
1010 return UV_ENOMEM;
1011 queued_fds->size = queue_size;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001012@@ -956,9 +957,9 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001013 /* Grow */
1014 } else if (queued_fds->size == queued_fds->offset) {
1015 queue_size = queued_fds->size + 8;
1016- queued_fds = uv__realloc(queued_fds,
1017- (queue_size - 1) * sizeof(*queued_fds->fds) +
1018- sizeof(*queued_fds));
1019+ queued_fds = (uv__stream_queued_fds_t*)
1020+ uv__realloc(queued_fds, (queue_size - 1) * sizeof(*queued_fds->fds) +
1021+ sizeof(*queued_fds));
1022
1023 /*
1024 * Allocation failure, report back.
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001025@@ -1356,7 +1357,7 @@ int uv_write2(uv_write_t* req,
James Kuszmaulcf324122023-01-14 14:07:17 -08001026
1027 req->bufs = req->bufsml;
1028 if (nbufs > ARRAY_SIZE(req->bufsml))
1029- req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
1030+ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(bufs[0]));
1031
1032 if (req->bufs == NULL)
1033 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001034@@ -1490,7 +1491,7 @@ int uv___stream_fd(const uv_stream_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001035 handle->type == UV_TTY ||
1036 handle->type == UV_NAMED_PIPE);
1037
1038- s = handle->select;
1039+ s = (const uv__stream_select_t*)handle->select;
1040 if (s != NULL)
1041 return s->fd;
1042
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001043@@ -1508,7 +1509,7 @@ void uv__stream_close(uv_stream_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001044 if (handle->select != NULL) {
1045 uv__stream_select_t* s;
1046
1047- s = handle->select;
1048+ s = (uv__stream_select_t*)handle->select;
1049
1050 uv_sem_post(&s->close_sem);
1051 uv_sem_post(&s->async_sem);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001052@@ -1543,7 +1544,7 @@ void uv__stream_close(uv_stream_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001053
1054 /* Close all queued fds */
1055 if (handle->queued_fds != NULL) {
1056- queued_fds = handle->queued_fds;
1057+ queued_fds = (uv__stream_queued_fds_t*)(handle->queued_fds);
1058 for (i = 0; i < queued_fds->offset; i++)
1059 uv__close(queued_fds->fds[i]);
1060 uv__free(handle->queued_fds);
1061diff --git a/src/unix/thread.c b/src/unix/thread.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001062index 4d6f4b8232ec6dc0bd27258a1315340e3e272ae9..531c6211bb4321e5f11031a0644b4e3ab9174396 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001063--- a/src/unix/thread.c
1064+++ b/src/unix/thread.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001065@@ -168,8 +168,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
James Kuszmaulcf324122023-01-14 14:07:17 -08001066 abort();
1067 }
1068
1069- f.in = entry;
1070- err = pthread_create(tid, attr, f.out, arg);
1071+ err = pthread_create(tid, attr, (void*(*)(void*)) (void(*)(void)) entry, arg);
1072
1073 if (attr != NULL)
1074 pthread_attr_destroy(attr);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001075@@ -540,7 +539,7 @@ static int uv__custom_sem_init(uv_sem_t* sem_, unsigned int value) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001076 int err;
1077 uv_semaphore_t* sem;
1078
1079- sem = uv__malloc(sizeof(*sem));
1080+ sem = (uv_semaphore_t*)uv__malloc(sizeof(*sem));
1081 if (sem == NULL)
1082 return UV_ENOMEM;
1083
1084diff --git a/src/unix/udp.c b/src/unix/udp.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001085index c2814512a5f507ceb9e764cdb7c6ff3d36e77974..cbee16b22a36b1c82e74f6a81c3811052e9b8482 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001086--- a/src/unix/udp.c
1087+++ b/src/unix/udp.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001088@@ -191,11 +191,11 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001089 if (msgs[k].msg_hdr.msg_flags & MSG_TRUNC)
1090 flags |= UV_UDP_PARTIAL;
1091
1092- chunk_buf = uv_buf_init(iov[k].iov_base, iov[k].iov_len);
1093+ chunk_buf = uv_buf_init((char*) iov[k].iov_base, iov[k].iov_len);
1094 handle->recv_cb(handle,
1095 msgs[k].msg_len,
1096 &chunk_buf,
1097- msgs[k].msg_hdr.msg_name,
1098+ (const sockaddr*) msgs[k].msg_hdr.msg_name,
1099 flags);
1100 }
1101
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001102@@ -245,7 +245,7 @@ static void uv__udp_recvmsg(uv_udp_t* handle) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001103 memset(&peer, 0, sizeof(peer));
1104 h.msg_name = &peer;
1105 h.msg_namelen = sizeof(peer);
1106- h.msg_iov = (void*) &buf;
1107+ h.msg_iov = (iovec*) &buf;
1108 h.msg_iovlen = 1;
1109
1110 do {
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001111@@ -719,7 +719,7 @@ int uv__udp_send(uv_udp_send_t* req,
James Kuszmaulcf324122023-01-14 14:07:17 -08001112
1113 req->bufs = req->bufsml;
1114 if (nbufs > ARRAY_SIZE(req->bufsml))
1115- req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
1116+ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(bufs[0]));
1117
1118 if (req->bufs == NULL) {
1119 uv__req_unregister(handle->loop, req);
1120diff --git a/src/uv-common.c b/src/uv-common.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001121index 916f3f4e00664ab47f94d2a6ee7c6a9ef0461389..c04f93596ab1f730576256d86e216ccb7f258b72 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001122--- a/src/uv-common.c
1123+++ b/src/uv-common.c
1124@@ -54,10 +54,10 @@ static uv__allocator_t uv__allocator = {
1125
1126 char* uv__strdup(const char* s) {
1127 size_t len = strlen(s) + 1;
1128- char* m = uv__malloc(len);
1129+ char* m = (char*)uv__malloc(len);
1130 if (m == NULL)
1131 return NULL;
1132- return memcpy(m, s, len);
1133+ return (char*)memcpy(m, s, len);
1134 }
1135
1136 char* uv__strndup(const char* s, size_t n) {
1137@@ -65,11 +65,11 @@ char* uv__strndup(const char* s, size_t n) {
1138 size_t len = strlen(s);
1139 if (n < len)
1140 len = n;
1141- m = uv__malloc(len + 1);
1142+ m = (char*)uv__malloc(len + 1);
1143 if (m == NULL)
1144 return NULL;
1145 m[len] = '\0';
1146- return memcpy(m, s, len);
1147+ return (char*)memcpy(m, s, len);
1148 }
1149
1150 void* uv__malloc(size_t size) {
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001151@@ -688,7 +688,7 @@ void uv__fs_scandir_cleanup(uv_fs_t* req) {
1152 unsigned int n;
James Kuszmaulcf324122023-01-14 14:07:17 -08001153
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001154 if (req->result >= 0) {
1155- dents = req->ptr;
1156+ dents = (uv__dirent_t**)(req->ptr);
1157 nbufs = uv__get_nbufs(req);
James Kuszmaulcf324122023-01-14 14:07:17 -08001158
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001159 i = 0;
1160@@ -721,7 +721,7 @@ int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001161 nbufs = uv__get_nbufs(req);
1162 assert(nbufs);
1163
1164- dents = req->ptr;
1165+ dents = (uv__dirent_t**)(req->ptr);
1166
1167 /* Free previous entity */
1168 if (*nbufs > 0)
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001169@@ -786,7 +786,7 @@ void uv__fs_readdir_cleanup(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001170 if (req->ptr == NULL)
1171 return;
1172
1173- dir = req->ptr;
1174+ dir = (uv_dir_t*)req->ptr;
1175 dirents = dir->dirents;
1176 req->ptr = NULL;
1177
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001178@@ -832,7 +832,7 @@ uv_loop_t* uv_default_loop(void) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001179 uv_loop_t* uv_loop_new(void) {
1180 uv_loop_t* loop;
1181
1182- loop = uv__malloc(sizeof(*loop));
1183+ loop = (uv_loop_t*)uv__malloc(sizeof(*loop));
1184 if (loop == NULL)
1185 return NULL;
1186
1187diff --git a/src/win/core.c b/src/win/core.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001188index e9885a0f1ff3890a8d957c8793e22b01cedc0e97..87ade7ad65243ee3ff940320f84e1960390300e1 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001189--- a/src/win/core.c
1190+++ b/src/win/core.c
1191@@ -98,7 +98,8 @@ static int uv__loops_add(uv_loop_t* loop) {
1192
1193 if (uv__loops_size == uv__loops_capacity) {
1194 new_capacity = uv__loops_capacity + UV__LOOPS_CHUNK_SIZE;
1195- new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity);
1196+ new_loops = (uv_loop_t**)
1197+ uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity);
1198 if (!new_loops)
1199 goto failed_loops_realloc;
1200 uv__loops = new_loops;
1201@@ -152,7 +153,8 @@ static void uv__loops_remove(uv_loop_t* loop) {
1202 smaller_capacity = uv__loops_capacity / 2;
1203 if (uv__loops_size >= smaller_capacity)
1204 goto loop_removed;
1205- new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity);
1206+ new_loops = (uv_loop_t**)
1207+ uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity);
1208 if (!new_loops)
1209 goto loop_removed;
1210 uv__loops = new_loops;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001211@@ -264,7 +266,7 @@ int uv_loop_init(uv_loop_t* loop) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001212
1213 loop->endgame_handles = NULL;
1214
1215- loop->timer_heap = timer_heap = uv__malloc(sizeof(*timer_heap));
1216+ loop->timer_heap = timer_heap = (heap*)uv__malloc(sizeof(*timer_heap));
1217 if (timer_heap == NULL) {
1218 err = UV_ENOMEM;
1219 goto fail_timers_alloc;
1220diff --git a/src/win/fs-event.c b/src/win/fs-event.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001221index 6758c7c78bc1d6a5316a8ae7dc2d1e23cd0f32bc..150467313d576bfe2966b55f3d8cffa23cbb8ea3 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001222--- a/src/win/fs-event.c
1223+++ b/src/win/fs-event.c
1224@@ -73,7 +73,7 @@ static void uv__relative_path(const WCHAR* filename,
1225 if (dirlen > 0 && dir[dirlen - 1] == '\\')
1226 dirlen--;
1227 relpathlen = filenamelen - dirlen - 1;
1228- *relpath = uv__malloc((relpathlen + 1) * sizeof(WCHAR));
1229+ *relpath = (WCHAR*)uv__malloc((relpathlen + 1) * sizeof(WCHAR));
1230 if (!*relpath)
1231 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1232 wcsncpy(*relpath, filename + dirlen + 1, relpathlen);
1233@@ -242,7 +242,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
1234 if (short_path_buffer_len == 0) {
1235 goto short_path_done;
1236 }
1237- short_path_buffer = uv__malloc(short_path_buffer_len * sizeof(WCHAR));
1238+ short_path_buffer = (WCHAR*)uv__malloc(short_path_buffer_len * sizeof(WCHAR));
1239 if (short_path_buffer == NULL) {
1240 goto short_path_done;
1241 }
1242diff --git a/src/win/fs-fd-hash-inl.h b/src/win/fs-fd-hash-inl.h
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001243index 0b532af12d4371c2311bd50a66913287a0716f43..703a8d8f87de1089ac8b18bd817d416d48dc442e 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001244--- a/src/win/fs-fd-hash-inl.h
1245+++ b/src/win/fs-fd-hash-inl.h
1246@@ -146,7 +146,7 @@ INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) {
1247
1248 if (bucket_ptr->size != 0 && i == 0) {
1249 struct uv__fd_hash_entry_group_s* new_group_ptr =
1250- uv__malloc(sizeof(*new_group_ptr));
1251+ (struct uv__fd_hash_entry_group_s*)uv__malloc(sizeof(*new_group_ptr));
1252 if (new_group_ptr == NULL) {
1253 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1254 }
1255diff --git a/src/win/fs.c b/src/win/fs.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001256index fc209c54f470edaa031009979061cff071cbf66d..328c8f2e0513562b53c948ffea59d0841e14b264 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001257--- a/src/win/fs.c
1258+++ b/src/win/fs.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001259@@ -258,7 +258,7 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
James Kuszmaulcf324122023-01-14 14:07:17 -08001260 return 0;
1261 }
1262
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001263- buf = uv__malloc(buf_sz);
1264+ buf = (WCHAR *)uv__malloc(buf_sz);
1265 if (buf == NULL) {
1266 return ERROR_OUTOFMEMORY;
1267 }
1268@@ -376,7 +376,7 @@ static int fs__wide_to_wtf8(WCHAR* w_source_ptr,
1269 return 0;
1270
1271 if (*target_ptr == NULL) {
1272- target = uv__malloc(target_len + 1);
1273+ target = (char *)uv__malloc(target_len + 1);
1274 if (target == NULL) {
1275 SetLastError(ERROR_OUTOFMEMORY);
1276 return -1;
1277@@ -1575,7 +1575,7 @@ void fs__scandir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001278 if (dirents_used >= dirents_size) {
1279 size_t new_dirents_size =
1280 dirents_size == 0 ? dirents_initial_size : dirents_size << 1;
1281- uv__dirent_t** new_dirents =
1282+ uv__dirent_t** new_dirents = (uv__dirent_t**)
1283 uv__realloc(dirents, new_dirents_size * sizeof *dirents);
1284
1285 if (new_dirents == NULL)
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001286@@ -1589,7 +1589,7 @@ void fs__scandir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001287 * includes room for the first character of the filename, but `utf8_len`
1288 * doesn't count the NULL terminator at this point.
1289 */
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001290- dirent = uv__malloc(sizeof *dirent + wtf8_len);
1291+ dirent = (uv__dirent_t*)uv__malloc(sizeof *dirent + wtf8_len);
James Kuszmaulcf324122023-01-14 14:07:17 -08001292 if (dirent == NULL)
1293 goto out_of_memory_error;
1294
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001295@@ -1691,7 +1691,7 @@ void fs__opendir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001296 goto error;
1297 }
1298
1299- dir = uv__malloc(sizeof(*dir));
1300+ dir = (uv_dir_t*)uv__malloc(sizeof(*dir));
1301 if (dir == NULL) {
1302 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1303 goto error;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001304@@ -1706,7 +1706,7 @@ void fs__opendir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001305 else
1306 fmt = L"%s\\*";
1307
1308- find_path = uv__malloc(sizeof(WCHAR) * (len + 4));
1309+ find_path = (WCHAR*)uv__malloc(sizeof(WCHAR) * (len + 4));
1310 if (find_path == NULL) {
1311 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1312 goto error;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001313@@ -1743,7 +1743,7 @@ void fs__readdir(uv_fs_t* req) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001314 int r;
1315
1316 req->flags |= UV_FS_FREE_PTR;
1317- dir = req->ptr;
1318+ dir = (uv_dir_t*)req->ptr;
1319 dirents = dir->dirents;
1320 memset(dirents, 0, dir->nentries * sizeof(*dir->dirents));
1321 find_data = &dir->find_data;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001322@@ -1800,7 +1800,7 @@ error:
James Kuszmaulcf324122023-01-14 14:07:17 -08001323 void fs__closedir(uv_fs_t* req) {
1324 uv_dir_t* dir;
1325
1326- dir = req->ptr;
1327+ dir = (uv_dir_t*)req->ptr;
1328 FindClose(dir->dir_handle);
1329 uv__free(req->ptr);
1330 SET_REQ_RESULT(req, 0);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001331@@ -2791,7 +2791,7 @@ static ssize_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001332 return -1;
1333 }
1334
1335- w_realpath_buf = uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
1336+ w_realpath_buf = (WCHAR*)uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
1337 if (w_realpath_buf == NULL) {
1338 SetLastError(ERROR_OUTOFMEMORY);
1339 return -1;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001340@@ -2904,7 +2904,7 @@ retry_get_disk_free_space:
James Kuszmaulcf324122023-01-14 14:07:17 -08001341 }
1342
1343 len = MAX_PATH + 1;
1344- pathw = uv__malloc(len * sizeof(*pathw));
1345+ pathw = (WCHAR*)uv__malloc(len * sizeof(*pathw));
1346 if (pathw == NULL) {
1347 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1348 return;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001349@@ -2920,7 +2920,7 @@ retry_get_full_path_name:
James Kuszmaulcf324122023-01-14 14:07:17 -08001350 return;
1351 } else if (ret > len) {
1352 len = ret;
1353- pathw = uv__reallocf(pathw, len * sizeof(*pathw));
1354+ pathw = (WCHAR*)uv__reallocf(pathw, len * sizeof(*pathw));
1355 if (pathw == NULL) {
1356 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1357 return;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001358@@ -2936,7 +2936,7 @@ retry_get_full_path_name:
James Kuszmaulcf324122023-01-14 14:07:17 -08001359 uv__free(pathw);
1360 }
1361
1362- stat_fs = uv__malloc(sizeof(*stat_fs));
1363+ stat_fs = (uv_statfs_t*)uv__malloc(sizeof(*stat_fs));
1364 if (stat_fs == NULL) {
1365 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1366 return;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001367@@ -3095,7 +3095,7 @@ int uv_fs_read(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -08001368 req->fs.info.nbufs = nbufs;
1369 req->fs.info.bufs = req->fs.info.bufsml;
1370 if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
1371- req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
1372+ req->fs.info.bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
1373
1374 if (req->fs.info.bufs == NULL) {
1375 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001376@@ -3128,7 +3128,7 @@ int uv_fs_write(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -08001377 req->fs.info.nbufs = nbufs;
1378 req->fs.info.bufs = req->fs.info.bufsml;
1379 if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
1380- req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
1381+ req->fs.info.bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
1382
1383 if (req->fs.info.bufs == NULL) {
1384 SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
1385diff --git a/src/win/pipe.c b/src/win/pipe.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001386index f0cac3822564e14052feb5e1934f54c57c78160d..c1739efe82b8755999145860b4da6b50c73518a2 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001387--- a/src/win/pipe.c
1388+++ b/src/win/pipe.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001389@@ -756,7 +756,7 @@ int uv_pipe_bind2(uv_pipe_t* handle,
James Kuszmaulcf324122023-01-14 14:07:17 -08001390
1391 /* Convert name to UTF16. */
1392 nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0) * sizeof(WCHAR);
1393- handle->name = uv__malloc(nameSize);
1394+ handle->name = (WCHAR*)uv__malloc(nameSize);
1395 if (!handle->name) {
1396 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1397 }
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001398@@ -906,7 +906,7 @@ int uv_pipe_connect2(uv_connect_t* req,
James Kuszmaulcf324122023-01-14 14:07:17 -08001399
1400 /* Convert name to UTF16. */
1401 nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0) * sizeof(WCHAR);
1402- handle->name = uv__malloc(nameSize);
1403+ handle->name = (WCHAR*)uv__malloc(nameSize);
1404 if (!handle->name) {
1405 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1406 }
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001407@@ -924,7 +924,7 @@ int uv_pipe_connect2(uv_connect_t* req,
1408 pipeHandle = open_named_pipe(handle->name, &duplex_flags);
1409 if (pipeHandle == INVALID_HANDLE_VALUE) {
1410 if (GetLastError() == ERROR_PIPE_BUSY) {
1411- req->u.connect.name = uv__malloc(nameSize);
1412+ req->u.connect.name = (WCHAR *)uv__malloc(nameSize);
1413 if (!req->u.connect.name) {
1414 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1415 }
1416@@ -1528,7 +1528,7 @@ static int uv__build_coalesced_write_req(uv_write_t* user_req,
James Kuszmaulcf324122023-01-14 14:07:17 -08001417 data_length; /* (c) */
1418
1419 /* Allocate buffer. */
1420- heap_buffer = uv__malloc(heap_buffer_length);
1421+ heap_buffer = (char*)uv__malloc(heap_buffer_length);
1422 if (heap_buffer == NULL)
1423 return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */
1424
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001425@@ -1777,7 +1777,7 @@ int uv__pipe_write_ipc(uv_loop_t* loop,
James Kuszmaulcf324122023-01-14 14:07:17 -08001426 bufs = stack_bufs;
1427 } else {
1428 /* Use heap-allocated buffer array. */
1429- bufs = uv__calloc(buf_count, sizeof(uv_buf_t));
1430+ bufs = (uv_buf_t*)uv__calloc(buf_count, sizeof(uv_buf_t));
1431 if (bufs == NULL)
1432 return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */
1433 }
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001434@@ -2514,7 +2514,7 @@ static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size)
James Kuszmaulcf324122023-01-14 14:07:17 -08001435 FileNameInformation);
1436 if (nt_status == STATUS_BUFFER_OVERFLOW) {
1437 name_size = sizeof(*name_info) + tmp_name_info.FileNameLength;
1438- name_info = uv__malloc(name_size);
1439+ name_info = (FILE_NAME_INFORMATION*)uv__malloc(name_size);
1440 if (!name_info) {
1441 *size = 0;
1442 err = UV_ENOMEM;
1443diff --git a/src/win/process.c b/src/win/process.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001444index ed44adc67c6d52785a199206d9ba0357e2d0b045..b383e8b405db56d413985b38df216d09c58ec4a0 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001445--- a/src/win/process.c
1446+++ b/src/win/process.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001447@@ -615,8 +615,8 @@ error:
James Kuszmaulcf324122023-01-14 14:07:17 -08001448
1449
1450 int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
1451- wchar_t* a_eq;
1452- wchar_t* b_eq;
1453+ const wchar_t* a_eq;
1454+ const wchar_t* b_eq;
1455 wchar_t* A;
1456 wchar_t* B;
1457 int nb;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001458@@ -633,8 +633,8 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001459 assert(b_eq);
1460 nb = b_eq - b;
1461
1462- A = alloca((na+1) * sizeof(wchar_t));
1463- B = alloca((nb+1) * sizeof(wchar_t));
1464+ A = (wchar_t*)alloca((na+1) * sizeof(wchar_t));
1465+ B = (wchar_t*)alloca((nb+1) * sizeof(wchar_t));
1466
1467 r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, a, na, A, na);
1468 assert(r==na);
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001469@@ -717,7 +717,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001470 if (dst_copy == NULL && env_len > 0) {
1471 return ERROR_OUTOFMEMORY;
1472 }
1473- env_copy = alloca(env_block_count * sizeof(WCHAR*));
1474+ env_copy = (WCHAR**)alloca(env_block_count * sizeof(WCHAR*));
1475
1476 ptr = dst_copy;
1477 ptr_copy = env_copy;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001478@@ -771,7 +771,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001479 }
1480
1481 /* final pass: copy, in sort order, and inserting required variables */
1482- dst = uv__malloc((1+env_len) * sizeof(WCHAR));
1483+ dst = (WCHAR*)uv__malloc((1+env_len) * sizeof(WCHAR));
1484 if (!dst) {
1485 uv__free(dst_copy);
1486 return ERROR_OUTOFMEMORY;
1487diff --git a/src/win/tcp.c b/src/win/tcp.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001488index 187f36e2a61c870b0d16e17e9d4a9e1161ba8851..d8da4d941a51b0625fc0c072342ec4edf74c0ea3 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001489--- a/src/win/tcp.c
1490+++ b/src/win/tcp.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001491@@ -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 -08001492
1493 if (handle->tcp.serv.accept_reqs == NULL) {
1494 handle->tcp.serv.accept_reqs =
1495- uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
1496+ (uv_tcp_accept_t*)uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
1497 if (!handle->tcp.serv.accept_reqs) {
1498 uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
1499 }
1500diff --git a/src/win/thread.c b/src/win/thread.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001501index 57c25e8f5a861c9d8a4c402c260d3ac235200423..57f1698f595e2410a51044f7f228b5a235206819 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001502--- a/src/win/thread.c
1503+++ b/src/win/thread.c
1504@@ -98,7 +98,7 @@ static UINT __stdcall uv__thread_start(void* arg) {
1505 struct thread_ctx *ctx_p;
1506 struct thread_ctx ctx;
1507
1508- ctx_p = arg;
1509+ ctx_p = (struct thread_ctx*)arg;
1510 ctx = *ctx_p;
1511 uv__free(ctx_p);
1512
1513@@ -141,7 +141,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
1514 return UV_EINVAL;
1515 }
1516
1517- ctx = uv__malloc(sizeof(*ctx));
1518+ ctx = (struct thread_ctx*)uv__malloc(sizeof(*ctx));
1519 if (ctx == NULL)
1520 return UV_ENOMEM;
1521
1522diff --git a/src/win/util.c b/src/win/util.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001523index f6ec79cd57b5010ed5fd6829d952bcdacc8b7671..1cfd7b2caf0d4ad1a6a66df9406c21f4e2b69b04 100644
James Kuszmaulcf324122023-01-14 14:07:17 -08001524--- a/src/win/util.c
1525+++ b/src/win/util.c
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001526@@ -160,7 +160,7 @@ static int uv__cwd(WCHAR** buf, DWORD *len) {
1527 return uv_translate_sys_error(GetLastError());
1528
1529 /* |t| is the size of the buffer _including_ nul. */
1530- p = uv__malloc(t * sizeof(*p));
1531+ p = (WCHAR *)uv__malloc(t * sizeof(*p));
1532 if (p == NULL)
1533 return UV_ENOMEM;
1534
1535@@ -265,7 +265,7 @@ int uv_chdir(const char* dir) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001536 if (utf16_len == 0) {
1537 return uv_translate_sys_error(GetLastError());
1538 }
1539- utf16_buffer = uv__malloc(utf16_len * sizeof(WCHAR));
1540+ utf16_buffer = (WCHAR*)uv__malloc(utf16_len * sizeof(WCHAR));
1541 if (utf16_buffer == NULL) {
1542 return UV_ENOMEM;
1543 }
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001544@@ -623,14 +623,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001545 GetSystemInfo(&system_info);
1546 cpu_count = system_info.dwNumberOfProcessors;
1547
1548- cpu_infos = uv__calloc(cpu_count, sizeof *cpu_infos);
1549+ cpu_infos = (uv_cpu_info_t*)uv__calloc(cpu_count, sizeof *cpu_infos);
1550 if (cpu_infos == NULL) {
1551 err = ERROR_OUTOFMEMORY;
1552 goto error;
1553 }
1554
1555 sppi_size = cpu_count * sizeof(*sppi);
1556- sppi = uv__malloc(sppi_size);
1557+ sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*)uv__malloc(sppi_size);
1558 if (sppi == NULL) {
1559 err = ERROR_OUTOFMEMORY;
1560 goto error;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001561@@ -774,7 +774,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
James Kuszmaulcf324122023-01-14 14:07:17 -08001562 case ERROR_BUFFER_OVERFLOW:
1563 /* This happens when win_address_buf is NULL or too small to hold all
1564 * adapters. */
1565- win_address_buf = uv__malloc(win_address_buf_size);
1566+ win_address_buf =
1567+ (IP_ADAPTER_ADDRESSES*)uv__malloc(win_address_buf_size);
1568 if (win_address_buf == NULL)
1569 return UV_ENOMEM;
1570
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001571@@ -782,7 +783,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
James Kuszmaulcf324122023-01-14 14:07:17 -08001572
1573 case ERROR_NO_DATA: {
1574 /* No adapters were found. */
1575- uv_address_buf = uv__malloc(1);
1576+ uv_address_buf = (uv_interface_address_t*)uv__malloc(1);
1577 if (uv_address_buf == NULL)
1578 return UV_ENOMEM;
1579
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001580@@ -859,7 +860,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
James Kuszmaulcf324122023-01-14 14:07:17 -08001581 }
1582
1583 /* Allocate space to store interface data plus adapter names. */
1584- uv_address_buf = uv__malloc(uv_address_buf_size);
1585+ uv_address_buf = (uv_interface_address_t*)uv__malloc(uv_address_buf_size);
1586 if (uv_address_buf == NULL) {
1587 uv__free(win_address_buf);
1588 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001589@@ -1074,7 +1075,7 @@ int uv_os_tmpdir(char* buffer, size_t* size) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001590 }
1591 /* Include space for terminating null char. */
1592 len += 1;
1593- path = uv__malloc(len * sizeof(wchar_t));
1594+ path = (wchar_t*)uv__malloc(len * sizeof(wchar_t));
1595 if (path == NULL) {
1596 return UV_ENOMEM;
1597 }
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001598@@ -1153,7 +1154,7 @@ int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001599 /* Allocate the destination buffer adding an extra byte for the terminating
1600 * NULL. If utf16len is not -1 WideCharToMultiByte will not add it, so
1601 * we do it ourselves always, just in case. */
1602- *utf8 = uv__malloc(bufsize + 1);
1603+ *utf8 = (char*)uv__malloc(bufsize + 1);
1604
1605 if (*utf8 == NULL)
1606 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001607@@ -1201,7 +1202,7 @@ int uv__convert_utf8_to_utf16(const char* utf8, int utf8len, WCHAR** utf16) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001608 /* Allocate the destination buffer adding an extra byte for the terminating
1609 * NULL. If utf8len is not -1 MultiByteToWideChar will not add it, so
1610 * we do it ourselves always, just in case. */
1611- *utf16 = uv__malloc(sizeof(WCHAR) * (bufsize + 1));
1612+ *utf16 = (WCHAR*)uv__malloc(sizeof(WCHAR) * (bufsize + 1));
1613
1614 if (*utf16 == NULL)
1615 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001616@@ -1242,7 +1243,7 @@ static int uv__getpwuid_r(uv_passwd_t* pwd) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001617 return uv_translate_sys_error(r);
1618 }
1619
1620- path = uv__malloc(bufsize * sizeof(wchar_t));
1621+ path = (wchar_t*)uv__malloc(bufsize * sizeof(wchar_t));
1622 if (path == NULL) {
1623 CloseHandle(token);
1624 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001625@@ -1323,7 +1324,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001626
1627 for (penv = env, i = 0; *penv != L'\0'; penv += wcslen(penv) + 1, i++);
1628
1629- *envitems = uv__calloc(i, sizeof(**envitems));
1630+ *envitems = (uv_env_item_t*)uv__calloc(i, sizeof(**envitems));
1631 if (*envitems == NULL) {
1632 FreeEnvironmentStringsW(env);
1633 return UV_ENOMEM;
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001634@@ -1413,7 +1414,7 @@ int uv_os_getenv(const char* name, char* buffer, size_t* size) {
James Kuszmaulcf324122023-01-14 14:07:17 -08001635 uv__free(var);
1636
1637 varlen = 1 + len;
1638- var = uv__malloc(varlen * sizeof(*var));
1639+ var = (wchar_t*)uv__malloc(varlen * sizeof(*var));
1640
1641 if (var == NULL) {
1642 r = UV_ENOMEM;