X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b412f9be504e07559a98ae234f30bb1bd0b2aa1f..f9b1708cf57d57bc91f4e870a4646efd1f174c3d:/src/common/socket.cpp diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 186a49a22c..e4d22c8e4a 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -185,6 +185,10 @@ int PASCAL FAR __WSAFDIsSet(SOCKET fd, fd_set FAR *set) // Some patch ///// END ///////////////////////////////////////////////////////////////////////////// +#ifdef GetClassInfo +#undef GetClassInfo +#endif + // -------------------------------------------------------------- // Module // -------------------------------------------------------------- @@ -435,6 +439,11 @@ wxSocketBase& wxSocketBase::WriteMsg(const char *buffer, size_t nbytes) { SockMsg msg; + // warning about 'cast truncates constant value' +#ifdef _MSC_VER + #pragma warning(disable: 4310) +#endif // _MSC_VER + msg.sig[0] = (char) 0xad; msg.sig[1] = (char) 0xde; msg.sig[2] = (char) 0xed; @@ -458,6 +467,10 @@ wxSocketBase& wxSocketBase::WriteMsg(const char *buffer, size_t nbytes) Write((char *)&msg, sizeof(msg)); return *this; + +#ifdef _MSC_VER + #pragma warning(default: 4310) +#endif // _MSC_VER } wxSocketBase& wxSocketBase::Unread(const char *buffer, size_t nbytes) @@ -510,10 +523,18 @@ void wxSocketBase::Discard() // If what? Who seems to need unsigned int? // BTW uint isn't even defined on wxMSW for VC++ for some reason. Even if it // were, getpeername/getsockname don't take unsigned int*, they take int*. -#if 0 -#define wxSOCKET_INT unsigned int +// +// Under glibc 2.0.7, socketbits.h declares socklen_t to be unsigned int +// and it uses *socklen_t as the 3rd parameter. Robert. + +// JACS - How can we detect this? +// Meanwhile, if your compiler complains about socklen_t, +// switch lines below. + +#if wxHAVE_GLIBC2 +# define wxSOCKET_INT socklen_t #else -#define wxSOCKET_INT int +# define wxSOCKET_INT int #endif // -------------------------------------------------------------- @@ -1590,7 +1611,12 @@ LRESULT APIENTRY _EXPORT wxSocketHandlerWndProc(HWND hWnd, UINT message, case FD_CONNECT: sk_req = wxSocketBase::EVT_CONNECT; break; + + default: + wxFAIL_MSG("invalid socket event"); + return (LRESULT)0; } + sock->OnRequest(sk_req); return (LRESULT)0;