Minor fixes

This commit is contained in:
Stephen Seo 2020-04-27 19:34:04 +09:00
parent 445a221a5b
commit d3fb621406
2 changed files with 3 additions and 2 deletions

View file

@ -1954,6 +1954,7 @@ UDPC_ConnectionId UDPC_create_id_hostname(const char *hostname, uint16_t port) {
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
addrinfo *lookupResult;
int error = getaddrinfo(hostname, nullptr, &hints, &lookupResult);
@ -3058,7 +3059,7 @@ UDPC_IPV6_ADDR_TYPE UDPC_a4toa6(uint32_t a4_be) {
uint32_t a4 = ntohl(a4_be);
if(a4 == 0x0100007F) {
if(a4 == 0x7F000001) {
return in6addr_loopback;
}

View file

@ -321,7 +321,7 @@ TEST(UDPC, NetworkOrderEndianness) {
TEST(UDPC, a4toa6) {
EXPECT_EQ(UDPC_a4toa6(0), in6addr_any);
uint32_t a4 = htonl(0x0100007F);
uint32_t a4 = htonl(0x7F000001);
EXPECT_EQ(UDPC_a4toa6(a4), in6addr_loopback);
UDPC_IPV6_ADDR_TYPE a6 = UDPC_strtoa("::FFFF:0102:0304");