Merge pull request #492 from arsenm/master

Make CMake build usable for other systems
This commit is contained in:
Pieter Hintjens 2013-01-02 00:32:15 -08:00
commit 949d157897
21 changed files with 970 additions and 424 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
#define __ZMQ_PLATFORM_HPP_INCLUDED__
#cmakedefine ZMQ_FORCE_SELECT
#cmakedefine ZMQ_FORCE_POLL
#cmakedefine ZMQ_FORCE_EPOLL
#cmakedefine ZMQ_FORCE_DEVPOLL
#cmakedefine ZMQ_FORCE_KQUEUE
#cmakedefine ZMQ_FORCE_SELECT
#cmakedefine ZMQ_FORCE_POLL
#cmakedefine ZMQ_FORCE_MUTEXES
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine HAVE_GETHRTIME
#cmakedefine ZMQ_HAVE_UIO
#cmakedefine ZMQ_HAVE_EVENTFD
#cmakedefine ZMQ_HAVE_IFADDRS
#cmakedefine ZMQ_HAVE_SOCK_CLOEXEC
#cmakedefine ZMQ_HAVE_SO_KEEPALIVE
#cmakedefine ZMQ_HAVE_TCP_KEEPCNT
#cmakedefine ZMQ_HAVE_TCP_KEEPIDLE
#cmakedefine ZMQ_HAVE_TCP_KEEPINTVL
#cmakedefine ZMQ_HAVE_TCP_KEEPALIVE
#cmakedefine ZMQ_HAVE_OPENPGM
#cmakedefine ZMQ_MAKE_VALGRIND_HAPPY
#ifdef _AIX
#define ZMQ_HAVE_AIX
#endif
#if defined ANDROID
#define ZMQ_HAVE_ANDROID
#endif
#if defined __CYGWIN__
#define ZMQ_HAVE_CYGWIN
#endif
#if defined __MINGW32__
#define ZMQ_HAVE_MINGW32
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#define ZMQ_HAVE_FREEBSD
#endif
#if defined __hpux
#define ZMQ_HAVE_HPUX
#endif
#if defined __linux__
#define ZMQ_HAVE_LINUX
#endif
#if defined __NetBSD__
#define ZMQ_HAVE_NETBSD
#endif
#if defined __OpenBSD__
#define ZMQ_HAVE_OPENBSD
#endif
#if defined __VMS
#define ZMQ_HAVE_OPENVMS
#endif
#if defined __APPLE__
#define ZMQ_HAVE_OSX
#endif
#if defined __QNXNTO__
#define ZMQ_HAVE_QNXNTO
#endif
#if defined(sun) || defined(__sun)
#define ZMQ_HAVE_SOLARIS
#endif
#if defined(WIN32) || defined(_WIN32)
#define ZMQ_HAVE_WINDOWS
#endif
#endif

View File

@ -0,0 +1,24 @@
# - Find Asciidoc
# this module looks for asciidoc and a2x
#
# ASCIIDOC_EXECUTABLE - the full path to asciidoc
# ASCIIDOC_FOUND - If false, don't attempt to use asciidoc.
# A2X_EXECUTABLE - the full path to a2x
# A2X_FOUND - If false, don't attempt to use a2x.
find_program(ASCIIDOC_EXECUTABLE asciidoc asciidoc.py
PATHS "$ENV{ASCIIDOC_ROOT}"
"$ENV{PROGRAMW6432}/asciidoc"
"$ENV{PROGRAMFILES}/asciidoc"
"$ENV{PROGRAMFILES(X86)}/asciidoc")
find_program(A2X_EXECUTABLE a2x
PATHS "$ENV{ASCIIDOC_ROOT}"
"$ENV{PROGRAMW6432}/asciidoc"
"$ENV{PROGRAMFILES}/asciidoc"
"$ENV{PROGRAMFILES(X86)}/asciidoc")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_ARGS(AsciiDoc REQUIRED_VARS ASCIIDOC_EXECUTABLE)
mark_as_advanced(ASCIIDOC_EXECUTABLE A2X_EXECUTABLE)

View File

