Skip to content

Commit

Permalink
Replace WIN32 with _MSC_VER
Browse files Browse the repository at this point in the history
At some point this guard started failing and I don't know when that
happened.
  • Loading branch information
silverclaw committed Jun 12, 2024
1 parent 71a87c2 commit 058fe15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions client/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -192,7 +192,7 @@ Connection::~Connection()
}
}

#if defined(WIN32)
#if defined(_MSC_VER)
WSACleanup();
#endif
}
8 changes: 4 additions & 4 deletions common/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <iostream>
#include "hints.h"

#if defined(WIN32)
#if defined(_MSC_VER)
#include <WinSock2.h>
#include <WS2tcpip.h>
#else
Expand Down Expand Up @@ -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<ValTy>(&val), sizeof(val));
if (result != 0) {
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions common/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <cstdint>
#include <utility> // for std::swap

#if defined(WIN32)
#if defined(_MSC_VER)
#include <WinSock2.h>
#endif

Expand All @@ -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
Expand Down

0 comments on commit 058fe15

Please sign in to comment.