mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-07 05:58:45 +01:00
Problem: formatting inconsistent
Solution: applied clang-format
This commit is contained in:
@@ -39,8 +39,8 @@
|
||||
#include "err.hpp"
|
||||
|
||||
zmq::v1_decoder_t::v1_decoder_t (size_t bufsize_, int64_t maxmsgsize_) :
|
||||
c_single_allocator(bufsize_),
|
||||
decoder_base_t <v1_decoder_t> (this),
|
||||
c_single_allocator (bufsize_),
|
||||
decoder_base_t<v1_decoder_t> (this),
|
||||
maxmsgsize (maxmsgsize_)
|
||||
{
|
||||
int rc = in_progress.init ();
|
||||
@@ -56,7 +56,7 @@ zmq::v1_decoder_t::~v1_decoder_t ()
|
||||
errno_assert (rc == 0);
|
||||
}
|
||||
|
||||
int zmq::v1_decoder_t::one_byte_size_ready (unsigned char const*)
|
||||
int zmq::v1_decoder_t::one_byte_size_ready (unsigned char const *)
|
||||
{
|
||||
// First byte of size is read. If it is 0xff read 8-byte size.
|
||||
// Otherwise allocate the buffer for message data and read the
|
||||
@@ -64,7 +64,6 @@ int zmq::v1_decoder_t::one_byte_size_ready (unsigned char const*)
|
||||
if (*tmpbuf == 0xff)
|
||||
next_step (tmpbuf, 8, &v1_decoder_t::eight_byte_size_ready);
|
||||
else {
|
||||
|
||||
// There has to be at least one byte (the flags) in the message).
|
||||
if (!*tmpbuf) {
|
||||
errno = EPROTO;
|
||||
@@ -76,8 +75,8 @@ int zmq::v1_decoder_t::one_byte_size_ready (unsigned char const*)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rc = in_progress.close();
|
||||
assert(rc == 0);
|
||||
int rc = in_progress.close ();
|
||||
assert (rc == 0);
|
||||
rc = in_progress.init_size (*tmpbuf - 1);
|
||||
if (rc != 0) {
|
||||
errno_assert (errno == ENOMEM);
|
||||
@@ -92,7 +91,7 @@ int zmq::v1_decoder_t::one_byte_size_ready (unsigned char const*)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zmq::v1_decoder_t::eight_byte_size_ready (unsigned char const*)
|
||||
int zmq::v1_decoder_t::eight_byte_size_ready (unsigned char const *)
|
||||
{
|
||||
// 8-byte payload length is read. Allocate the buffer
|
||||
// for message body and read the message data into it.
|
||||
@@ -111,15 +110,15 @@ int zmq::v1_decoder_t::eight_byte_size_ready (unsigned char const*)
|
||||
}
|
||||
|
||||
// Message size must fit within range of size_t data type.
|
||||
if (payload_length - 1 > std::numeric_limits <size_t>::max ()) {
|
||||
if (payload_length - 1 > std::numeric_limits<size_t>::max ()) {
|
||||
errno = EMSGSIZE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const size_t msg_size = static_cast <size_t> (payload_length - 1);
|
||||
const size_t msg_size = static_cast<size_t> (payload_length - 1);
|
||||
|
||||
int rc = in_progress.close();
|
||||
assert(rc == 0);
|
||||
int rc = in_progress.close ();
|
||||
assert (rc == 0);
|
||||
rc = in_progress.init_size (msg_size);
|
||||
if (rc != 0) {
|
||||
errno_assert (errno == ENOMEM);
|
||||
@@ -133,18 +132,18 @@ int zmq::v1_decoder_t::eight_byte_size_ready (unsigned char const*)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zmq::v1_decoder_t::flags_ready (unsigned char const*)
|
||||
int zmq::v1_decoder_t::flags_ready (unsigned char const *)
|
||||
{
|
||||
// Store the flags from the wire into the message structure.
|
||||
in_progress.set_flags (tmpbuf [0] & msg_t::more);
|
||||
in_progress.set_flags (tmpbuf[0] & msg_t::more);
|
||||
|
||||
next_step (in_progress.data (), in_progress.size (),
|
||||
&v1_decoder_t::message_ready);
|
||||
&v1_decoder_t::message_ready);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zmq::v1_decoder_t::message_ready (unsigned char const*)
|
||||
int zmq::v1_decoder_t::message_ready (unsigned char const *)
|
||||
{
|
||||
// Message is completely read. Push it further and start reading
|
||||
// new message. (in_progress is a 0-byte message after this point.)
|
||||
|
||||
Reference in New Issue
Block a user