This commit is contained in:
Lynix 2018-01-26 20:41:52 +01:00
commit ce2324ea2a
3 changed files with 15 additions and 5 deletions

View File

@ -9,6 +9,15 @@
#include <cstring> #include <cstring>
#include <Nazara/Network/Debug.hpp> #include <Nazara/Network/Debug.hpp>
// some MinGW distributions seem to lack some defines
#ifndef ERROR_NOT_ENOUGH_MEMORY
#define ERROR_NOT_ENOUGH_MEMORY 8L
#endif
#ifndef WSA_NOT_ENOUGH_MEMORY
#define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
#endif
namespace Nz namespace Nz
{ {
namespace Detail namespace Detail

View File

@ -8,8 +8,8 @@
#include <Nazara/Core/MemoryHelper.hpp> #include <Nazara/Core/MemoryHelper.hpp>
#include <Nazara/Network/Win32/IpAddressImpl.hpp> #include <Nazara/Network/Win32/IpAddressImpl.hpp>
#if defined(NAZARA_COMPILER_MINGW) && __GNUC__ < 5
// Some compilers (olders versions of MinGW) are lacking Mstcpip.h which defines the following struct/#define // Some compilers (olders versions of MinGW) are lacking Mstcpip.h which defines the following struct/#define
#if (defined(__has_include) && !__has_include(<Mstcpip.h>)) || (defined(NAZARA_COMPILER_MINGW) && !defined(__has_include))
struct tcp_keepalive struct tcp_keepalive
{ {
u_long onoff; u_long onoff;

View File

@ -37,7 +37,7 @@ namespace Nz
#if NAZARA_NETWORK_POLL_SUPPORT #if NAZARA_NETWORK_POLL_SUPPORT
return m_readyToReadSockets.count(socket) != 0; return m_readyToReadSockets.count(socket) != 0;
#else #else
return FD_ISSET(socket, &m_readyToReadSockets) != 0; return FD_ISSET(socket, const_cast<fd_set*>(&m_readyToReadSockets)) != 0; //< FD_ISSET is not const-correct
#endif #endif
} }
@ -46,7 +46,7 @@ namespace Nz
#if NAZARA_NETWORK_POLL_SUPPORT #if NAZARA_NETWORK_POLL_SUPPORT
return m_readyToWriteSockets.count(socket) != 0; return m_readyToWriteSockets.count(socket) != 0;
#else #else
return FD_ISSET(socket, &m_readyToWriteSockets) != 0; return FD_ISSET(socket, const_cast<fd_set*>(&m_readyToWriteSockets)) != 0; //< FD_ISSET is not const-correct
#endif #endif
} }
@ -55,8 +55,9 @@ namespace Nz
#if NAZARA_NETWORK_POLL_SUPPORT #if NAZARA_NETWORK_POLL_SUPPORT
return m_allSockets.count(socket) != 0; return m_allSockets.count(socket) != 0;
#else #else
return FD_ISSET(socket, &m_readSockets) != 0 || // FD_ISSET is not const-correct
FD_ISSET(socket, &m_writeSockets) != 0; return FD_ISSET(socket, const_cast<fd_set*>(&m_readSockets)) != 0 ||
FD_ISSET(socket, const_cast<fd_set*>(&m_writeSockets)) != 0;
#endif #endif
} }