]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/gsocket.c
fixed crash in OnChar() after m_key_current was deleted
[wxWidgets.git] / src / os2 / gsocket.c
index dadf5ae88676a159cd5ef8a8d0c3e72c80016562..339142966014bc47df0aa39a6f2275423144d110 100644 (file)
@@ -7,6 +7,12 @@
  */
 
 #include "wx/setup.h"
+#ifndef __EMX__
+/* I don't see, why this include is needed, but it seems to be necessary
+   sometimes. For EMX, including C++ headers into plain C source breaks
+   compilation, so don't do it there.                                   */
+#include "wx/defs.h"
+#endif
 
 #if wxUSE_SOCKETS
 
@@ -36,7 +42,9 @@
 #include <sys\socket.h>
 #include <sys\ioctl.h>
 #include <sys\select.h>
-#ifndef __EMX__
+#ifdef __EMX__
+#define soclose(a) close(a)
+#else
 #define select(a,b,c,d,e) bsdselect(a,b,c,d,e)
 int _System bsdselect(int,
                       struct fd_set *,
@@ -110,9 +118,6 @@ GSocket *GSocket_new()
                                 /* 10 minutes * 60 sec * 1000 millisec */
   socket->m_establishing        = FALSE;
 
-  /* We initialize the GUI specific entries here */
-  _GSocket_GUI_Init(socket);
-
   return socket;
 }
 
@@ -124,9 +129,6 @@ void GSocket_destroy(GSocket *socket)
   if (socket->m_fd != -1)
     GSocket_Shutdown(socket);
 
-  /* We destroy GUI specific variables */
-  _GSocket_GUI_Destroy(socket);
-
   /* We destroy private addresses */
   if (socket->m_local)
     GAddress_destroy(socket->m_local);
@@ -157,7 +159,7 @@ void GSocket_Shutdown(GSocket *socket)
     socket->m_cbacks[evt] = NULL;
 
   socket->m_detected = 0;
-  _GSocket_Disable_Events(socket);
+  (socket);
 }
 
 /* Address handling */
@@ -288,7 +290,6 @@ GSocketError GSocket_SetServer(GSocket *sck)
   }
 
   ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(int));
-  _GSocket_Enable_Events(sck);
 
   /* Bind the socket to the LOCAL address */
   if (bind(sck->m_fd, sck->m_local->m_addr, sck->m_local->m_len) < 0) {
@@ -364,8 +365,6 @@ GSocket *GSocket_WaitConnection(GSocket *socket)
   connection->m_oriented = TRUE;
 
   ioctl(connection->m_fd, FIONBIO, (char*)&arg, sizeof(int));
-  _GSocket_Enable_Events(connection);
-
   return connection;
 }
 
@@ -400,7 +399,6 @@ GSocketError GSocket_SetNonOriented(GSocket *sck)
   }
 
   ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(int));
-  _GSocket_Enable_Events(sck);
 
   /* Bind it to the LOCAL address */
   if (bind(sck->m_fd, sck->m_local->m_addr, sck->m_local->m_len) < 0) {
@@ -466,7 +464,6 @@ GSocketError GSocket_Connect(GSocket *sck, GSocketStream stream)
   }
 
   ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(int));
-  _GSocket_Enable_Events(sck);
 
   /* Connect it to the PEER address */
   ret = connect(sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len);
@@ -724,13 +721,12 @@ void GSocket_UnsetCallback(GSocket *socket, GSocketEventFlags flags)
 void _GSocket_Enable(GSocket *socket, GSocketEvent event)
 {
   socket->m_detected &= ~(1 << event);
-  _GSocket_Install_Callback(socket, event);
+  (socket, event);
 }
 
 void _GSocket_Disable(GSocket *socket, GSocketEvent event)
 {
   socket->m_detected |= (1 << event);
-  _GSocket_Uninstall_Callback(socket, event);
 }
 
 /* _GSocket_Input_Timeout:
@@ -1118,6 +1114,11 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname)
   return GSOCK_NOERROR;
 }
 
+GSocketError GAddress_INET_SetAnyAddress(GAddress *address)
+{
+  return GAddress_INET_SetHostAddress(address, INADDR_ANY);
+}
+
 GSocketError GAddress_INET_SetHostAddress(GAddress *address,
                                           unsigned long hostaddr)
 {
@@ -1227,5 +1228,32 @@ unsigned short GAddress_INET_GetPort(GAddress *address)
   return ntohs(addr->sin_port);
 }
 
+/*
+ * -------------------------------------------------------------------------
+ * Unix address family
+ * -------------------------------------------------------------------------
+ */
+
+GSocketError _GAddress_Init_UNIX(GAddress *address)
+{
+  assert (address != NULL);
+  address->m_error = GSOCK_INVADDR;
+  return GSOCK_INVADDR;
+}
+
+GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path)
+{
+  assert (address != NULL);
+  address->m_error = GSOCK_INVADDR;
+  return GSOCK_INVADDR;
+}
+
+GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf)
+{
+  assert (address != NULL);
+  address->m_error = GSOCK_INVADDR;
+  return GSOCK_INVADDR;
+}
+
 #endif
   /* wxUSE_SOCKETS */