From def0336e9ab1c11d45092b7614be4f8e794480b3 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 22:26:50 +1100 Subject: [PATCH 01/12] increase mingw's minimum _WIN32_WINNT version --- src/windows.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 3cdc9218c2714e89b2b680ff508fe2040c7c2434 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 22:36:37 +1100 Subject: [PATCH 02/12] remove include that is already in header --- src/err.cpp | 1 - 1 file changed, 1 deletion(-) 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_) { From f472893da14c4bc21f80dc472a0bb3022e1e2ec9 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 22:37:45 +1100 Subject: [PATCH 03/12] changed order of includes --- src/err.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 From 988d33bcf8771e56c26109a6fd651f60865affa9 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 22:39:53 +1100 Subject: [PATCH 04/12] added windows.hpp with include check includes windows.hpp if on windows build for mingw build errors from including zmq.h before windows.h --- src/dish.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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" From 56efddd1828fa261d551af3ca1fb89215ab115ac Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 22:55:24 +1100 Subject: [PATCH 05/12] remove c++11 requirement and -Werror=sign-compare used static_cast around WSA_WAIT_FAILED as it is an unsigned implicitly defined as (0xFFFFFFFF ion winbase.h) and causes a comparison error. removed use of c++11 style initialiser list for 'sockaddr addr { 0 }' and changed it to 'sockaddr addr = { 0 }' --- src/select.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 595181d301b19f9e70d87340cadb15b5c9371c40 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 22:58:38 +1100 Subject: [PATCH 06/12] added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage --- tests/test_security_plain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From b98b1495af10f2d3df63a863d7a1035fdaf01b61 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 22:59:13 +1100 Subject: [PATCH 07/12] added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage --- tests/test_security_curve.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 596fd2408a672edd50fb00481d03f43187433065 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 22:59:58 +1100 Subject: [PATCH 08/12] added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage --- tests/test_security_null.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 05b5633b8dbac0fdf6625f63a414a020403364fc Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 23:01:26 +1100 Subject: [PATCH 09/12] update for mingw's default _WIN32_WINNT mingw defaults with _WIN32_WINNT as 0x0502 which doesn't define inet_pton(), so add a conditional check --- tests/test_heartbeats.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_heartbeats.cpp b/tests/test_heartbeats.cpp index b04f7324..219f52c9 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); - inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); ++#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); From 75bea4bc13586dd59cf92d448228e949d6fad1df Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 23:03:12 +1100 Subject: [PATCH 10/12] update for mingw's default _WIN32_WINNT mingw defaults with _WIN32_WINNT as 0x0502 which doesn't define inet_pton(), so add a conditional check --- tests/test_heartbeats.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_heartbeats.cpp b/tests/test_heartbeats.cpp index 219f52c9..b5d034ff 100644 --- a/tests/test_heartbeats.cpp +++ b/tests/test_heartbeats.cpp @@ -185,11 +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 +#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); From d06314df840eb671a502bf7a9a89fbd10caec776 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 23:19:10 +1100 Subject: [PATCH 11/12] added windows includes as well as unix includes added conditional includes for unix / windows --- tests/test_stream_exceeds_buffer.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 From 7270d4de653e3cbd8486c1f74be2e8d5a33103d3 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Feb 2016 23:31:56 +1100 Subject: [PATCH 12/12] windows.hpp needs to be included before zmq.h windows.hpp must be included first due to increases _WIN32_WINNT version --- tests/test_timers.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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