mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-06 21:56:25 +01:00
Problem: ptr/ref parameters and local variables are non-const but never modified
Solution: add const
This commit is contained in:
@@ -90,7 +90,7 @@ void zmq::router_t::xattach_pipe (pipe_t *pipe_,
|
||||
errno_assert (rc == 0);
|
||||
}
|
||||
|
||||
bool routing_id_ok = identify_peer (pipe_, locally_initiated_);
|
||||
const bool routing_id_ok = identify_peer (pipe_, locally_initiated_);
|
||||
if (routing_id_ok)
|
||||
_fq.attach (pipe_);
|
||||
else
|
||||
@@ -171,7 +171,7 @@ void zmq::router_t::xpipe_terminated (pipe_t *pipe_)
|
||||
|
||||
void zmq::router_t::xread_activated (pipe_t *pipe_)
|
||||
{
|
||||
std::set<pipe_t *>::iterator it = _anonymous_pipes.find (pipe_);
|
||||
const std::set<pipe_t *>::iterator it = _anonymous_pipes.find (pipe_);
|
||||
if (it == _anonymous_pipes.end ())
|
||||
_fq.activated (pipe_);
|
||||
else {
|
||||
@@ -209,7 +209,7 @@ int zmq::router_t::xsend (msg_t *msg_)
|
||||
// Check whether pipe is closed or not
|
||||
if (!_current_out->check_write ()) {
|
||||
// Check whether pipe is full or not
|
||||
bool pipe_full = !_current_out->check_hwm ();
|
||||
const bool pipe_full = !_current_out->check_hwm ();
|
||||
out_pipe->active = false;
|
||||
_current_out = NULL;
|
||||
|
||||
@@ -258,10 +258,10 @@ int zmq::router_t::xsend (msg_t *msg_)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ok = _current_out->write (msg_);
|
||||
const bool ok = _current_out->write (msg_);
|
||||
if (unlikely (!ok)) {
|
||||
// Message failed to send - we must close it ourselves.
|
||||
int rc = msg_->close ();
|
||||
const int rc = msg_->close ();
|
||||
errno_assert (rc == 0);
|
||||
// HWM was checked before, so the pipe must be gone. Roll back
|
||||
// messages that were piped, for example REP labels.
|
||||
@@ -274,12 +274,12 @@ int zmq::router_t::xsend (msg_t *msg_)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int rc = msg_->close ();
|
||||
const int rc = msg_->close ();
|
||||
errno_assert (rc == 0);
|
||||
}
|
||||
|
||||
// Detach the message from the data buffer.
|
||||
int rc = msg_->init ();
|
||||
const int rc = msg_->init ();
|
||||
errno_assert (rc == 0);
|
||||
|
||||
return 0;
|
||||
@@ -289,11 +289,11 @@ int zmq::router_t::xrecv (msg_t *msg_)
|
||||
{
|
||||
if (_prefetched) {
|
||||
if (!_routing_id_sent) {
|
||||
int rc = msg_->move (_prefetched_id);
|
||||
const int rc = msg_->move (_prefetched_id);
|
||||
errno_assert (rc == 0);
|
||||
_routing_id_sent = true;
|
||||
} else {
|
||||
int rc = msg_->move (_prefetched_msg);
|
||||
const int rc = msg_->move (_prefetched_msg);
|
||||
errno_assert (rc == 0);
|
||||
_prefetched = false;
|
||||
}
|
||||
@@ -469,7 +469,7 @@ bool zmq::router_t::identify_peer (pipe_t *pipe_, bool locally_initiated_)
|
||||
} else if (!options.raw_socket) {
|
||||
// Pick up handshake cases and also case where next integral routing id is set
|
||||
msg.init ();
|
||||
bool ok = pipe_->read (&msg);
|
||||
const bool ok = pipe_->read (&msg);
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user