Skip to content

Commit 0e7a6ca

Browse files
committed
updates, various macOS warning fixes
1 parent 5b8812a commit 0e7a6ca

6 files changed

Lines changed: 22 additions & 23 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ find_package(raii QUIET)
2626
if(NOT raii_FOUND)
2727
FetchContent_Declare(raii
2828
URL https://github.com/zelang-dev/c-raii/archive/refs/heads/main.zip
29-
URL_MD5 f589b6e619454f480c615008f3d2772c
29+
URL_MD5 f8077e7920e2d4799bba1f056df69b01
3030
)
3131
FetchContent_MakeAvailable(raii)
3232
endif()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int uv_main(int argc, char **argv) {
150150
kv(ai_protocol, IPPROTO_TCP));
151151

152152
fprintf(stderr, "%s\033[0K\n", dns->ip_addr);
153-
uv_stream_t *server = stream_connect_ex(RAII_SCHEME_TCP, dns->ip_addr, 6667);
153+
uv_stream_t *server = stream_connect_ex(UV_TCP, dns->ip_addr, 6667);
154154
while (text = stream_read(server))
155155
fprintf(stderr, "\033[0K%s", text);
156156

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int uv_main(int argc, char **argv) {
150150
kv(ai_protocol, IPPROTO_TCP));
151151

152152
fprintf(stderr, "%s\033[0K\n", dns->ip_addr);
153-
uv_stream_t *server = stream_connect_ex(RAII_SCHEME_TCP, dns->ip_addr, 6667);
153+
uv_stream_t *server = stream_connect_ex(UV_TCP, dns->ip_addr, 6667);
154154
while (text = stream_read(server))
155155
fprintf(stderr, "\033[0K%s", text);
156156

examples/dns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ int uv_main(int argc, char **argv) {
99
kv(ai_protocol, IPPROTO_TCP));
1010

1111
fprintf(stderr, "%s\033[0K\n", dns->ip_addr);
12-
uv_stream_t *server = stream_connect_ex(RAII_SCHEME_TCP, dns->ip_addr, 6667);
12+
uv_stream_t *server = stream_connect_ex(UV_TCP, dns->ip_addr, 6667);
1313
while (text = stream_read(server))
1414
fprintf(stderr, "\033[0K%s", text);
1515

include/uv_coro.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ typedef enum {
6767
UV_CORO_TTY_0,
6868
UV_CORO_TTY_1,
6969
UV_CORO_TTY_2,
70-
UV_CORO_LISTEN = UV_CORO_TTY_2 + UV_HANDLE_TYPE_MAX,
71-
UV_CORO_ARGS
70+
UV_CORO_ARGS = UV_CORO_TTY_2 + UV_HANDLE_TYPE_MAX
7271
} uv_coro_types;
7372

