]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/gsocket.cpp
undef wxUSE_DIALUP_MANAGER before redefining it as 0
[wxWidgets.git] / src / unix / gsocket.cpp
index 100beaa553a4f200770a3f5e94ff6fabf913c42b..8e48f63cdf27023de93876ad0304cf2581c6320f 100644 (file)
 #endif
 
 #ifndef __GSOCKET_STANDALONE__
-#include "wx/setup.h"
-#endif
-
-#ifndef WXUNUSED
-#define WXUNUSED(x)
+#include "wx/defs.h"
 #endif
 
 #if defined(__VISAGECPP__)
-/* Seems to be needed by Visual Age C++, though I don't see how it manages
-   to not break on including a C++ header into a plain C source file      */
-#include "wx/defs.h"
 #define BSD_SELECT /* use Berkley Sockets select */
 #endif
 
@@ -118,26 +111,26 @@ int _System soclose(int);
 #endif
 #include <signal.h>
 
-#ifndef SOCKLEN_T
+#ifndef WX_SOCKLEN_T
 
 #ifdef VMS
-#  define SOCKLEN_T unsigned int
+#  define WX_SOCKLEN_T unsigned int
 #else
 #  ifdef __GLIBC__
 #    if __GLIBC__ == 2
-#      define SOCKLEN_T socklen_t
+#      define WX_SOCKLEN_T socklen_t
 #    endif
 #  elif defined(__WXMAC__)
-#    define SOCKLEN_T socklen_t
+#    define WX_SOCKLEN_T socklen_t
 #  else
-#    define SOCKLEN_T int
+#    define WX_SOCKLEN_T int
 #  endif
 #endif
 
 #endif /* SOCKLEN_T */
 
 #ifndef SOCKOPTLEN_T
-#define SOCKOPTLEN_T SOCKLEN_T
+#define SOCKOPTLEN_T WX_SOCKLEN_T
 #endif
 
 /*
@@ -195,6 +188,9 @@ int _System soclose(int);
 #else
 #  include "gsockunx.h"
 #  include "gsocket.h"
+#  ifndef WXUNUSED
+#    define WXUNUSED(x)
+#  endif
 #endif /* __GSOCKET_STANDALONE__ */
 
 /* debugging helpers */
@@ -415,7 +411,7 @@ GAddress *GSocket::GetLocal()
 {
   GAddress *address;
   struct sockaddr addr;
-  SOCKLEN_T size = sizeof(addr);
+  WX_SOCKLEN_T size = sizeof(addr);
   GSocketError err;
 
   assert(this);
@@ -431,7 +427,7 @@ GAddress *GSocket::GetLocal()
     return NULL;
   }
 
-  if (getsockname(m_fd, &addr, (SOCKLEN_T *) &size) < 0)
+  if (getsockname(m_fd, &addr, (WX_SOCKLEN_T *) &size) < 0)
   {
     m_error = GSOCK_IOERR;
     return NULL;
@@ -533,7 +529,7 @@ GSocketError GSocket::SetServer()
   if ((bind(m_fd, m_local->m_addr, m_local->m_len) != 0) ||
       (getsockname(m_fd,
                    m_local->m_addr,
-                   (SOCKLEN_T *) &m_local->m_len) != 0) ||
+                   (WX_SOCKLEN_T *) &m_local->m_len) != 0) ||
       (listen(m_fd, 5) != 0))
   {
     Close();
@@ -559,7 +555,7 @@ GSocketError GSocket::SetServer()
 GSocket *GSocket::WaitConnection()
 {
   struct sockaddr from;
-  SOCKLEN_T fromlen = sizeof(from);
+  WX_SOCKLEN_T fromlen = sizeof(from);
   GSocket *connection;
   GSocketError err;
   int arg = 1;
@@ -590,7 +586,7 @@ GSocket *GSocket::WaitConnection()
     return NULL;
   }
 
-  connection->m_fd = accept(m_fd, &from, (SOCKLEN_T *) &fromlen);
+  connection->m_fd = accept(m_fd, &from, (WX_SOCKLEN_T *) &fromlen);
 
   /* Reenable CONNECTION events */
   Enable(GSOCK_CONNECTION);
@@ -839,7 +835,7 @@ GSocketError GSocket::SetNonOriented()
   if ((bind(m_fd, m_local->m_addr, m_local->m_len) != 0) ||
       (getsockname(m_fd,
                    m_local->m_addr,
-                   (SOCKLEN_T *) &m_local->m_len) != 0))
+                   (WX_SOCKLEN_T *) &m_local->m_len) != 0))
   {
     Close();
     m_error = GSOCK_IOERR;
@@ -1332,7 +1328,7 @@ int GSocket::Recv_Stream(char *buffer, int size)
 int GSocket::Recv_Dgram(char *buffer, int size)
 {
   struct sockaddr from;
-  SOCKLEN_T fromlen = sizeof(from);
+  WX_SOCKLEN_T fromlen = sizeof(from);
   int ret;
   GSocketError err;
 
@@ -1340,7 +1336,7 @@ int GSocket::Recv_Dgram(char *buffer, int size)
 
   do
   {
-    ret = recvfrom(m_fd, buffer, size, 0, &from, (SOCKLEN_T *) &fromlen);
+    ret = recvfrom(m_fd, buffer, size, 0, &from, (WX_SOCKLEN_T *) &fromlen);
   } while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
 
   if (ret == -1)