From 8f170cf0334e6b6d0c0d69c5a16cca7670df6d2a Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 11 Nov 2019 09:47:38 +0000 Subject: [PATCH] Cast uint8* in InterruptibleRecv to char* for recv Fixes a Windows-specific compile bug introduced in #4212. Closes #4214. --- src/netbase.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/netbase.cpp b/src/netbase.cpp index 9f8a69c9246..fe41133997b 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -254,7 +254,13 @@ bool static InterruptibleRecv(uint8_t* data, size_t len, int timeout, SOCKET& hS // to break off in case of an interruption. const int64_t maxWait = 1000; while (len > 0 && curTime < endTime) { - ssize_t ret = recv(hSocket, data, len, 0); // Optimistically try the recv first + // Optimistically try the recv first. + // + // POSIX recv() does not require a cast, as it takes a void *buf: + // ssize_t recv(int sockfd, void *buf, size_t len, int flags); + // However Windows explicitly requires a char *buf: + // int recv(SOCKET s, char *buf, int len, int flags); + ssize_t ret = recv(hSocket, reinterpret_cast(data), len, 0); if (ret > 0) { len -= ret; data += ret;