fix build error with libzmq-3.2.5 (#103)

error zmq_send_const undefined and zmq_msg_gets undefined
This commit is contained in:
Rider Woo 2016-12-12 17:30:09 +08:00 committed by Luca Boccassi
parent 229e7a849b
commit 3431f6882a

View File

@ -372,6 +372,7 @@ namespace zmq
return a == b; return a == b;
} }
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 0, 8)
inline const char* gets(const char *property_) inline const char* gets(const char *property_)
{ {
const char* value = zmq_msg_gets (&msg, property_); const char* value = zmq_msg_gets (&msg, property_);
@ -379,6 +380,7 @@ namespace zmq
throw error_t (); throw error_t ();
return value; return value;
} }
#endif
private: private:
// The underlying message // The underlying message
@ -622,7 +624,11 @@ namespace zmq
inline size_t send (const void *buf_, size_t len_, int flags_ = 0) inline size_t send (const void *buf_, size_t len_, int flags_ = 0)
{ {
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 0, 8)
int nbytes = zmq_send_const (ptr, buf_, len_, flags_); int nbytes = zmq_send_const (ptr, buf_, len_, flags_);
#else
int nbytes = zmq_send (ptr, buf_, len_, flags_);
#endif
if (nbytes >= 0) if (nbytes >= 0)
return (size_t) nbytes; return (size_t) nbytes;
if (zmq_errno () == EAGAIN) if (zmq_errno () == EAGAIN)