Raise and clean up _WIN32_WINNT constant

This commit is contained in:
sfan5 2023-05-03 12:54:42 +02:00
parent 80574cdbe8
commit 15445a0fbe
9 changed files with 2 additions and 52 deletions

@ -719,7 +719,7 @@ endif()
if(MSVC)
# Visual Studio
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D WIN32_LEAN_AND_MEAN")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _WIN32_WINNT=0x0601 /D WIN32_LEAN_AND_MEAN")
# EHa enables SEH exceptions (used for catching segfaults)
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /MD /GS- /Zi /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0")
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
@ -762,7 +762,7 @@ else()
if(MINGW)
set(OTHER_FLAGS "${OTHER_FLAGS} -mthreads -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32_LEAN_AND_MEAN")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x0601 -DWIN32_LEAN_AND_MEAN")
endif()
# Use a safe subset of flags to speed up math calculations:

@ -23,10 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "database-postgresql.h"
#ifdef _WIN32
// Without this some of the network functions are not found on mingw
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#include <winsock2.h>
#else

@ -26,9 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#ifdef _WIN32
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#ifdef _MSC_VER
#include <eh.h>

@ -41,9 +41,6 @@ namespace fs
* Windows *
***********/
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#include <shlwapi.h>
#include <io.h>

@ -35,10 +35,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#ifdef _WIN32
// Without this some of the network functions are not found on mingw
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
@ -149,30 +145,10 @@ void Address::Resolve(const char *name)
// IP address -> textual representation
std::string Address::serializeString() const
{
// windows XP doesnt have inet_ntop, maybe use better func
#ifdef _WIN32
if (m_addr_family == AF_INET) {
return inet_ntoa(m_address.ipv4);
} else if (m_addr_family == AF_INET6) {
std::ostringstream os;
os << std::hex;
for (int i = 0; i < 16; i += 2) {
u16 section = (m_address.ipv6.s6_addr[i] << 8) |
(m_address.ipv6.s6_addr[i + 1]);
os << section;
if (i < 14)
os << ":";
}
return os.str();
} else {
return "";
}
#else
char str[INET6_ADDRSTRLEN];
if (inet_ntop(m_addr_family, (void*) &m_address, str, sizeof(str)) == nullptr)
return "";
return str;
#endif
}
struct in_addr Address::getAddress() const

@ -20,9 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once
#ifdef _WIN32
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>

@ -31,10 +31,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#ifdef _WIN32
// Without this some of the network functions are not found on mingw
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>

@ -23,14 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once
#ifdef _WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501 // We need to do this before any other headers
// because those might include sdkddkver.h which defines _WIN32_WINNT if not already set
#endif
#include <string>
#include <vector>
#include "irrlicht.h"

@ -36,7 +36,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef _WIN32
#include <iconv.h>
#else
#define _WIN32_WINNT 0x0501
#include <windows.h>
#endif