X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/483c6690e98d6ad41b37f02d29b63a26b68a07c0..a14e57f9f7d2e2b3b5d5aa7bf323efe907485408:/src/msw/gsocket.c diff --git a/src/msw/gsocket.c b/src/msw/gsocket.c index b5ed04ea14..8b10260d76 100644 --- a/src/msw/gsocket.c +++ b/src/msw/gsocket.c @@ -6,13 +6,20 @@ * ------------------------------------------------------------------------- */ -#ifdef __WXMSW__ +#ifndef __GSOCKET_STANDALONE__ #include "wx/setup.h" +#endif + +#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) + + +#ifndef __GSOCKET_STANDALONE__ + #include "wx/msw/gsockmsw.h" #include "wx/gsocket.h" -#define INSTANCE wxhInstance +#define INSTANCE wxGetInstance() #else @@ -23,12 +30,10 @@ * be available and it must containt the app's instance * handle. */ -#define INSTANCE hInst - -#endif /* __WXMSW__ */ +#define INSTANCE hInst +#endif /* __GSOCKET_STANDALONE__ */ -#if !defined(__WXMSW__) || (defined(__WXMSW__) && wxUSE_SOCKETS) #include #include @@ -137,7 +142,7 @@ GSocket *GSocket_new() socket->m_stream = TRUE; socket->m_non_blocking = FALSE; socket->m_timeout.tv_sec = 10 * 60; /* 10 minutes */ - socket->m_timeout.tv_usec = 0; + socket->m_timeout.tv_usec = 0; /* Allocate a new message number for this socket */ EnterCriticalSection(&critical); @@ -371,7 +376,7 @@ GSocketError GSocket_SetServer(GSocket *sck) } return GSOCK_NOERROR; -} +} /* GSocket_WaitConnection: * Waits for an incoming client connection. @@ -819,7 +824,7 @@ void _GSocket_Configure_Callbacks(GSocket *socket) case GSOCK_OUTPUT: mask |= FD_WRITE; break; case GSOCK_CONNECTION: mask |= (FD_ACCEPT | FD_CONNECT); break; case GSOCK_LOST: mask |= FD_CLOSE; break; - } + } } } @@ -929,7 +934,7 @@ GSocketError _GSocket_Output_Timeout(GSocket *socket) int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size) { int ret; - + ret = recv(socket->m_fd, buffer, size, 0); if (ret == SOCKET_ERROR) @@ -948,7 +953,7 @@ int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size) int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size) { struct sockaddr from; - SOCKLEN_T fromlen; + SOCKLEN_T fromlen; int ret; fromlen = sizeof(from); @@ -1217,7 +1222,7 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname) addr = &(((struct sockaddr_in *)address->m_addr)->sin_addr); addr->s_addr = inet_addr(hostname); - + /* If it is a numeric host name, convert it now */ if (addr->s_addr == INADDR_NONE) { @@ -1264,7 +1269,7 @@ GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, address->m_error = GSOCK_INVPORT; return GSOCK_INVOP; } - + se = getservbyname(port, protocol); if (!se) { @@ -1294,7 +1299,7 @@ GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port) assert(address != NULL); CHECK_ADDRESS(address, INET, GSOCK_INVADDR); - + addr = (struct sockaddr_in *)address->m_addr; addr->sin_port = htons(port); @@ -1307,7 +1312,7 @@ GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, size_t char *addr_buf; struct sockaddr_in *addr; - assert(address != NULL); + assert(address != NULL); CHECK_ADDRESS(address, INET, GSOCK_INVADDR); addr = (struct sockaddr_in *)address->m_addr; @@ -1329,8 +1334,8 @@ unsigned long GAddress_INET_GetHostAddress(GAddress *address) { struct sockaddr_in *addr; - assert(address != NULL); - CHECK_ADDRESS(address, INET, 0); + assert(address != NULL); + CHECK_ADDRESS(address, INET, 0); addr = (struct sockaddr_in *)address->m_addr; @@ -1341,8 +1346,8 @@ unsigned short GAddress_INET_GetPort(GAddress *address) { struct sockaddr_in *addr; - assert(address != NULL); - CHECK_ADDRESS(address, INET, 0); + assert(address != NULL); + CHECK_ADDRESS(address, INET, 0); addr = (struct sockaddr_in *)address->m_addr; return ntohs(addr->sin_port); @@ -1376,7 +1381,8 @@ GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf) } -#endif /* !defined(__WXMSW__) || (defined(__WXMSW__) && wxUSE_SOCKETS) */ +#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ +