Problem: build targeting Windows XP is broken

Solution: fix build issues
This commit is contained in:
Simon Giesecke
2019-10-19 13:38:33 +02:00
parent 92e3226869
commit 7f43e7ff75
6 changed files with 17 additions and 12 deletions

View File

@@ -581,7 +581,7 @@ int zmq::ip_resolver_t::get_interface_name (unsigned long index_,
char *if_name_result = NULL; char *if_name_result = NULL;
#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP && !defined ZMQ_HAVE_WINDOWS_UWP #if _WIN32_WINNT > _WIN32_WINNT_WINXP && !defined ZMQ_HAVE_WINDOWS_UWP
if_name_result = if_indextoname (index_, buffer); if_name_result = if_indextoname (index_, buffer);
#endif #endif
@@ -724,7 +724,7 @@ void zmq::ip_resolver_t::do_freeaddrinfo (struct addrinfo *res_)
unsigned int zmq::ip_resolver_t::do_if_nametoindex (const char *ifname_) unsigned int zmq::ip_resolver_t::do_if_nametoindex (const char *ifname_)
{ {
#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP && !defined ZMQ_HAVE_WINDOWS_UWP \ #if _WIN32_WINNT > _WIN32_WINNT_WINXP && !defined ZMQ_HAVE_WINDOWS_UWP \
&& !defined ZMQ_HAVE_VXWORKS && !defined ZMQ_HAVE_VXWORKS
return if_nametoindex (ifname_); return if_nametoindex (ifname_);
#else #else

View File

@@ -65,10 +65,10 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_, const char *name_)
strncpy (_name, name_, sizeof (_name) - 1); strncpy (_name, name_, sizeof (_name) - 1);
#if defined _WIN32_WCE #if defined _WIN32_WCE
_descriptor = _descriptor =
(HANDLE) CreateThread (NULL, 0, &::thread_routine, this, 0, NULL); (HANDLE) CreateThread (NULL, 0, &::thread_routine, this, 0, &_thread_id);
#else #else
_descriptor = _descriptor = (HANDLE) _beginthreadex (NULL, 0, &::thread_routine, this, 0,
(HANDLE) _beginthreadex (NULL, 0, &::thread_routine, this, 0, NULL); &_thread_id);
#endif #endif
win_assert (_descriptor != NULL); win_assert (_descriptor != NULL);
_started = true; _started = true;
@@ -76,7 +76,7 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_, const char *name_)
bool zmq::thread_t::is_current_thread () const bool zmq::thread_t::is_current_thread () const
{ {
return GetCurrentThreadId () == GetThreadId (_descriptor); return GetCurrentThreadId () == _thread_id;
} }
void zmq::thread_t::stop () void zmq::thread_t::stop ()

View File

@@ -107,6 +107,11 @@ class thread_t
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
HANDLE _descriptor; HANDLE _descriptor;
#if defined _WIN32_WCE
DWORD _thread_id;
#else
unsigned int _thread_id;
#endif
#elif defined ZMQ_HAVE_VXWORKS #elif defined ZMQ_HAVE_VXWORKS
int _descriptor; int _descriptor;
enum enum

View File

@@ -104,7 +104,7 @@ int zmq::udp_address_t::resolve (const char *name_, bool bind_, bool ipv6_)
if (src_name == "*") { if (src_name == "*") {
_bind_interface = 0; _bind_interface = 0;
} else { } else {
#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP && !defined ZMQ_HAVE_WINDOWS_UWP \ #if _WIN32_WINNT > _WIN32_WINNT_WINXP && !defined ZMQ_HAVE_WINDOWS_UWP \
&& !defined ZMQ_HAVE_VXWORKS && !defined ZMQ_HAVE_VXWORKS
_bind_interface = if_nametoindex (src_name.c_str ()); _bind_interface = if_nametoindex (src_name.c_str ());
if (_bind_interface == 0) { if (_bind_interface == 0) {

View File

@@ -299,14 +299,14 @@ static bool is_multicast_available (int ipv6_)
any_ipv6->sin6_flowinfo = 0; any_ipv6->sin6_flowinfo = 0;
any_ipv6->sin6_scope_id = 0; any_ipv6->sin6_scope_id = 0;
rc = inet_pton (AF_INET6, "::", &any_ipv6->sin6_addr); rc = test_inet_pton (AF_INET6, "::", &any_ipv6->sin6_addr);
if (rc == 0) { if (rc == 0) {
goto out; goto out;
} }
*mcast_ipv6 = *any_ipv6; *mcast_ipv6 = *any_ipv6;
rc = inet_pton (AF_INET6, MCAST_IPV6, &mcast_ipv6->sin6_addr); rc = test_inet_pton (AF_INET6, MCAST_IPV6, &mcast_ipv6->sin6_addr);
if (rc == 0) { if (rc == 0) {
goto out; goto out;
} }
@@ -319,14 +319,14 @@ static bool is_multicast_available (int ipv6_)
any_ipv4->sin_family = AF_INET; any_ipv4->sin_family = AF_INET;
any_ipv4->sin_port = htons (5555); any_ipv4->sin_port = htons (5555);
rc = inet_pton (AF_INET, "0.0.0.0", &any_ipv4->sin_addr); rc = test_inet_pton (AF_INET, "0.0.0.0", &any_ipv4->sin_addr);
if (rc == 0) { if (rc == 0) {
goto out; goto out;
} }
*mcast_ipv4 = *any_ipv4; *mcast_ipv4 = *any_ipv4;
rc = inet_pton (AF_INET, MCAST_IPV4, &mcast_ipv4->sin_addr); rc = test_inet_pton (AF_INET, MCAST_IPV4, &mcast_ipv4->sin_addr);
if (rc == 0) { if (rc == 0) {
goto out; goto out;
} }

View File

@@ -38,7 +38,7 @@
#include <crtdbg.h> #include <crtdbg.h>
#pragma warning(disable : 4996) #pragma warning(disable : 4996)
// iphlpapi is needed for if_nametoindex (not on Windows XP) // iphlpapi is needed for if_nametoindex (not on Windows XP)
#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP #if _WIN32_WINNT > _WIN32_WINNT_WINXP
#pragma comment(lib, "iphlpapi") #pragma comment(lib, "iphlpapi")
#endif #endif
#endif #endif