Handle broken inet_ntop on old Windows SDKs.

This commit is contained in:
Bartosz Taudul 2020-08-11 22:37:46 +02:00
parent ea9475dfdf
commit 9455c92712

View File

@ -566,8 +566,10 @@ IpAddress::~IpAddress()
void IpAddress::Set( const struct sockaddr& addr ) void IpAddress::Set( const struct sockaddr& addr )
{ {
#if __MINGW32__ #if defined _WIN32 && ( !defined NTDDI_WIN10 || NTDDI_VERSION < NTDDI_WIN10 )
auto ai = (struct sockaddr_in*)&addr; struct sockaddr_in tmp;
memcpy( &tmp, &addr, sizeof( tmp ) );
auto ai = &tmp;
#else #else
auto ai = (const struct sockaddr_in*)&addr; auto ai = (const struct sockaddr_in*)&addr;
#endif #endif