diff --git a/miniupnpc/addr_is_reserved.c b/miniupnpc/addr_is_reserved.c index 8fc9f0b..c4ca2e5 100644 --- a/miniupnpc/addr_is_reserved.c +++ b/miniupnpc/addr_is_reserved.c @@ -55,13 +55,17 @@ int addr_is_reserved(const char * addr_str) uint32_t addr_n, address; size_t i; +#if defined(_WIN32) && (_WIN32_WINNT < _WIN32_WINNT_VISTA) + addr_n = inet_addr(addr_str); + if (addr_n == INADDR_NONE) + return 1; +#else /* was : addr_n = inet_addr(addr_str); */ if (inet_pton(AF_INET, addr_str, &addr_n) < 0) { /* error */ - return 0; - } - if (addr_n == INADDR_NONE) return 1; + } +#endif address = ntohl(addr_n); diff --git a/miniupnpc/minissdpc.c b/miniupnpc/minissdpc.c index db8f4b3..048cd25 100644 --- a/miniupnpc/minissdpc.c +++ b/miniupnpc/minissdpc.c @@ -717,8 +717,12 @@ ssdpDiscoverDevices(const char * const deviceTypes[], #endif } else { struct in_addr mc_if; -#if defined(_WIN32) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) +#if defined(_WIN32) +#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA) InetPtonA(AF_INET, multicastif, &mc_if); +#else + mc_if.s_addr = inet_addr(multicastif); /* old Windows SDK do not support InetPtoA() */ +#endif #else /* was : mc_if.s_addr = inet_addr(multicastif); */ /* ex: 192.168.x.x */ if (inet_pton(AF_INET, multicastif, &mc_if.s_addr) < 0) {