summaryrefslogtreecommitdiff
path: root/src/net/SocketError.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-12 10:22:20 +0100
committerMax Kellermann <max@musicpd.org>2017-12-12 10:22:20 +0100
commitdfaf08743cade4c10c464bfbbb15d8f96c6e5cd9 (patch)
tree09be190640403b134b8967e1daf0d72445b146ed /src/net/SocketError.hxx
parentd9552d8a6d2fbc916e5a7bf6e75c2d3b4f29c38e (diff)
*: check defined(_WIN32) instead of defined(WIN32)
Only _WIN32 is defined by the compiler, and WIN32 is not standardized and may be missing. Closes #169
Diffstat (limited to 'src/net/SocketError.hxx')
-rw-r--r--src/net/SocketError.hxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/net/SocketError.hxx b/src/net/SocketError.hxx
index 6e3a7799c..c4caac646 100644
--- a/src/net/SocketError.hxx
+++ b/src/net/SocketError.hxx
@@ -23,7 +23,7 @@
#include "Compiler.h"
#include "system/Error.hxx"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
typedef DWORD socket_error_t;
#else
@@ -35,7 +35,7 @@ gcc_pure
static inline socket_error_t
GetSocketError() noexcept
{
-#ifdef WIN32
+#ifdef _WIN32
return WSAGetLastError();
#else
return errno;
@@ -46,7 +46,7 @@ gcc_const
static inline bool
IsSocketErrorAgain(socket_error_t code) noexcept
{
-#ifdef WIN32
+#ifdef _WIN32
return code == WSAEINPROGRESS;
#else
return code == EAGAIN;
@@ -57,7 +57,7 @@ gcc_const
static inline bool
IsSocketErrorInterruped(socket_error_t code) noexcept
{
-#ifdef WIN32
+#ifdef _WIN32
return code == WSAEINTR;
#else
return code == EINTR;
@@ -68,7 +68,7 @@ gcc_const
static inline bool
IsSocketErrorClosed(socket_error_t code) noexcept
{
-#ifdef WIN32
+#ifdef _WIN32
return code == WSAECONNRESET;
#else
return code == EPIPE || code == ECONNRESET;
@@ -81,7 +81,7 @@ IsSocketErrorClosed(socket_error_t code) noexcept
* and this class hosts the buffer.
*/
class SocketErrorMessage {
-#ifdef WIN32
+#ifdef _WIN32
char msg[256];
#else
const char *const msg;
@@ -99,7 +99,7 @@ gcc_const
static inline std::system_error
MakeSocketError(socket_error_t code, const char *msg) noexcept
{
-#ifdef WIN32
+#ifdef _WIN32
return MakeLastError(code, msg);
#else
return MakeErrno(code, msg);