X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/04e1eb03b0daca6fb94a87c972da527c25db032c..0b7e6e7da208b6a95fb23cb50286a09dc90d96d2:/src/unix/gsocket.c diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c index 61df9fbbcf..a43156c9a5 100644 --- a/src/unix/gsocket.c +++ b/src/unix/gsocket.c @@ -25,7 +25,7 @@ #ifdef __VMS__ #include -struct sockaddr_un { +struct sockaddr_un { u_char sun_len; /* sockaddr len including null */ u_char sun_family; /* AF_UNIX */ char sun_path[108]; /* path name (gag) */ @@ -53,7 +53,6 @@ struct sockaddr_un { #endif #include - #ifndef SOCKLEN_T #ifdef VMS @@ -102,6 +101,15 @@ struct sockaddr_un { #endif /* __GSOCKET_STANDALONE__ */ +/* redefine some GUI-only functions to do nothing in console mode */ +#if defined(wxUSE_GUI) && !wxUSE_GUI + #define _GSocket_GUI_Init(socket) + #define _GSocket_GUI_Destroy(socket) + #define _GSocket_Enable_Events(socket) + #define _GSocket_Disable_Events(socket) + #define _GSocket_Install_Callback(socket, event) + #define _GSocket_Uninstall_Callback(socket, event) +#endif /* wxUSE_GUI */ /* Global initialisers */ @@ -193,7 +201,7 @@ void GSocket_Shutdown(GSocket *socket) for (evt = 0; evt < GSOCK_MAX_EVENT; evt++) socket->m_cbacks[evt] = NULL; - socket->m_detected = 0; + socket->m_detected = GSOCK_LOST_FLAG; _GSocket_Disable_Events(socket); } @@ -751,20 +759,9 @@ int GSocket_Write(GSocket *socket, const char *buffer, int size) */ GSocketEventFlags GSocket_Select(GSocket *socket, GSocketEventFlags flags) { - GSocketEventFlags result = 0; - char c; - assert(socket != NULL); - result = flags & socket->m_detected; - - if ((flags & GSOCK_INPUT_FLAG) && - (recv(socket->m_fd, &c, 1, MSG_PEEK) > 0)) - { - result |= GSOCK_INPUT_FLAG; - } - - return result; + return flags & socket->m_detected; } /* Flags */