@ -1,35 +1,18 @@
MESSAGE(STATUS "Detecting ZMQ") file(READ "${PROJECT_SOURCE_DIR}/include/zmq.h" _ZMQ_H_CONTENTS)
SET(TRY_RUN_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/zmq_run.dir) string(REGEX REPLACE ".*#define ZMQ_VERSION_MAJOR ([0-9]+).*" "\\1" ZMQ_VERSION_MAJOR "${_ZMQ_H_CONTENTS}")
string(REGEX REPLACE ".*#define ZMQ_VERSION_MINOR ([0-9]+).*" "\\1" ZMQ_VERSION_MINOR "${_ZMQ_H_CONTENTS}")
string(REGEX REPLACE ".*#define ZMQ_VERSION_PATCH ([0-9]+).*" "\\1" ZMQ_VERSION_PATCH "${_ZMQ_H_CONTENTS}")
set(ZMQ_VERSION "${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
TRY_RUN(RUN_RESULT COMPILE_RESULT message(STATUS "Detected ZMQ Version - ${ZMQ_VERSION}")
${TRY_RUN_DIR}
${CMAKE_SOURCE_DIR}/cmake/Modules/zmq_version.cpp
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_SOURCE_DIR}/include"
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE RUN_OUTPUT)
IF(COMPILE_RESULT) if(MSVC_VERSION MATCHES "1700")
IF(RUN_RESULT MATCHES "FAILED_TO_RUN") set(_zmq_COMPILER "-v110")
MESSAGE(STATUS "Detecting ZMQ - failed") elseif(MSVC10)
ELSE() set(_zmq_COMPILER "-v100")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1" ZMQ_VERSION_MAJOR "${RUN_OUTPUT}") elseif(MSVC90)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\2" ZMQ_VERSION_MINOR "${RUN_OUTPUT}") set(_zmq_COMPILER "-v90")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\3" ZMQ_VERSION_PATCH "${RUN_OUTPUT}") else()
MESSAGE(STATUS "Detecting ZMQ - ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}") set(_zmq_COMPILER "")
ENDIF() endif()
ELSE()
MESSAGE(STATUS "Check for ZMQ version - not found")
MESSAGE(STATUS "Detecting ZMQ - failed")
ENDIF()
if(MSVC_VERSION MATCHES "1700")
set(_zmq_COMPILER "-v110")
elseif(MSVC10)
set(_zmq_COMPILER "-v100")
elseif(MSVC90)
set(_zmq_COMPILER "-v90")
else()
set(_zmq_COMPILER "")
endif()

View File

