diff --git a/client/connection.cpp b/client/connection.cpp index 2bac908..bbeb33c 100644 --- a/client/connection.cpp +++ b/client/connection.cpp @@ -111,7 +111,7 @@ Connection::Connection() noexcept uint16_t port = Socket::DefaultPort; std::string serverName = DEFAULT_REMOTE_HOST; -#if defined(WIN32) +#if defined(_MSC_VER) WSADATA wsaData; if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { std::cerr << "Windows sockets failed to initialise." << std::endl; @@ -192,7 +192,7 @@ Connection::~Connection() } } -#if defined(WIN32) +#if defined(_MSC_VER) WSACleanup(); #endif } diff --git a/common/socket.cpp b/common/socket.cpp index e81cdb3..43b4c10 100644 --- a/common/socket.cpp +++ b/common/socket.cpp @@ -20,7 +20,7 @@ #include #include "hints.h" -#if defined(WIN32) +#if defined(_MSC_VER) #include #include #else @@ -71,11 +71,11 @@ RemoteCL::Socket::Socket() throw Error(); } #if !defined(REMOTECL_DISABLE_KEEP_ALIVE) -#if defined(WIN32) +#if defined(_MSC_VER) using ValTy = const char*; #else // everyone else using ValTy = const void*; -#endif // WIN32 +#endif // _MSC_VER int val = -1; int result = setsockopt(mSocket, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast(&val), sizeof(val)); if (result != 0) { @@ -181,7 +181,7 @@ Socket::PeerName RemoteCL::Socket::getPeerName() noexcept void RemoteCL::Socket::close() noexcept { assert(mSocket != InvalidSocket); -#if !defined(WIN32) +#if !defined(_MSC_VER) #define closesocket(X) ::close(X) #endif closesocket(mSocket); diff --git a/common/socket.h b/common/socket.h index 5bd6925..ff91aaf 100644 --- a/common/socket.h +++ b/common/socket.h @@ -21,7 +21,7 @@ #include #include // for std::swap -#if defined(WIN32) +#if defined(_MSC_VER) #include #endif @@ -31,7 +31,7 @@ namespace RemoteCL class Socket { public: -#if !defined(WIN32) +#if !defined(_MSC_VER) using SocketTy = int; static constexpr SocketTy InvalidSocket = -1; #else