mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-05 03:37:36 +01:00
Fix non-constant-expression narrowing
For OS X, the microseconds field is implemented as an int type. The implicit narrowing in the initializer list throws a compiler error for some compilers with C++11 support turned on. The specific error message is: "error: non-constant-expression cannot be narrowed from type 'long' to '__darwin_suseconds_t' (aka 'int') in initializer list [-Wc++11-narrowing]". Tested on Clang 5.1.0 and Mac OS X 10.9.4.
This commit is contained in:
parent
4b70793f1f
commit
5642366f10
@ -163,8 +163,12 @@ void zmq::select_t::loop ()
|
|||||||
memcpy (&exceptfds, &source_set_err, sizeof source_set_err);
|
memcpy (&exceptfds, &source_set_err, sizeof source_set_err);
|
||||||
|
|
||||||
// Wait for events.
|
// Wait for events.
|
||||||
|
#ifdef ZMQ_HAVE_OSX
|
||||||
|
struct timeval tv = {(long) (timeout / 1000), timeout % 1000 * 1000};
|
||||||
|
#else
|
||||||
struct timeval tv = {(long) (timeout / 1000),
|
struct timeval tv = {(long) (timeout / 1000),
|
||||||
(long) (timeout % 1000 * 1000)};
|
(long) (timeout % 1000 * 1000)};
|
||||||
|
#endif
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
int rc = select (0, &readfds, &writefds, &exceptfds,
|
int rc = select (0, &readfds, &writefds, &exceptfds,
|
||||||
timeout ? &tv : NULL);
|
timeout ? &tv : NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user