From 41cc603d11588f76ba244ae77e8ed500833ad844 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Feb 2016 23:31:24 +1100 Subject: [PATCH 1/7] 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_security_curve.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_security_curve.cpp b/tests/test_security_curve.cpp index 6c075978..d9db69ad 100644 --- a/tests/test_security_curve.cpp +++ b/tests/test_security_curve.cpp @@ -245,7 +245,11 @@ int main (void) ip4addr.sin_family = AF_INET; ip4addr.sin_port = htons (9998); - 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 d0b341cf0fd59a3eb8809d4e6515857b30b28647 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Feb 2016 23:31:55 +1100 Subject: [PATCH 2/7] 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_security_null.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_security_null.cpp b/tests/test_security_null.cpp index e95a7c9d..f0ce6b55 100644 --- a/tests/test_security_null.cpp +++ b/tests/test_security_null.cpp @@ -158,7 +158,11 @@ int main (void) ip4addr.sin_family = AF_INET; ip4addr.sin_port = htons(9003); - 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 626abbdaf2c325df665073d6ce7510d9f17f7c7a Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Feb 2016 23:32:20 +1100 Subject: [PATCH 3/7] 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_security_plain.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_security_plain.cpp b/tests/test_security_plain.cpp index b76727fb..bfa0b7ed 100644 --- a/tests/test_security_plain.cpp +++ b/tests/test_security_plain.cpp @@ -164,7 +164,11 @@ int main (void) ip4addr.sin_family = AF_INET; ip4addr.sin_port = htons (9998); - 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 af3b9452a2026092d3abdaaca0ffbd2ea1e26369 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Feb 2016 23:33:22 +1100 Subject: [PATCH 4/7] 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 1ca7200e..cd7a86c6 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 6f4e9f13f3716c233add54f1121015fe358cbb1e Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Feb 2016 23:34:43 +1100 Subject: [PATCH 5/7] changed order of includes windows.hpp must be included before zmq.h when _WIN32_WINNT >= 0x0600 --- src/err.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/err.hpp b/src/err.hpp index fcefb892..02c9e8ef 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 45404f4b06238ad679f8e360ce48ee20171b16ad Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Feb 2016 23:36:07 +1100 Subject: [PATCH 6/7] added windows.hpp with include check windows.hpp must be included before zmq.h when _WIN32_WINNT >= 0x0600 --- src/msg.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/msg.cpp b/src/msg.cpp index 00ed1595..95116b90 100644 --- a/src/msg.cpp +++ b/src/msg.cpp @@ -27,6 +27,12 @@ along with this program. If not, see . */ +#include "platform.hpp" + +#ifdef ZMQ_HAVE_WINDOWS +#include "windows.hpp" +#endif + #include "msg.hpp" #include "../include/zmq.h" From 2058dece7727ea97d8fc40286b1450a43a1fa49b Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Feb 2016 23:36:48 +1100 Subject: [PATCH 7/7] added windows.hpp with include check windows.hpp must be included before zmq.h when _WIN32_WINNT >= 0x0600 --- src/poller.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/poller.hpp b/src/poller.hpp index b91e551c..4d66677a 100644 --- a/src/poller.hpp +++ b/src/poller.hpp @@ -32,6 +32,10 @@ #include "platform.hpp" +#ifdef ZMQ_HAVE_WINDOWS +#include "windows.hpp" +#endif + #if defined ZMQ_USE_KQUEUE + defined ZMQ_USE_EPOLL \ + defined ZMQ_USE_DEVPOLL + defined ZMQ_USE_POLL \ + defined ZMQ_USE_SELECT > 1