Fix for compiling with old windows SDK

This commit is contained in:
Thomas Bernard 2020-10-17 22:03:22 +02:00
parent 7a66f373fc
commit 138b4ff3aa
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
2 changed files with 12 additions and 4 deletions

View File

@ -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);

View File

@ -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) {