From b61174b4b0792ff12c189fb7e8d014e8e98211fd Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Mon, 14 Feb 2022 11:53:07 +0100 Subject: [PATCH] mingw: correct winsock recv() and send() buffer ptr type This allows to build libwebsockets on MinGW. Winsock recv() and send() expect non unsigned char* while lws uses uint_8*. https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv --- lib/plat/windows/windows-sockets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plat/windows/windows-sockets.c b/lib/plat/windows/windows-sockets.c index 6bbc066b8..9e8ce2656 100644 --- a/lib/plat/windows/windows-sockets.c +++ b/lib/plat/windows/windows-sockets.c @@ -604,7 +604,7 @@ lws_plat_mbedtls_net_send(void *ctx, const uint8_t *buf, size_t len) if (fd < 0) return MBEDTLS_ERR_NET_INVALID_CONTEXT; - ret = send(fd, buf, (unsigned int)len, 0); + ret = send(fd, (const char *)buf, (unsigned int)len, 0); if (ret >= 0) return ret; @@ -629,7 +629,7 @@ lws_plat_mbedtls_net_recv(void *ctx, unsigned char *buf, size_t len) if (fd < 0) return MBEDTLS_ERR_NET_INVALID_CONTEXT; - ret = (int)recv(fd, buf, (unsigned int)len, 0); + ret = (int)recv(fd, (char *)buf, (unsigned int)len, 0); if (ret >= 0) return ret;