mirror of
https://github.com/mfontanini/libtins
synced 2026-01-30 05:24:26 +01:00
Merge pull request #47 from zhiweicai/ipaddress-win-fix
Ipaddress win fix
This commit is contained in:
@@ -81,7 +81,7 @@ uint32_t IPv4Address::ip_to_int(const char* ip) {
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
in_addr addr;
|
in_addr addr;
|
||||||
if(InetPtonA(AF_INET, ip, &addr)) {
|
if(InetPtonA(AF_INET, ip, &addr)) {
|
||||||
return addr.s_addr;
|
return Endian::be_to_host(addr.s_addr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw std::runtime_error("Invalid ip address");
|
throw std::runtime_error("Invalid ip address");
|
||||||
|
|||||||
Reference in New Issue
Block a user