From 29e118b512ed5b0b5bb3df86c432139687f477ca Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 24 Feb 2015 00:02:24 -0800 Subject: [PATCH] Util: Fix C++ build for Win32 --- src/platform/qt/GBAApp.cpp | 1 + src/util/socket.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/platform/qt/GBAApp.cpp b/src/platform/qt/GBAApp.cpp index ca5ae51e1..8eccfd807 100644 --- a/src/platform/qt/GBAApp.cpp +++ b/src/platform/qt/GBAApp.cpp @@ -12,6 +12,7 @@ extern "C" { #include "platform/commandline.h" +#include "util/socket.h" } using namespace QGBA; diff --git a/src/util/socket.h b/src/util/socket.h index 76cfd8a88..c676fb737 100644 --- a/src/util/socket.h +++ b/src/util/socket.h @@ -67,11 +67,19 @@ static inline bool SocketWouldBlock() { } static inline ssize_t SocketSend(Socket socket, const void* buffer, size_t size) { - return send(socket, buffer, size, 0); +#ifdef _WIN32 + return send(socket, (const char*) buffer, size, 0); +#else + return write(socket, buffer, size); +#endif } static inline ssize_t SocketRecv(Socket socket, void* buffer, size_t size) { - return recv(socket, buffer, size, 0); +#ifdef _WIN32 + return recv(socket, (char*) buffer, size, 0); +#else + return read(socket, buffer, size); +#endif } static inline Socket SocketOpenTCP(int port, const struct Address* bindAddress) {