Skip to content

Commit

Permalink
Fix some casts
Browse files Browse the repository at this point in the history
  • Loading branch information
plajjan committed Feb 14, 2024
1 parent f30ff35 commit 1196b23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion include/tlsuv/tlsuv.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
extern "C" {
#endif

typedef void* (*tlsuv_malloc_func)(size_t size);
typedef void* (*tlsuv_malloc_func)(size_t size);
typedef void* (*tlsuv_realloc_func)(void* ptr, size_t size);
typedef void* (*tlsuv_calloc_func)(size_t count, size_t size);
Expand Down
12 changes: 6 additions & 6 deletions src/tlsuv.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ int tlsuv_stream_keepalive(tlsuv_stream_t *clt, int keepalive, unsigned int dela
if (uv_fileno((const uv_handle_t *) &clt->watcher, (uv_os_fd_t *) &s) == 0) {
int count = 10;
int intvl = 1;
setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive));
setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (const char *)&keepalive, sizeof(keepalive));
#if defined(TCP_KEEPALIVE)
setsockopt(s, IPPROTO_TCP, TCP_KEEPALIVE, &delay, sizeof(delay));
setsockopt(s, IPPROTO_TCP, TCP_KEEPALIVE, (const char *)&delay, sizeof(delay));
#endif
#if __linux__
setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl));
Expand All @@ -192,7 +192,7 @@ int tlsuv_stream_keepalive(tlsuv_stream_t *clt, int keepalive, unsigned int dela
int tlsuv_stream_nodelay(tlsuv_stream_t *clt, int nodelay) {
uv_os_fd_t s;
if (uv_fileno((const uv_handle_t *) &clt->watcher, &s) == 0) {
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay));
setsockopt((unsigned long long)s, IPPROTO_TCP, TCP_NODELAY, (const char *)&nodelay, sizeof(nodelay));
}
return 0;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ static void process_connect(tlsuv_stream_t *clt, int status) {
uv_connect_t *req = clt->conn_req;
int err = 0;
socklen_t l = sizeof(err);
getsockopt(clt->sock, SOL_SOCKET, SO_ERROR, &err, &l);
getsockopt(clt->sock, SOL_SOCKET, SO_ERROR, (char *)&err, &l);

if (status == 0 && err != 0) {
#if _WIN32
Expand Down Expand Up @@ -451,7 +451,7 @@ int tlsuv_stream_open(uv_connect_t *req, tlsuv_stream_t *clt, uv_os_fd_t fd, uv_
req->cb = cb;
req->handle = (uv_stream_t *) clt;

clt->sock = fd;
clt->sock = (uv_os_sock_t)fd;
uv_poll_init_socket(clt->loop, &clt->watcher, clt->sock);
return uv_poll_start(&clt->watcher, UV_READABLE | UV_WRITABLE | UV_DISCONNECT, on_clt_io);
}
Expand All @@ -469,7 +469,7 @@ int tlsuv_stream_connect_addr(uv_connect_t *req, tlsuv_stream_t *clt, const stru
return -get_error();
}

tlsuv_stream_open(req, clt, s, cb);
tlsuv_stream_open(req, clt, (uv_os_fd_t)s, cb);

int ret = connect(clt->sock, addr->ai_addr, addr->ai_addrlen);
if (ret == -1) {
Expand Down

0 comments on commit 1196b23

Please sign in to comment.