Commit 232094a0 authored by Constantin Rack's avatar Constantin Rack

Merge pull request #1825 from bluca/whitespace_and_werror

parents 406b5738 80e529a1
...@@ -333,14 +333,14 @@ int zmq::dish_session_t::pull_msg (msg_t *msg_) ...@@ -333,14 +333,14 @@ int zmq::dish_session_t::pull_msg (msg_t *msg_)
if (msg_->is_join ()) { if (msg_->is_join ()) {
rc = command.init_size (group_length + 5); rc = command.init_size (group_length + 5);
errno_assert(rc == 0); errno_assert(rc == 0);
offset = 5; offset = 5;
memcpy (command.data (), "\4JOIN", 5); memcpy (command.data (), "\4JOIN", 5);
} }
else { else {
rc = command.init_size (group_length + 6); rc = command.init_size (group_length + 6);
errno_assert(rc == 0); errno_assert(rc == 0);
offset = 6; offset = 6;
memcpy (command.data (), "\5LEAVE", 6); memcpy (command.data (), "\5LEAVE", 6);
} }
......
...@@ -57,11 +57,11 @@ namespace zmq ...@@ -57,11 +57,11 @@ namespace zmq
public: public:
inline encoder_base_t (size_t bufsize_) : inline encoder_base_t (size_t bufsize_) :
write_pos(0),
to_write(0),
next(NULL),
new_msg_flag(false),
bufsize (bufsize_), bufsize (bufsize_),
write_pos(0),
to_write(0),
next(nullptr),
new_msg_flag(false),
in_progress (NULL) in_progress (NULL)
{ {
buf = (unsigned char*) malloc (bufsize_); buf = (unsigned char*) malloc (bufsize_);
......
...@@ -92,7 +92,7 @@ zmq::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_, ...@@ -92,7 +92,7 @@ zmq::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_,
sink (NULL), sink (NULL),
state (active), state (active),
delay (true), delay (true),
routing_id(0), routing_id(0),
conflate (conflate_) conflate (conflate_)
{ {
} }
......
...@@ -53,7 +53,7 @@ void zmq::poller_base_t::adjust_load (int amount_) ...@@ -53,7 +53,7 @@ void zmq::poller_base_t::adjust_load (int amount_)
load.add (amount_); load.add (amount_);
else else
if (amount_ < 0) if (amount_ < 0)
bool reset = load.sub (-amount_); load.sub (-amount_);
} }
void zmq::poller_base_t::add_timer (int timeout_, i_poll_events *sink_, int id_) void zmq::poller_base_t::add_timer (int timeout_, i_poll_events *sink_, int id_)
......
...@@ -228,8 +228,8 @@ int zmq::radio_session_t::pull_msg (msg_t *msg_) ...@@ -228,8 +228,8 @@ int zmq::radio_session_t::pull_msg (msg_t *msg_)
// First frame is the group // First frame is the group
rc = msg_->init_size (length); rc = msg_->init_size (length);
errno_assert(rc == 0); errno_assert(rc == 0);
msg_->set_flags(msg_t::more); msg_->set_flags(msg_t::more);
memcpy (msg_->data (), group, length); memcpy (msg_->data (), group, length);
// Next status is the body // Next status is the body
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
zmq::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) : zmq::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) :
object_t (ctx_, tid_), object_t (ctx_, tid_),
mailbox_handle(NULL),
sockets (0), sockets (0),
mailbox_handle(NULL),
terminating (false) terminating (false)
{ {
poller = new (std::nothrow) poller_t (*ctx_); poller = new (std::nothrow) poller_t (*ctx_);
......
...@@ -540,7 +540,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) ...@@ -540,7 +540,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
// We don't need the listening socket anymore. Close it. // We don't need the listening socket anymore. Close it.
rc = closesocket (listener); rc = closesocket (listener);
wsa_assert(rc != SOCKET_ERROR); wsa_assert(rc != SOCKET_ERROR);
if (sync != NULL) { if (sync != NULL) {
// Exit the critical section. // Exit the critical section.
......
...@@ -184,6 +184,8 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool ...@@ -184,6 +184,8 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool
tag (0xbaddecaf), tag (0xbaddecaf),
ctx_terminated (false), ctx_terminated (false),
destroyed (false), destroyed (false),
poller(NULL),
handle(NULL),
last_tsc (0), last_tsc (0),
ticks (0), ticks (0),
rcvmore (false), rcvmore (false),
...@@ -191,8 +193,6 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool ...@@ -191,8 +193,6 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool
monitor_socket (NULL), monitor_socket (NULL),
monitor_events (0), monitor_events (0),
thread_safe (thread_safe_), thread_safe (thread_safe_),
poller(nullptr),
handle(NULL),
reaper_signaler (NULL) reaper_signaler (NULL)
{ {
options.socket_id = sid_; options.socket_id = sid_;
...@@ -454,7 +454,7 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_, ...@@ -454,7 +454,7 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_,
EXIT_MUTEX (); EXIT_MUTEX ();
return -1; return -1;
} }
strncpy(static_cast <char *> (optval_), last_endpoint.c_str(), last_endpoint.size() + 1); strncpy(static_cast <char *> (optval_), last_endpoint.c_str(), last_endpoint.size() + 1);
*optvallen_ = last_endpoint.size () + 1; *optvallen_ = last_endpoint.size () + 1;
EXIT_MUTEX (); EXIT_MUTEX ();
return 0; return 0;
...@@ -1503,10 +1503,9 @@ void zmq::socket_base_t::in_event () ...@@ -1503,10 +1503,9 @@ void zmq::socket_base_t::in_event ()
if (thread_safe) if (thread_safe)
reaper_signaler->recv(); reaper_signaler->recv();
int rc = process_commands (0, false); process_commands (0, false);
EXIT_MUTEX(); EXIT_MUTEX();
errno_assert(rc == 0); check_destroy();
check_destroy();
} }
void zmq::socket_base_t::out_event () void zmq::socket_base_t::out_event ()
......
...@@ -34,19 +34,20 @@ ...@@ -34,19 +34,20 @@
zmq::socket_poller_t::socket_poller_t () : zmq::socket_poller_t::socket_poller_t () :
tag (0xCAFEBABE), tag (0xCAFEBABE),
need_rebuild (true), need_rebuild (true),
poll_size(0), use_signaler (false),
maxfd(0), poll_size(0)
use_signaler (false)
#if defined ZMQ_POLL_BASED_ON_POLL #if defined ZMQ_POLL_BASED_ON_POLL
, ,
pollfds (NULL) pollfds (NULL)
#elif defined ZMQ_POLL_BASED_ON_SELECT
,
maxfd(0)
#endif #endif
{ {
#if defined ZMQ_POLL_BASED_ON_SELECT #if defined ZMQ_POLL_BASED_ON_SELECT
memset(&pollset_in, 0, sizeof(pollset_in)); memset(&pollset_in, 0, sizeof(pollset_in));
memset(&pollset_out, 0, sizeof(pollset_in)); memset(&pollset_out, 0, sizeof(pollset_in));
memset(&pollset_err, 0, sizeof(pollset_in)); memset(&pollset_err, 0, sizeof(pollset_in));
maxfd = 0;
#endif #endif
} }
......
...@@ -61,11 +61,11 @@ zmq::socks_connecter_t::socks_connecter_t (class io_thread_t *io_thread_, ...@@ -61,11 +61,11 @@ zmq::socks_connecter_t::socks_connecter_t (class io_thread_t *io_thread_,
proxy_addr (proxy_addr_), proxy_addr (proxy_addr_),
status (unplugged), status (unplugged),
s (retired_fd), s (retired_fd),
handle(NULL),
handle_valid(false),
delayed_start (delayed_start_), delayed_start (delayed_start_),
timer_started(false),
session (session_), session (session_),
handle(NULL),
handle_valid(false),
timer_started(false),
current_reconnect_ivl (options.reconnect_ivl) current_reconnect_ivl (options.reconnect_ivl)
{ {
zmq_assert (addr); zmq_assert (addr);
......
...@@ -61,6 +61,8 @@ ...@@ -61,6 +61,8 @@
zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_, zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_,
const std::string &endpoint_) : const std::string &endpoint_) :
s (fd_), s (fd_),
as_server(false),
handle(NULL),
inpos (NULL), inpos (NULL),
insize (0), insize (0),
decoder (NULL), decoder (NULL),
...@@ -87,8 +89,6 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_, ...@@ -87,8 +89,6 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_,
has_timeout_timer (false), has_timeout_timer (false),
has_heartbeat_timer (false), has_heartbeat_timer (false),
heartbeat_timeout (0), heartbeat_timeout (0),
as_server(false),
handle(NULL),
socket (NULL) socket (NULL)
{ {
int rc = tx_msg.init (); int rc = tx_msg.init ();
...@@ -1021,8 +1021,8 @@ int zmq::stream_engine_t::produce_ping_message(msg_t * msg_) ...@@ -1021,8 +1021,8 @@ int zmq::stream_engine_t::produce_ping_message(msg_t * msg_)
// 16-bit TTL + \4PING == 7 // 16-bit TTL + \4PING == 7
rc = msg_->init_size(7); rc = msg_->init_size(7);
errno_assert(rc == 0); errno_assert(rc == 0);
msg_->set_flags(msg_t::command); msg_->set_flags(msg_t::command);
// Copy in the command message // Copy in the command message
memcpy(msg_->data(), "\4PING", 5); memcpy(msg_->data(), "\4PING", 5);
...@@ -1044,8 +1044,8 @@ int zmq::stream_engine_t::produce_pong_message(msg_t * msg_) ...@@ -1044,8 +1044,8 @@ int zmq::stream_engine_t::produce_pong_message(msg_t * msg_)
zmq_assert (mechanism != NULL); zmq_assert (mechanism != NULL);
rc = msg_->init_size(5); rc = msg_->init_size(5);
errno_assert(rc == 0); errno_assert(rc == 0);
msg_->set_flags(msg_t::command); msg_->set_flags(msg_t::command);
memcpy(msg_->data(), "\4PONG", 5); memcpy(msg_->data(), "\4PONG", 5);
......
...@@ -67,12 +67,12 @@ zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_, ...@@ -67,12 +67,12 @@ zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
io_object_t (io_thread_), io_object_t (io_thread_),
addr (addr_), addr (addr_),
s (retired_fd), s (retired_fd),
handle(NULL),
handle_valid (false), handle_valid (false),
delayed_start (delayed_start_), delayed_start (delayed_start_),
connect_timer_started (false), connect_timer_started (false),
reconnect_timer_started (false), reconnect_timer_started (false),
session (session_), session (session_),
handle(NULL),
current_reconnect_ivl (options.reconnect_ivl) current_reconnect_ivl (options.reconnect_ivl)
{ {
zmq_assert (addr); zmq_assert (addr);
......
...@@ -65,7 +65,7 @@ zmq::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_, ...@@ -65,7 +65,7 @@ zmq::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_,
own_t (io_thread_, options_), own_t (io_thread_, options_),
io_object_t (io_thread_), io_object_t (io_thread_),
s (retired_fd), s (retired_fd),
handle(NULL), handle(NULL),
socket (socket_) socket (socket_)
{ {
} }
......
...@@ -55,9 +55,8 @@ namespace zmq ...@@ -55,9 +55,8 @@ namespace zmq
public: public:
inline thread_t () inline thread_t ()
: tfn(nullptr) : tfn(NULL)
, arg(nullptr) , arg(NULL)
, descriptor(NULL)
{ {
} }
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#endif #endif
zmq::udp_address_t::udp_address_t () zmq::udp_address_t::udp_address_t ()
: is_mutlicast(false) : is_mutlicast(false)
{ {
memset (&bind_address, 0, sizeof bind_address); memset (&bind_address, 0, sizeof bind_address);
memset (&dest_address, 0, sizeof dest_address); memset (&dest_address, 0, sizeof dest_address);
......
...@@ -48,12 +48,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -48,12 +48,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
zmq::udp_engine_t::udp_engine_t() : zmq::udp_engine_t::udp_engine_t() :
plugged (false), plugged (false),
fd(NULL), fd(-1),
address(nullptr), session(NULL),
send_enabled(false), handle(NULL),
recv_enabled(false), address(NULL),
handle(NULL), send_enabled(false),
session(NULL) recv_enabled(false)
{ {
} }
......
...@@ -174,7 +174,7 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_, ...@@ -174,7 +174,7 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
if (optvallen_ > 0) { if (optvallen_ > 0) {
int rc = welcome_msg.init_size(optvallen_); int rc = welcome_msg.init_size(optvallen_);
errno_assert(rc == 0); errno_assert(rc == 0);
unsigned char *data = (unsigned char*)welcome_msg.data(); unsigned char *data = (unsigned char*)welcome_msg.data();
memcpy(data, optval_, optvallen_); memcpy(data, optval_, optvallen_);
......
...@@ -925,9 +925,9 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -925,9 +925,9 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// file descriptors. // file descriptors.
zmq_assert (nitems_ <= FD_SETSIZE); zmq_assert (nitems_ <= FD_SETSIZE);
fd_set pollset_in = { 0 }; fd_set pollset_in = { 0 };
fd_set pollset_out = { 0 }; fd_set pollset_out = { 0 };
fd_set pollset_err = { 0 }; fd_set pollset_err = { 0 };
zmq::fd_t maxfd = 0; zmq::fd_t maxfd = 0;
......
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