7473
typedef struct {

src/uv_coro.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static void fs_event_cb(uv_fs_event_t *handle, string_t filename, int events, in
226226
data = get_coro_data(coro);
227227
this.data = data;
228228
// Does not handle error if path is longer than 1023.
229-
uv_fs_event_getpath(handle, this.charaters, &this.diff);
229+
uv_fs_event_getpath(handle, this.charaters, (size_t *)&this.diff);
230230
coro_data_set(coro, &this);
231231
watchfunc(filename, events, status);
232232
if (data == this.data)
@@ -265,7 +265,7 @@ static void fs_poll_cb(uv_fs_poll_t *handle, int status, const uv_stat_t *prev,
265265
data = get_coro_data(coro);
266266
this.data = data;
267267
// Does not handle error if path is longer than 1023.
268-
uv_fs_poll_getpath(handle, this.charaters, &this.diff);
268+
uv_fs_poll_getpath(handle, this.charaters, (size_t *)&this.diff);
269269
coro_data_set(coro, &this);
270270
pollerfunc(status, prev, curr);
271271
if (data == this.data)
@@ -871,7 +871,7 @@ static void_t uv_init(params_t uv_args) {
871871
case UV_POLL:
872872
case UV_PREPARE:
873873
break;
874-
case UV_CORO_LISTEN:
874+
case UV_HANDLE_TYPE_MAX:
875875
if (!(result = uv_listen((uv_stream_t *)stream, args[1].integer, connection_cb))) {
876876
length = (int)sizeof(uv->dns->name);
877877
switch (uv->bind_type) {
@@ -1652,7 +1652,7 @@ uv_stream_t *stream_listen(uv_stream_t *stream, int backlog) {
16521652
uv_args->args[0].object = stream;
16531653
uv_args->args[1].integer = backlog;
16541654

1655-
return (uv_stream_t *)uv_start(uv_args, UV_CORO_LISTEN, 5, false).object;
1655+
return (uv_stream_t *)uv_start(uv_args, UV_HANDLE_TYPE_MAX, 5, false).object;
16561656
}
16571657

16581658
uv_stream_t *stream_bind(string_t address, int flags) {
@@ -2511,11 +2511,11 @@ RAII_INLINE bool is_undefined(void_t self) {
25112511
}
25122512

25132513
RAII_INLINE bool is_defined(void_t self) {
2514-
return is_type(self, UV_CORO_ARGS);
2514+
return is_type(self, (raii_type)UV_CORO_ARGS);
25152515
}
25162516

25172517
RAII_INLINE bool is_process(void_t self) {
2518-
return is_type(self, UV_CORO_SPAWN);
2518+
return is_type(self, (raii_type)UV_CORO_SPAWN);
25192519
}
25202520

25212521
RAII_INLINE bool is_tls(uv_stream_t *self) {
@@ -2526,35 +2526,35 @@ RAII_INLINE bool is_tls(uv_stream_t *self) {
25262526
}
25272527

25282528
RAII_INLINE bool is_pipepair(void_t self) {
2529-
return is_type(self, UV_CORO_PIPE);
2529+
return is_type(self, (raii_type)UV_CORO_PIPE);
25302530
}
25312531

25322532
RAII_INLINE bool is_socketpair(void_t self) {
2533-
return is_type(self, UV_CORO_SOCKET);
2533+
return is_type(self, (raii_type)UV_CORO_SOCKET);
25342534
}
25352535

25362536
RAII_INLINE bool is_pipe_stdin(void_t self) {
2537-
return is_type(self, UV_CORO_PIPE_0);
2537+
return is_type(self, (raii_type)UV_CORO_PIPE_0);
25382538
}
25392539

25402540
RAII_INLINE bool is_pipe_stdout(void_t self) {
2541-
return is_type(self, UV_CORO_PIPE_1);
2541+
return is_type(self, (raii_type)UV_CORO_PIPE_1);
25422542
}
25432543

25442544
RAII_INLINE bool is_pipe_file(void_t self) {
2545-
return is_type(self, UV_CORO_PIPE_FD);
2545+
return is_type(self, (raii_type)UV_CORO_PIPE_FD);
25462546
}
25472547

25482548
RAII_INLINE bool is_tty_in(void_t self) {
2549-
return is_type(self, UV_CORO_TTY_0);
2549+
return is_type(self, (raii_type)UV_CORO_TTY_0);
25502550
}
25512551

25522552
RAII_INLINE bool is_tty_out(void_t self) {
2553-
return is_type(self, UV_CORO_TTY_1);
2553+
return is_type(self, (raii_type)UV_CORO_TTY_1);
25542554
}
25552555

25562556
RAII_INLINE bool is_tty_err(void_t self) {
2557-
return is_type(self, UV_CORO_TTY_2);
2557+
return is_type(self, (raii_type)UV_CORO_TTY_2);
25582558
}
25592559

25602560
RAII_INLINE bool is_tty(void_t self) {
@@ -2586,15 +2586,15 @@ RAII_INLINE bool is_udp(void_t self) {
25862586
}
25872587

25882588
RAII_INLINE bool is_udp_packet(void_t self) {
2589-
return is_type(self, UV_CORO_UDP);
2589+
return is_type(self, (raii_type)UV_CORO_UDP);
25902590
}
25912591

25922592
RAII_INLINE bool is_nameinfo(void_t self) {
2593-
return is_type(self, UV_CORO_NAME);
2593+
return is_type(self, (raii_type)UV_CORO_NAME);
25942594
}
25952595

25962596
RAII_INLINE bool is_addrinfo(void_t self) {
2597-
return is_type(self, UV_CORO_DNS);
2597+
return is_type(self, (raii_type)UV_CORO_DNS);
25982598
}
25992599

26002600
string_t uv_coro_uname(void) {

0 commit comments

Comments
 (0)