Skip to content

Commit

Permalink
Correction to pull request #56
Browse files Browse the repository at this point in the history
A better/nicer solution to fix the type mismatch warnings (size_t to int). Working with size_t as long as possible and doing the static_cast right before calling the zmq_poll() function of libzmq
  • Loading branch information
K0n63n committed Nov 30, 2015
1 parent 4815c80 commit 308239d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zmq.hpp
Expand Up @@ -127,17 +127,17 @@ namespace zmq
int errnum;
};

inline int poll (zmq_pollitem_t const* items_, int nitems_, long timeout_ = -1)
inline int poll (zmq_pollitem_t const* items_, size_t nitems_, long timeout_ = -1)
{
int rc = zmq_poll (const_cast<zmq_pollitem_t*>(items_), nitems_, timeout_);
int rc = zmq_poll (const_cast<zmq_pollitem_t*>(items_), static_cast<int>(nitems_), timeout_);
if (rc < 0)
throw error_t ();
return rc;
}

inline int poll(zmq_pollitem_t const* items, size_t nitems)
{
return poll(items, static_cast<int>(nitems), -1);
return poll(items, nitems, -1);
}

#ifdef ZMQ_CPP11
Expand All @@ -153,7 +153,7 @@ namespace zmq

inline int poll(std::vector<zmq_pollitem_t> const& items, long timeout_ = -1)
{
return poll(items.data(), static_cast<int>(items.size()), timeout_);
return poll(items.data(), items.size(), timeout_);
}
#endif

Expand Down

0 comments on commit 308239d

Please sign in to comment.