From 2561f1db94ff1c03e5859ed17ab5cbdc44e2d4c0 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Sat, 25 May 2019 07:34:32 +0100 Subject: [PATCH] Avoid conversion warnings calling Windows sockets Some Windows socket functions accepts char* instead of classic void* causing some warning. Force the cast. Signed-off-by: Frediano Ziglio --- server/sys-socket.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/sys-socket.h b/server/sys-socket.h index 0bee3f20..b13ecdee 100644 --- a/server/sys-socket.h +++ b/server/sys-socket.h @@ -48,7 +48,7 @@ void socket_win32_set_errno(void); static inline ssize_t socket_read(int sock, void *buf, size_t count) { - ssize_t res = recv(sock, buf, count, 0); + ssize_t res = recv(sock, (char *) buf, count, 0); if (res < 0) { socket_win32_set_errno(); } @@ -57,7 +57,7 @@ static inline ssize_t socket_read(int sock, void *buf, size_t count) static inline ssize_t socket_write(int sock, const void *buf, size_t count) { - ssize_t res = send(sock, buf, count, 0); + ssize_t res = send(sock, (const char *) buf, count, 0); if (res < 0) { socket_win32_set_errno(); } @@ -82,7 +82,7 @@ static inline ssize_t socket_writev(int sock, const struct iovec *iov, int n_iov static inline int socket_getsockopt(int sock, int lvl, int type, void *value, socklen_t *len) { - int res = getsockopt(sock, lvl, type, value, len); + int res = getsockopt(sock, lvl, type, (char *) value, len); if (res < 0) { socket_win32_set_errno(); } @@ -94,7 +94,7 @@ socket_getsockopt(int sock, int lvl, int type, void *value, socklen_t *len) static inline int socket_setsockopt(int sock, int lvl, int type, const void *value, socklen_t len) { - int res = setsockopt(sock, lvl, type, value, len); + int res = setsockopt(sock, lvl, type, (const char*) value, len); if (res < 0) { socket_win32_set_errno(); }