Refactor IpAddressImpl.cpp (Windows) + update changelog

This commit is contained in:
Lynix 2018-04-02 16:30:39 +02:00
parent 63ee3ca8d4
commit e8e3c29f37
2 changed files with 4 additions and 10 deletions

View File

@ -78,6 +78,7 @@ Nazara Engine:
- Added Collider3D::ForEachPolygon method, allowing construction of a debug mesh based on the physics collider
- Fixed ConvexCollider3D::GetType returning Compound instead of ConvexHull.
- Dual-stack sockets are now supported (by using NetProtocol_Any at creation/opening)
- Fixed IPv6 addresses not being correctly encoded/decoded from the socket API.
Nazara Development Kit:
- Added ImageWidget (#139)

View File

@ -93,21 +93,14 @@ namespace Nz
{
sockaddr_in* ipv4 = reinterpret_cast<sockaddr_in*>(info->ai_addr);
auto& rawIpV4 = ipv4->sin_addr;
return IpAddress(rawIpV4.s_net, rawIpV4.s_host, rawIpV4.s_lh, rawIpV4.s_impno, ntohs(ipv4->sin_port));
return FromSockAddr(ipv4);
}
case AF_INET6:
{
sockaddr_in6* ipv6 = reinterpret_cast<sockaddr_in6*>(info->ai_addr);
auto& rawIpV6 = ipv6->sin6_addr.s6_addr;
IpAddress::IPv6 structIpV6;
for (unsigned int i = 0; i < 8; ++i)
structIpV6[i] = UInt16(rawIpV6[i * 2]) << 8 | UInt16(rawIpV6[i * 2 + 1]);
return IpAddress(structIpV6, ntohs(ipv6->sin6_port));
return FromSockAddr(ipv6);
}
}
@ -164,7 +157,7 @@ namespace Nz
IpAddress::IPv6 ipv6;
for (unsigned int i = 0; i < 8; ++i)
ipv6[i] = rawIpV6[i*2] << 8 | rawIpV6[i*2+1];
ipv6[i] = rawIpV6[i * 2] << 8 | rawIpV6[i * 2 + 1];
return IpAddress(ipv6, ntohs(addressv6->sin6_port));
}