Commit d437d668 authored by Simon Giesecke's avatar Simon Giesecke

Problem: MSVC warnings in connection with poll

Solution: handle types properly
parent e447f058
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
#include "config.hpp" #include "config.hpp"
#include "i_poll_events.hpp" #include "i_poll_events.hpp"
#ifdef ZMQ_HAVE_WINDOWS
typedef unsigned long nfds_t;
#endif
zmq::poll_t::poll_t (const zmq::thread_ctx_t &ctx_) : zmq::poll_t::poll_t (const zmq::thread_ctx_t &ctx_) :
worker_poller_base_t (ctx_), worker_poller_base_t (ctx_),
retired (false) retired (false)
...@@ -155,7 +159,8 @@ void zmq::poll_t::loop () ...@@ -155,7 +159,8 @@ void zmq::poll_t::loop ()
} }
// Wait for events. // Wait for events.
int rc = poll (&pollset[0], pollset.size (), timeout ? timeout : -1); int rc = poll (&pollset[0], static_cast<nfds_t> (pollset.size ()),
timeout ? timeout : -1);
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR); wsa_assert (rc != SOCKET_ERROR);
#else #else
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "socket_poller.hpp" #include "socket_poller.hpp"
#include "err.hpp" #include "err.hpp"
#include <limits.h>
static bool is_thread_safe (zmq::socket_base_t &socket) static bool is_thread_safe (zmq::socket_base_t &socket)
{ {
// do not use getsockopt here, since that would fail during context termination // do not use getsockopt here, since that would fail during context termination
...@@ -575,7 +577,8 @@ int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *events_, ...@@ -575,7 +577,8 @@ int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *events_,
else if (timeout_ < 0) else if (timeout_ < 0)
timeout = -1; timeout = -1;
else else
timeout = end - now; timeout =
static_cast<int> (std::min<uint64_t> (end - now, INT_MAX));
// Wait for events. // Wait for events.
while (true) { while (true) {
......
...@@ -867,7 +867,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -867,7 +867,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
else if (timeout_ < 0) else if (timeout_ < 0)
timeout = -1; timeout = -1;
else else
timeout = end - now; timeout =
static_cast<int> (std::min<uint64_t> (end - now, INT_MAX));
// Wait for events. // Wait for events.
{ {
......
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