X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/99d800190a04a2deaf769017a5fae04a4ae50378..2e2a55b22eebde25797bd030660d8c644bc7700b:/src/msw/gsocket.cpp diff --git a/src/msw/gsocket.cpp b/src/msw/gsocket.cpp index 81b4dd2daf..ac350bc4ce 100644 --- a/src/msw/gsocket.cpp +++ b/src/msw/gsocket.cpp @@ -84,9 +84,9 @@ #include #include -/* if we use configure for MSW SOCKLEN_T will be already defined */ -#ifndef SOCKLEN_T -# define SOCKLEN_T int +/* if we use configure for MSW WX_SOCKLEN_T will be already defined */ +#ifndef WX_SOCKLEN_T +# define WX_SOCKLEN_T int #endif /* Table of GUI-related functions. We must call them indirectly because @@ -299,7 +299,7 @@ GAddress *GSocket::GetLocal() { GAddress *address; struct sockaddr addr; - SOCKLEN_T size = sizeof(addr); + WX_SOCKLEN_T size = sizeof(addr); GSocketError err; assert(this); @@ -411,7 +411,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(); @@ -438,7 +438,7 @@ GSocket *GSocket::WaitConnection() { GSocket *connection; struct sockaddr from; - SOCKLEN_T fromlen = sizeof(from); + WX_SOCKLEN_T fromlen = sizeof(from); GSocketError err; u_long arg = 1; @@ -516,7 +516,7 @@ GSocket *GSocket::WaitConnection() * make the appropriate setsockopt() call. * Implemented as a GSocket function because clients (ie, wxSocketServer) * don't have access to the GSocket struct information. -* Returns true if the flag was set correctly, false if an error occured +* Returns true if the flag was set correctly, false if an error occurred * (ie, if the parameter was NULL) */ bool GSocket::SetReusable() @@ -535,7 +535,7 @@ bool GSocket::SetReusable() * For stream (connection oriented) sockets, GSocket_Connect() tries * to establish a client connection to a server using the peer address * as established with GSocket_SetPeer(). Returns GSOCK_NOERROR if the - * connection has been succesfully established, or one of the error + * connection has been successfully established, or one of the error * codes listed below. Note that for nonblocking sockets, a return * value of GSOCK_WOULDBLOCK doesn't mean a failure. The connection * request can be completed later; you should use GSocket_Select() @@ -696,7 +696,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; @@ -726,7 +726,10 @@ int GSocket::Read(char *buffer, int size) /* If the socket is blocking, wait for data (with a timeout) */ if (Input_Timeout() == GSOCK_TIMEDOUT) + { + m_error = GSOCK_TIMEDOUT; return -1; + } /* Read the data */ if (m_stream) @@ -867,7 +870,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags) if (m_establishing && !m_server) { int error; - SOCKLEN_T len = sizeof(error); + WX_SOCKLEN_T len = sizeof(error); m_establishing = false; @@ -937,7 +940,7 @@ void GSocket::SetTimeout(unsigned long millis) } /* GSocket_GetError: - * Returns the last error occured for this socket. Note that successful + * Returns the last error occurred for this socket. Note that successful * operations do not clear this back to GSOCK_NOERROR, so use it only * after an error. */ @@ -962,7 +965,7 @@ GSocketError WXDLLIMPEXP_NET GSocket::GetError() * assume that it can write since the first OUTPUT event, and no more * OUTPUT events will be generated unless an error occurs. * GSOCK_CONNECTION: - * Connection succesfully established, for client sockets, or incoming + * Connection successfully established, for client sockets, or incoming * client connection, for server sockets. Wait for this event (also watch * out for GSOCK_LOST) after you issue a nonblocking GSocket_Connect() call. * GSOCK_LOST: @@ -1114,7 +1117,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; @@ -1420,7 +1423,7 @@ GSocketError GAddress_INET_SetHostAddress(GAddress *address, CHECK_ADDRESS(address, INET); addr = &(((struct sockaddr_in *)address->m_addr)->sin_addr); - addr->s_addr = htonl(hostaddr);; + addr->s_addr = htonl(hostaddr); return GSOCK_NOERROR; }