From 29f67448e9820031f5544a25cdb53041714cc215 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 23 May 2023 18:01:14 +0200 Subject: [PATCH] pine: fix some warnings (#13904) --- 3rdparty/pine/pine_server.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/3rdparty/pine/pine_server.h b/3rdparty/pine/pine_server.h index d801f77c2f..37b738c81c 100644 --- a/3rdparty/pine/pine_server.h +++ b/3rdparty/pine/pine_server.h @@ -12,18 +12,20 @@ #include #include #if _WIN32 -#define read_portable(a, b, c) (recv(a, b, c, 0)) -#define write_portable(a, b, c) (send(a, b, c, 0)) +#define read_portable(a, b, c) (recv(a, b, ::narrow(c), 0)) +#define write_portable(a, b, c) (send(a, b, ::narrow(c), 0)) #define close_portable(a) (closesocket(a)) #define bzero(b, len) (memset((b), '\0', (len)), (void)0) #include #include +#include #else #define read_portable(a, b, c) (read(a, b, c)) #define write_portable(a, b, c) (write(a, b, c)) #define close_portable(a) (close(a)) #include #include +#include #include #if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) #include @@ -533,7 +535,10 @@ namespace pine // yes very good windows s/sun/sin/g sure is fine server.sin_family = AF_INET; // localhost only - server.sin_addr.s_addr = inet_addr("127.0.0.1"); + if (!inet_pton(server.sin_family, "127.0.0.1", &server.sin_addr.s_addr)) + { + fmt::throw_exception("IPC: Failed to convert localhost"); + } server.sin_port = htons(Impl::get_port()); if (bind(m_sock, (struct sockaddr*)&server, sizeof(server)) == SOCKET_ERROR)