@ -0,0 +1,129 @@
macro(zmq_check_sock_cloexec)
message(STATUS "Checking whether SOCK_CLOEXEC is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char *argv [])
{
int s = socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
return(s == -1);
}
"
ZMQ_HAVE_SOCK_CLOEXEC)
endmacro()
# TCP keep-alives Checks.
macro(zmq_check_so_keepalive)
message(STATUS "Checking whether SO_KEEPALIVE is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_SO_KEEPALIVE)
endmacro()
macro(zmq_check_tcp_keepcnt)
message(STATUS "Checking whether TCP_KEEPCNT is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPCNT,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_TCP_KEEPCNT)
endmacro()
macro(zmq_check_tcp_keepidle)
message(STATUS "Checking whether TCP_KEEPIDLE is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPIDLE,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_TCP_KEEPIDLE)
endmacro()
macro(zmq_check_tcp_keepintvl)
message(STATUS "Checking whether TCP_KEEPINTVL is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_TCP_KEEPINTVL)
endmacro()
macro(zmq_check_tcp_keepalive)
message(STATUS "Checking whether TCP_KEEPALIVE is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPALIVE,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_TCP_KEEPALIVE)
endmacro()

View File

@ -1,31 +0,0 @@
/*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "zmq.h"
#include <stdio.h>
int main ()
{
printf ("%d.%d.%d\n", ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH);
return 0;
}

View File

@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "../src/platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
#include <windows.h> #include <windows.h>

View File

@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "../src/platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
#include <windows.h> #include <windows.h>

View File

@ -163,7 +163,7 @@ namespace zmq
return false; return false;
} }
inline bool message_ready_size (size_t msg_sz) inline bool message_ready_size (size_t /* msg_sz */)
{ {
zmq_assert (false); zmq_assert (false);
return false; return false;

View File

@ -30,8 +30,9 @@ namespace zmq
// Interface to be implemented by message decoder. // Interface to be implemented by message decoder.
struct i_decoder class i_decoder
{ {
public:
virtual ~i_decoder () {} virtual ~i_decoder () {}
virtual void set_msg_sink (i_msg_sink *msg_sink_) = 0; virtual void set_msg_sink (i_msg_sink *msg_sink_) = 0;

View File

@ -29,8 +29,9 @@ namespace zmq
// Interface to be implemented by message sink. // Interface to be implemented by message sink.
struct i_msg_sink class i_msg_sink
{ {
public:
virtual ~i_msg_sink () {} virtual ~i_msg_sink () {}
// Delivers a message. Returns 0 if successful; -1 otherwise. // Delivers a message. Returns 0 if successful; -1 otherwise.

View File

@ -29,8 +29,9 @@ namespace zmq
// Interface to be implemented by message source. // Interface to be implemented by message source.
struct i_msg_source class i_msg_source
{ {
public:
virtual ~i_msg_source () {} virtual ~i_msg_source () {}
// Fetch a message. Returns 0 if successful; -1 otherwise. // Fetch a message. Returns 0 if successful; -1 otherwise.

View File

@ -73,11 +73,11 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
void zmq::unblock_socket (fd_t s_) void zmq::unblock_socket (fd_t s_)
{ {
#ifdef ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
u_long nonblock = 1; u_long nonblock = 1;
int rc = ioctlsocket (s_, FIONBIO, &nonblock); int rc = ioctlsocket (s_, FIONBIO, &nonblock);
wsa_assert (rc != SOCKET_ERROR); wsa_assert (rc != SOCKET_ERROR);
#elif ZMQ_HAVE_OPENVMS #elif defined ZMQ_HAVE_OPENVMS
int nonblock = 1; int nonblock = 1;
int rc = ioctl (s_, FIONBIO, &nonblock); int rc = ioctl (s_, FIONBIO, &nonblock);
errno_assert (rc != -1); errno_assert (rc != -1);
@ -92,6 +92,8 @@ void zmq::unblock_socket (fd_t s_)
void zmq::enable_ipv4_mapping (fd_t s_) void zmq::enable_ipv4_mapping (fd_t s_)
{ {
(void) s_;
#ifdef IPV6_V6ONLY #ifdef IPV6_V6ONLY
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
DWORD flag = 0; DWORD flag = 0;
@ -107,3 +109,4 @@ void zmq::enable_ipv4_mapping (fd_t s_)
#endif #endif
#endif #endif
} }

10
src/libzmq.pc.cmake.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/lib
includedir=@CMAKE_INSTALL_PREFIX@/include
Name: libzmq
Description: 0MQ c++ library
Version: @ZMQ_VERSION_MAJOR@.@ZMQ_VERSION_MINOR@.@ZMQ_VERSION_PATCH@
Libs: -L${libdir} -lzmq
Cflags: -I@CMAKE_INSTALL_PREFIX@/include

View File

@ -124,6 +124,7 @@ void zmq::object_t::process_command (command_t &cmd_)
process_reaped (); process_reaped ();
break; break;
case command_t::done:
default: default:
zmq_assert (false); zmq_assert (false);
} }

View File

@ -320,20 +320,23 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
else { else {
std::string filter_str ((const char*) optval_, optvallen_); std::string filter_str ((const char*) optval_, optvallen_);
tcp_address_mask_t filter; tcp_address_mask_t mask;
int rc = filter.resolve (filter_str.c_str (), ipv4only ? true : false); int rc = mask.resolve (filter_str.c_str (), ipv4only ? true : false);
if (rc != 0) { if (rc != 0) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
tcp_accept_filters.push_back(filter); tcp_accept_filters.push_back(mask);
return 0; return 0;
} }
} }
default:
{
errno = EINVAL;
return -1;
}
} }
errno = EINVAL;
return -1;
} }
int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)

View File

@ -206,8 +206,8 @@ void zmq::signaler_t::recv ()
// one, return it back to the eventfd object. // one, return it back to the eventfd object.
if (unlikely (dummy == 2)) { if (unlikely (dummy == 2)) {
const uint64_t inc = 1; const uint64_t inc = 1;
ssize_t sz = write (w, &inc, sizeof (inc)); ssize_t sz2 = write (w, &inc, sizeof (inc));
errno_assert (sz == sizeof (inc)); errno_assert (sz2 == sizeof (inc));
return; return;
} }
@ -238,8 +238,10 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
return 0; return 0;
#elif defined ZMQ_HAVE_WINDOWS #elif defined ZMQ_HAVE_WINDOWS
SECURITY_DESCRIPTOR sd = {0}; SECURITY_DESCRIPTOR sd;
SECURITY_ATTRIBUTES sa = {0}; SECURITY_ATTRIBUTES sa;
memset (&sd, 0, sizeof (sd));
memset (&sa, 0, sizeof (sa));
InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&sd, TRUE, 0, FALSE); SetSecurityDescriptorDacl(&sd, TRUE, 0, FALSE);

View File

@ -437,14 +437,14 @@ int zmq::socket_base_t::connect (const char *addr_)
// Create a bi-directional pipe to connect the peers. // Create a bi-directional pipe to connect the peers.
object_t *parents [2] = {this, peer.socket}; object_t *parents [2] = {this, peer.socket};
pipe_t *pipes [2] = {NULL, NULL}; pipe_t *new_pipes [2] = {NULL, NULL};
int hwms [2] = {sndhwm, rcvhwm}; int hwms [2] = {sndhwm, rcvhwm};
bool delays [2] = {options.delay_on_disconnect, options.delay_on_close}; bool delays [2] = {options.delay_on_disconnect, options.delay_on_close};
int rc = pipepair (parents, pipes, hwms, delays); int rc = pipepair (parents, new_pipes, hwms, delays);
errno_assert (rc == 0); errno_assert (rc == 0);
// Attach local end of the pipe to this socket object. // Attach local end of the pipe to this socket object.
attach_pipe (pipes [0]); attach_pipe (new_pipes [0]);
// If required, send the identity of the local socket to the peer. // If required, send the identity of the local socket to the peer.
if (peer.options.recv_identity) { if (peer.options.recv_identity) {
@ -453,9 +453,9 @@ int zmq::socket_base_t::connect (const char *addr_)
errno_assert (rc == 0); errno_assert (rc == 0);
memcpy (id.data (), options.identity, options.identity_size); memcpy (id.data (), options.identity, options.identity_size);
id.set_flags (msg_t::identity); id.set_flags (msg_t::identity);
bool written = pipes [0]->write (&id); bool written = new_pipes [0]->write (&id);
zmq_assert (written); zmq_assert (written);
pipes [0]->flush (); new_pipes [0]->flush ();
} }
// If required, send the identity of the peer to the local socket. // If required, send the identity of the peer to the local socket.
@ -465,21 +465,21 @@ int zmq::socket_base_t::connect (const char *addr_)
errno_assert (rc == 0); errno_assert (rc == 0);
memcpy (id.data (), peer.options.identity, peer.options.identity_size); memcpy (id.data (), peer.options.identity, peer.options.identity_size);
id.set_flags (msg_t::identity); id.set_flags (msg_t::identity);
bool written = pipes [1]->write (&id); bool written = new_pipes [1]->write (&id);
zmq_assert (written); zmq_assert (written);
pipes [1]->flush (); new_pipes [1]->flush ();
} }
// Attach remote end of the pipe to the peer socket. Note that peer's // Attach remote end of the pipe to the peer socket. Note that peer's
// seqnum was incremented in find_endpoint function. We don't need it // seqnum was incremented in find_endpoint function. We don't need it
// increased here. // increased here.
send_bind (peer.socket, pipes [1], false); send_bind (peer.socket, new_pipes [1], false);
// Save last endpoint URI // Save last endpoint URI
options.last_endpoint.assign (addr_); options.last_endpoint.assign (addr_);
// remember inproc connections for disconnect // remember inproc connections for disconnect
inprocs.insert (inprocs_t::value_type (std::string (addr_), pipes[0])); inprocs.insert (inprocs_t::value_type (std::string (addr_), new_pipes[0]));
return 0; return 0;
} }
@ -540,17 +540,17 @@ int zmq::socket_base_t::connect (const char *addr_)
if (options.delay_attach_on_connect != 1 || icanhasall) { if (options.delay_attach_on_connect != 1 || icanhasall) {
// Create a bi-directional pipe. // Create a bi-directional pipe.
object_t *parents [2] = {this, session}; object_t *parents [2] = {this, session};
pipe_t *pipes [2] = {NULL, NULL}; pipe_t *new_pipes [2] = {NULL, NULL};
int hwms [2] = {options.sndhwm, options.rcvhwm}; int hwms [2] = {options.sndhwm, options.rcvhwm};
bool delays [2] = {options.delay_on_disconnect, options.delay_on_close}; bool delays [2] = {options.delay_on_disconnect, options.delay_on_close};
rc = pipepair (parents, pipes, hwms, delays); rc = pipepair (parents, new_pipes, hwms, delays);
errno_assert (rc == 0); errno_assert (rc == 0);
// Attach local end of the pipe to the socket object. // Attach local end of the pipe to the socket object.
attach_pipe (pipes [0], icanhasall); attach_pipe (new_pipes [0], icanhasall);
// Attach remote end of the pipe to the session object later on. // Attach remote end of the pipe to the session object later on.
session->attach_pipe (pipes [1]); session->attach_pipe (new_pipes [1]);
} }
// Save last endpoint URI // Save last endpoint URI
@ -664,7 +664,7 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_)
return -1; return -1;
// Compute the time when the timeout should occur. // Compute the time when the timeout should occur.
// If the timeout is infite, don't care. // If the timeout is infinite, don't care.
int timeout = options.sndtimeo; int timeout = options.sndtimeo;
uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout); uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout);
@ -746,7 +746,7 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
} }
// Compute the time when the timeout should occur. // Compute the time when the timeout should occur.
// If the timeout is infite, don't care. // If the timeout is infinite, don't care.
int timeout = options.rcvtimeo; int timeout = options.rcvtimeo;
uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout); uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout);

