X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ed2eb9afcb6559ad89caca8963e987d3f1151fdc..f0b1ccde63c1acd9ca18847f758603f39f22cf4b:/src/msw/gsockmsw.c diff --git a/src/msw/gsockmsw.c b/src/msw/gsockmsw.c index b8a3bda683..7bc845bed0 100644 --- a/src/msw/gsockmsw.c +++ b/src/msw/gsockmsw.c @@ -7,11 +7,36 @@ * ------------------------------------------------------------------------- */ +/* + * TODO: for WinCE we need to replace WSAAsyncSelect + * (Windows message-based notification of network events for a socket) + * with another mechanism. + * We may need to have a separate thread that polls for socket events + * using select() and sends a message to the main thread. + */ + /* * 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 + +/* This needs to be before the wx/defs/h inclusion + * for some reason + */ + +#ifdef __WXWINCE__ +#include +#endif + #ifndef __GSOCKET_STANDALONE__ +#include "wx/defs.h" #include "wx/setup.h" #endif @@ -22,6 +47,7 @@ #include "wx/msw/gsockmsw.h" #include "wx/gsocket.h" +HINSTANCE wxGetInstance(void); #define INSTANCE wxGetInstance() #else @@ -30,23 +56,35 @@ #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 #endif /* __GSOCKET_STANDALONE__ */ +#ifndef __WXWINCE__ #include +#else +#define assert(x) +#include +#include "wx/msw/wince/net.h" +#endif + #include #include #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,9 +107,8 @@ static int firstAvailable; /* Global initializers */ -bool GSocket_Init(void) +int _GSocket_GUI_Init(void) { - WSADATA wsaData; WNDCLASS winClass; int i; @@ -104,11 +141,10 @@ bool GSocket_Init(void) } firstAvailable = 0; - /* Initialize WinSocket */ - return (WSAStartup((1 << 8) | 1, &wsaData) == 0); + return 1; } -void GSocket_Cleanup(void) +void _GSocket_GUI_Cleanup(void) { /* Destroy internal window */ DestroyWindow(hWin); @@ -116,14 +152,11 @@ void GSocket_Cleanup(void) /* Delete critical section */ DeleteCriticalSection(&critical); - - /* Cleanup WinSocket */ - WSACleanup(); } /* Per-socket GUI initialization / cleanup */ -bool _GSocket_GUI_Init(GSocket *socket) +int _GSocket_GUI_Init_Socket(GSocket *socket) { int i; @@ -150,7 +183,7 @@ bool _GSocket_GUI_Init(GSocket *socket) return TRUE; } -void _GSocket_GUI_Destroy(GSocket *socket) +void _GSocket_GUI_Destroy_Socket(GSocket *socket) { /* Remove the socket from the list */ EnterCriticalSection(&critical); @@ -174,7 +207,7 @@ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd, { EnterCriticalSection(&critical); socket = socketList[(uMsg - WM_USER)]; - event = -1; + event = (GSocketEvent) -1; cback = NULL; data = NULL; @@ -265,10 +298,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__) */