diff --git a/src/dish.cpp b/src/dish.cpp index 9e1f5a56..964805be 100644 --- a/src/dish.cpp +++ b/src/dish.cpp @@ -29,6 +29,12 @@ #include +#include "platform.hpp" + +#ifdef ZMQ_HAVE_WINDOWS +#include "windows.hpp" +#endif + #include "../include/zmq.h" #include "macros.hpp" #include "dish.hpp" diff --git a/src/err.cpp b/src/err.cpp index c97d308a..822e921d 100644 --- a/src/err.cpp +++ b/src/err.cpp @@ -28,7 +28,6 @@ */ #include "err.hpp" -#include "platform.hpp" const char *zmq::errno_to_string (int errno_) { diff --git a/src/err.hpp b/src/err.hpp index a86855d8..374f12b3 100644 --- a/src/err.hpp +++ b/src/err.hpp @@ -41,10 +41,6 @@ #include #include "platform.hpp" -#include "likely.hpp" - -// 0MQ-specific error codes are defined in zmq.h -#include "../include/zmq.h" #ifdef ZMQ_HAVE_WINDOWS #include "windows.hpp" @@ -52,6 +48,11 @@ #include #endif +#include "likely.hpp" + +// 0MQ-specific error codes are defined in zmq.h +#include "../include/zmq.h" + // EPROTO is not used by OpenBSD and maybe other platforms. #ifndef EPROTO #define EPROTO 0 diff --git a/src/select.cpp b/src/select.cpp index 55c7e552..e1aa2063 100644 --- a/src/select.cpp +++ b/src/select.cpp @@ -434,7 +434,7 @@ bool zmq::select_t::is_retired_fd (const fd_entry_t &entry) #if defined ZMQ_HAVE_WINDOWS u_short zmq::select_t::get_fd_family (fd_t fd_) { - sockaddr addr{ 0 }; + sockaddr addr = { 0 }; int addr_size = sizeof addr; int rc = getsockname (fd_, &addr, &addr_size); diff --git a/src/windows.hpp b/src/windows.hpp index b90e17b8..44e86c68 100644 --- a/src/windows.hpp +++ b/src/windows.hpp @@ -44,10 +44,10 @@ #ifdef __MINGW32__ // Require Windows XP or higher with MinGW for getaddrinfo(). -#if(_WIN32_WINNT >= 0x0501) +#if(_WIN32_WINNT >= 0x0600) #else #undef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 +#define _WIN32_WINNT 0x0600 #endif #endif diff --git a/tests/test_heartbeats.cpp b/tests/test_heartbeats.cpp index b04f7324..b5d034ff 100644 --- a/tests/test_heartbeats.cpp +++ b/tests/test_heartbeats.cpp @@ -185,7 +185,11 @@ test_heartbeat_timeout (void) ip4addr.sin_family = AF_INET; ip4addr.sin_port = htons(5556); +#if (ZMQ_HAVE_WINDOWS and _WIN32_WINNT < 0x0600) + ip4addr.sin_addr.s_addr = inet_addr ("127.0.0.1"); +#else inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); +#endif s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); rc = connect (s, (struct sockaddr*) &ip4addr, sizeof ip4addr); diff --git a/tests/test_security_curve.cpp b/tests/test_security_curve.cpp index 42f6923a..fc025a8c 100644 --- a/tests/test_security_curve.cpp +++ b/tests/test_security_curve.cpp @@ -245,7 +245,7 @@ int main (void) ip4addr.sin_family = AF_INET; ip4addr.sin_port = htons (9998); -#if (_WIN32_WINNT < 0x0600) +#if (ZMQ_HAVE_WINDOWS and _WIN32_WINNT < 0x0600) ip4addr.sin_addr.s_addr = inet_addr ("127.0.0.1"); #else inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); diff --git a/tests/test_security_null.cpp b/tests/test_security_null.cpp index c708a376..af2f44da 100644 --- a/tests/test_security_null.cpp +++ b/tests/test_security_null.cpp @@ -158,7 +158,7 @@ int main (void) ip4addr.sin_family = AF_INET; ip4addr.sin_port = htons(9003); -#if (_WIN32_WINNT < 0x0600) +#if (ZMQ_HAVE_WINDOWS and _WIN32_WINNT < 0x0600) ip4addr.sin_addr.s_addr = inet_addr ("127.0.0.1"); #else inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); diff --git a/tests/test_security_plain.cpp b/tests/test_security_plain.cpp index 0ff9caf6..655a1140 100644 --- a/tests/test_security_plain.cpp +++ b/tests/test_security_plain.cpp @@ -164,7 +164,7 @@ int main (void) ip4addr.sin_family = AF_INET; ip4addr.sin_port = htons (9998); -#if (_WIN32_WINNT < 0x0600) +#if (ZMQ_HAVE_WINDOWS and _WIN32_WINNT < 0x0600) ip4addr.sin_addr.s_addr = inet_addr ("127.0.0.1"); #else inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); diff --git a/tests/test_stream_exceeds_buffer.cpp b/tests/test_stream_exceeds_buffer.cpp index d3604dca..75a80d88 100644 --- a/tests/test_stream_exceeds_buffer.cpp +++ b/tests/test_stream_exceeds_buffer.cpp @@ -2,8 +2,18 @@ #include #include -#include -#include +#include "testutil.hpp" +#if defined (ZMQ_HAVE_WINDOWS) +# include +# include +# include +# define close closesocket +#else +# include +# include +# include +# include +#endif #include diff --git a/tests/test_timers.cpp b/tests/test_timers.cpp index 00e31f51..5125dbb6 100644 --- a/tests/test_timers.cpp +++ b/tests/test_timers.cpp @@ -28,7 +28,6 @@ */ #include "macros.hpp" -#include "testutil.hpp" #if defined ZMQ_HAVE_WINDOWS #include "windows.hpp" @@ -36,6 +35,8 @@ #include #endif +#include "testutil.hpp" + void sleep_ (long timeout_) { #if defined ZMQ_HAVE_WINDOWS