View File

@ -94,7 +94,7 @@ namespace zmq
// Size of the greeting message: // Size of the greeting message:
// Preamble (10 bytes) + version (1 byte) + socket type (1 byte). // Preamble (10 bytes) + version (1 byte) + socket type (1 byte).
const static size_t greeting_size = 12; static const size_t greeting_size = 12;
// True iff we are registered with an I/O poller. // True iff we are registered with an I/O poller.
bool io_enabled; bool io_enabled;

View File

@ -240,7 +240,8 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
// Accept one connection and deal with different failure modes. // Accept one connection and deal with different failure modes.
zmq_assert (s != retired_fd); zmq_assert (s != retired_fd);
struct sockaddr_storage ss = {}; struct sockaddr_storage ss;
memset (&ss, 0, sizeof (ss));
#ifdef ZMQ_HAVE_HPUX #ifdef ZMQ_HAVE_HPUX
int ss_len = sizeof (ss); int ss_len = sizeof (ss);
#else #else

View File

@ -56,7 +56,7 @@
// XSI vector I/O // XSI vector I/O
#if ZMQ_HAVE_UIO #if defined ZMQ_HAVE_UIO
#include <sys/uio.h> #include <sys/uio.h>
#else #else
struct iovec { struct iovec {
@ -980,7 +980,7 @@ int zmq_proxy (void *frontend_, void *backend_, void *control_)
// The deprecated device functionality // The deprecated device functionality
int zmq_device (int type, void *frontend_, void *backend_) int zmq_device (int /* type */, void *frontend_, void *backend_)
{ {
return zmq::proxy ( return zmq::proxy (
(zmq::socket_base_t*) frontend_, (zmq::socket_base_t*) frontend_,
@ -989,7 +989,7 @@ int zmq_device (int type, void *frontend_, void *backend_)
// Callback to free socket event data // Callback to free socket event data
void zmq_free_event (void *event_data, void *hint) void zmq_free_event (void *event_data, void * /* hint */)
{ {
zmq_event_t *event = (zmq_event_t *) event_data; zmq_event_t *event = (zmq_event_t *) event_data;