]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/sockets.cpp
default texture is notex, not textures/ dir
[xonotic/netradiant.git] / radiant / sockets.cpp
index e08680beda0f47e45a8374933819cf42ea047d92..cf5d2dd7588a7cf3c1f44b4a9a0c7f437fd8dc3c 100644 (file)
@@ -1,47 +1,47 @@
-
 #include "sockets.h"
+#include "globaldefs.h"
 
-#if defined(WIN32)
+#if GDEF_OS_WINDOWS
 #include <winsock2.h>
-#elif defined (POSIX)
+#elif GDEF_OS_POSIX
+
 #include <sys/time.h>
-#define SOCKET_ERROR -1
+
+const int SOCKET_ERROR = -1;
 #else
 #error "unsupported platform"
 #endif
 
-#ifdef __APPLE__
+#if GDEF_OS_MACOS
 #include <unistd.h>
 #endif
 
 int Net_Wait(socket_t *sock, long sec, long usec)
 {
 // used for select()
-#ifdef WIN32
-  TIMEVAL tout = { sec, usec };
+#if GDEF_OS_WINDOWS
+    TIMEVAL tout = { sec, usec };
 #endif
-#if defined (POSIX)
-       timeval tout;
-       tout.tv_sec = sec;
-       tout.tv_usec = usec;
+#if GDEF_OS_POSIX
+    timeval tout;
+    tout.tv_sec = sec;
+    tout.tv_usec = usec;
 #endif
 
-  // select() will identify if the socket needs an update
-  // if the socket is identified that means there's either a message or the connection has been closed/reset/terminated
-  fd_set readfds;
-  FD_ZERO(&readfds);
-  FD_SET(((unsigned int)sock->socket), &readfds);
-       // from select man page:
-       // n is the highest-numbered descriptor in any of the three sets, plus 1
-       // (no use on windows)
-  switch( select( sock->socket + 1, &readfds, 0, 0, &tout ) )
-  {
-  case SOCKET_ERROR:
-    return -1;
-  case 0:
-    return 0;
-  default:
-    return 1;
-  }
+    // select() will identify if the socket needs an update
+    // if the socket is identified that means there's either a message or the connection has been closed/reset/terminated
+    fd_set readfds;
+    FD_ZERO(&readfds);
+    FD_SET(((unsigned int) sock->socket), &readfds);
+    // from select man page:
+    // n is the highest-numbered descriptor in any of the three sets, plus 1
+    // (no use on windows)
+    switch (select(sock->socket + 1, &readfds, 0, 0, &tout)) {
+        case SOCKET_ERROR:
+            return -1;
+        case 0:
+            return 0;
+        default:
+            return 1;
+    }
 }
-