Commit 39563d70 authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #1775 from CommanderBubble/patch-2

updates for bumped _WIN32_WINNT version with mingw builds
parents a9666d7f 7270d4de
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
#include <string.h> #include <string.h>
#include "platform.hpp"
#ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#endif
#include "../include/zmq.h" #include "../include/zmq.h"
#include "macros.hpp" #include "macros.hpp"
#include "dish.hpp" #include "dish.hpp"
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
*/ */
#include "err.hpp" #include "err.hpp"
#include "platform.hpp"
const char *zmq::errno_to_string (int errno_) const char *zmq::errno_to_string (int errno_)
{ {
......
...@@ -41,10 +41,6 @@ ...@@ -41,10 +41,6 @@
#include <stdio.h> #include <stdio.h>
#include "platform.hpp" #include "platform.hpp"
#include "likely.hpp"
// 0MQ-specific error codes are defined in zmq.h
#include "../include/zmq.h"
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"
...@@ -52,6 +48,11 @@ ...@@ -52,6 +48,11 @@
#include <netdb.h> #include <netdb.h>
#endif #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. // EPROTO is not used by OpenBSD and maybe other platforms.
#ifndef EPROTO #ifndef EPROTO
#define EPROTO 0 #define EPROTO 0
......
...@@ -434,7 +434,7 @@ bool zmq::select_t::is_retired_fd (const fd_entry_t &entry) ...@@ -434,7 +434,7 @@ bool zmq::select_t::is_retired_fd (const fd_entry_t &entry)
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
u_short zmq::select_t::get_fd_family (fd_t fd_) u_short zmq::select_t::get_fd_family (fd_t fd_)
{ {
sockaddr addr{ 0 }; sockaddr addr = { 0 };
int addr_size = sizeof addr; int addr_size = sizeof addr;
int rc = getsockname (fd_, &addr, &addr_size); int rc = getsockname (fd_, &addr, &addr_size);
......
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
#ifdef __MINGW32__ #ifdef __MINGW32__
// Require Windows XP or higher with MinGW for getaddrinfo(). // Require Windows XP or higher with MinGW for getaddrinfo().
#if(_WIN32_WINNT >= 0x0501) #if(_WIN32_WINNT >= 0x0600)
#else #else
#undef _WIN32_WINNT #undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0600
#endif #endif
#endif #endif
......
...@@ -185,7 +185,11 @@ test_heartbeat_timeout (void) ...@@ -185,7 +185,11 @@ test_heartbeat_timeout (void)
ip4addr.sin_family = AF_INET; ip4addr.sin_family = AF_INET;
ip4addr.sin_port = htons(5556); 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); inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr);
#endif
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
rc = connect (s, (struct sockaddr*) &ip4addr, sizeof ip4addr); rc = connect (s, (struct sockaddr*) &ip4addr, sizeof ip4addr);
......
...@@ -245,7 +245,7 @@ int main (void) ...@@ -245,7 +245,7 @@ int main (void)
ip4addr.sin_family = AF_INET; ip4addr.sin_family = AF_INET;
ip4addr.sin_port = htons (9998); 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"); ip4addr.sin_addr.s_addr = inet_addr ("127.0.0.1");
#else #else
inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr);
......
...@@ -158,7 +158,7 @@ int main (void) ...@@ -158,7 +158,7 @@ int main (void)
ip4addr.sin_family = AF_INET; ip4addr.sin_family = AF_INET;
ip4addr.sin_port = htons(9003); 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"); ip4addr.sin_addr.s_addr = inet_addr ("127.0.0.1");
#else #else
inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr);
......
...@@ -164,7 +164,7 @@ int main (void) ...@@ -164,7 +164,7 @@ int main (void)
ip4addr.sin_family = AF_INET; ip4addr.sin_family = AF_INET;
ip4addr.sin_port = htons (9998); 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"); ip4addr.sin_addr.s_addr = inet_addr ("127.0.0.1");
#else #else
inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr);
......
...@@ -2,8 +2,18 @@ ...@@ -2,8 +2,18 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <netinet/in.h> #include "testutil.hpp"
#include <unistd.h> #if defined (ZMQ_HAVE_WINDOWS)
# include <winsock2.h>
# include <ws2tcpip.h>
# include <stdexcept>
# define close closesocket
#else
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <unistd.h>
#endif
#include <zmq.h> #include <zmq.h>
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
*/ */
#include "macros.hpp" #include "macros.hpp"
#include "testutil.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"
...@@ -36,6 +35,8 @@ ...@@ -36,6 +35,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "testutil.hpp"
void sleep_ (long timeout_) void sleep_ (long timeout_)
{ {
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment