Fix compilation when _WIN32_WINNT_VISTA macro is not defined

Older version of i586-mingw32msvc-gcc compiler does not define
_WIN32_WINNT_VISTA macro. Therefore preprocessor #if condition is
incorrectly evaluated.
This commit is contained in:
Pali Rohár 2020-11-04 23:57:43 +01:00
parent 9d42d11779
commit 23f492fd1b
2 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ int addr_is_reserved(const char * addr_str)
uint32_t addr_n, address;
size_t i;
#if defined(_WIN32) && (_WIN32_WINNT < _WIN32_WINNT_VISTA)
#if defined(_WIN32) && (!defined(_WIN32_WINNT_VISTA) || (_WIN32_WINNT < _WIN32_WINNT_VISTA))
addr_n = inet_addr(addr_str);
if (addr_n == INADDR_NONE)
return 1;

View File

@ -454,7 +454,7 @@ parseMSEARCHReply(const char * reply, int size,
static int upnp_gettimeofday(struct timeval * tv)
{
#if defined(_WIN32)
#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
#if defined(_WIN32_WINNT_VISTA) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
ULONGLONG ts = GetTickCount64();
#else
DWORD ts = GetTickCount();
@ -714,7 +714,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
} else {
struct in_addr mc_if;
#if defined(_WIN32)
#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
#if defined(_WIN32_WINNT_VISTA) && (_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() */