X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/70988afbb1280a637b78a63b6a8697da3565b4ba..18128cbb47b5775f20fb449dd34f36fa31776d51:/src/msw/gsockmsw.c diff --git a/src/msw/gsockmsw.c b/src/msw/gsockmsw.c index 4d1eaf4111..32131c214a 100644 --- a/src/msw/gsockmsw.c +++ b/src/msw/gsockmsw.c @@ -11,7 +11,16 @@ * 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/defs.h" #include "wx/setup.h" #endif @@ -30,7 +39,7 @@ #include "gsocket.h" /* If not using wxWindows, a global var called hInst must - * be available and it must containt the app's instance + * be available and it must contain the app's instance * handle. */ #define INSTANCE hInst @@ -43,10 +52,15 @@ #include #include #include + #include -#define CLASSNAME "_GSocket_Internal_Window_Class" -#define WINDOWNAME "_GSocket_Internal_Window_Name" +#ifdef _MSC_VER +# pragma warning(default:4115) /* named type definition in parentheses */ +#endif + +#define CLASSNAME TEXT("_GSocket_Internal_Window_Class") +#define WINDOWNAME TEXT("_GSocket_Internal_Window_Name") /* Maximum number of different GSocket objects at a given time. * This value can be modified at will, but it CANNOT be greater @@ -69,7 +83,7 @@ static int firstAvailable; /* Global initializers */ -bool GSocket_Init() +int GSocket_Init(void) { WSADATA wsaData; WNDCLASS winClass; @@ -108,7 +122,7 @@ bool GSocket_Init() return (WSAStartup((1 << 8) | 1, &wsaData) == 0); } -void GSocket_Cleanup() +void GSocket_Cleanup(void) { /* Destroy internal window */ DestroyWindow(hWin); @@ -123,7 +137,7 @@ void GSocket_Cleanup() /* Per-socket GUI initialization / cleanup */ -bool _GSocket_GUI_Init(GSocket *socket) +int _GSocket_GUI_Init(GSocket *socket) { int i; @@ -174,7 +188,7 @@ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd, { EnterCriticalSection(&critical); socket = socketList[(uMsg - WM_USER)]; - event = -1; + event = (GSocketEvent) -1; cback = NULL; data = NULL; @@ -240,8 +254,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); } } @@ -260,10 +279,10 @@ void _GSocket_Disable_Events(GSocket *socket) #else /* !wxUSE_SOCKETS */ -/* +/* * Translation unit shouldn't be empty, so include this typedef to make the * compiler (VC++ 6.0, for example) happy */ -typedef (*wxDummy)(); +typedef void (*wxDummy)(); #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */