X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/70988afbb1280a637b78a63b6a8697da3565b4ba..267a7108512069169a855457d027cd68fed5bf2e:/src/msw/gsockmsw.c diff --git a/src/msw/gsockmsw.c b/src/msw/gsockmsw.c index 4d1eaf4111..d8ea3ae3c5 100644 --- a/src/msw/gsockmsw.c +++ b/src/msw/gsockmsw.c @@ -11,6 +11,14 @@ * PLEASE don't put C++ comments here - this is a C source file. */ +/* including rasasync.h (included from windows.h itself included from + * wx/setup.h and/or winsock.h results in this warning for + * RPCNOTIFICATION_ROUTINE + */ +#ifdef _MSC_VER +# pragma warning(disable:4115) /* named type definition in parentheses */ +#endif + #ifndef __GSOCKET_STANDALONE__ #include "wx/setup.h" #endif @@ -43,8 +51,13 @@ #include #include #include + #include +#ifdef _MSC_VER +# pragma warning(default:4115) /* named type definition in parentheses */ +#endif + #define CLASSNAME "_GSocket_Internal_Window_Class" #define WINDOWNAME "_GSocket_Internal_Window_Name" @@ -69,7 +82,7 @@ static int firstAvailable; /* Global initializers */ -bool GSocket_Init() +int GSocket_Init(void) { WSADATA wsaData; WNDCLASS winClass; @@ -108,7 +121,7 @@ bool GSocket_Init() return (WSAStartup((1 << 8) | 1, &wsaData) == 0); } -void GSocket_Cleanup() +void GSocket_Cleanup(void) { /* Destroy internal window */ DestroyWindow(hWin); @@ -240,8 +253,13 @@ void _GSocket_Enable_Events(GSocket *socket) if (socket->m_fd != INVALID_SOCKET) { - WSAAsyncSelect(socket->m_fd, hWin, socket->m_msgnumber, - FD_READ | FD_WRITE | FD_ACCEPT | FD_CONNECT | FD_CLOSE); + /* We could probably just subscribe to all events regardless + * of the socket type, but MS recommends to do it this way. + */ + long lEvent = socket->m_server? + FD_ACCEPT : (FD_READ | FD_WRITE | FD_CONNECT | FD_CLOSE); + + WSAAsyncSelect(socket->m_fd, hWin, socket->m_msgnumber, lEvent); } }