Problem: Source files contain mixed tabs and spaces.

Solution: Convert to spaces and remove trailing whitespace in these files.
This commit is contained in:
Joe Eli McIlvain
2015-08-20 07:46:34 -07:00
parent 6aa5c20b3d
commit 61217a2686
22 changed files with 397 additions and 398 deletions

View File

@@ -40,39 +40,39 @@ zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
verbose_unsubs (false),
more (false),
lossy (true),
manual(false),
welcome_msg ()
manual(false),
welcome_msg ()
{
last_pipe = NULL;
options.type = ZMQ_XPUB;
welcome_msg.init();
last_pipe = NULL;
options.type = ZMQ_XPUB;
welcome_msg.init();
}
zmq::xpub_t::~xpub_t ()
{
welcome_msg.close();
welcome_msg.close();
}
void zmq::xpub_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
zmq_assert (pipe_);
dist.attach (pipe_);
// If subscribe_to_all_ is specified, the caller would like to subscribe
// to all data on this pipe, implicitly.
if (subscribe_to_all_)
subscriptions.add (NULL, 0, pipe_);
subscriptions.add (NULL, 0, pipe_);
// if welcome message exist
if (welcome_msg.size() > 0)
{
msg_t copy;
copy.init();
copy.copy(welcome_msg);
// if welcome message exist
if (welcome_msg.size() > 0)
{
msg_t copy;
copy.init();
copy.copy(welcome_msg);
pipe_->write(&copy);
pipe_->flush();
}
pipe_->write(&copy);
pipe_->flush();
}
// The pipe is active when attached. Let's read the subscriptions from
// it, if any.
@@ -87,32 +87,32 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
// Apply the subscription to the trie
unsigned char *const data = (unsigned char *) sub.data ();
const size_t size = sub.size ();
if (size > 0 && (*data == 0 || *data == 1)) {
if (manual)
{
last_pipe = pipe_;
pending_data.push_back(blob_t(data, size));
if (size > 0 && (*data == 0 || *data == 1)) {
if (manual)
{
last_pipe = pipe_;
pending_data.push_back(blob_t(data, size));
pending_metadata.push_back(sub.metadata());
pending_flags.push_back(0);
}
else
{
bool unique;
if (*data == 0)
unique = subscriptions.rm(data + 1, size - 1, pipe_);
else
unique = subscriptions.add(data + 1, size - 1, pipe_);
pending_flags.push_back(0);
}
else
{
bool unique;
if (*data == 0)
unique = subscriptions.rm(data + 1, size - 1, pipe_);
else
unique = subscriptions.add(data + 1, size - 1, pipe_);
// If the (un)subscription is not a duplicate store it so that it can be
// passed to the user on next recv call unless verbose mode is enabled
// which makes to pass always these messages.
if (options.type == ZMQ_XPUB && (unique || (*data == 1 && verbose_subs) ||
(*data == 0 && verbose_unsubs && verbose_subs))) {
pending_data.push_back(blob_t(data, size));
// If the (un)subscription is not a duplicate store it so that it can be
// passed to the user on next recv call unless verbose mode is enabled
// which makes to pass always these messages.
if (options.type == ZMQ_XPUB && (unique || (*data == 1 && verbose_subs) ||
(*data == 0 && verbose_unsubs && verbose_subs))) {
pending_data.push_back(blob_t(data, size));
pending_metadata.push_back(sub.metadata());
pending_flags.push_back(0);
}
}
pending_flags.push_back(0);
}
}
}
else {
// Process user message coming upstream from xsub socket
@@ -131,46 +131,46 @@ void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
size_t optvallen_)
{
if (option_ == ZMQ_XPUB_VERBOSE || option_ == ZMQ_XPUB_VERBOSE_UNSUBSCRIBE ||
option_ == ZMQ_XPUB_NODROP || option_ == ZMQ_XPUB_MANUAL)
{
if (optvallen_ != sizeof(int) || *static_cast <const int*> (optval_) < 0) {
errno = EINVAL;
return -1;
}
{
if (option_ == ZMQ_XPUB_VERBOSE || option_ == ZMQ_XPUB_VERBOSE_UNSUBSCRIBE ||
option_ == ZMQ_XPUB_NODROP || option_ == ZMQ_XPUB_MANUAL)
{
if (optvallen_ != sizeof(int) || *static_cast <const int*> (optval_) < 0) {
errno = EINVAL;
return -1;
}
if (option_ == ZMQ_XPUB_VERBOSE)
verbose_subs = (*static_cast <const int*> (optval_) != 0);
else
if (option_ == ZMQ_XPUB_VERBOSE_UNSUBSCRIBE)
verbose_unsubs = (*static_cast <const int*> (optval_) != 0);
else
if (option_ == ZMQ_XPUB_NODROP)
lossy = (*static_cast <const int*> (optval_) == 0);
else
if (option_ == ZMQ_XPUB_MANUAL)
manual = (*static_cast <const int*> (optval_) != 0);
}
else
if (option_ == ZMQ_SUBSCRIBE && manual && last_pipe != NULL)
subscriptions.add((unsigned char *)optval_, optvallen_, last_pipe);
else
if (option_ == ZMQ_UNSUBSCRIBE && manual && last_pipe != NULL)
subscriptions.rm((unsigned char *)optval_, optvallen_, last_pipe);
else
if (option_ == ZMQ_XPUB_WELCOME_MSG) {
welcome_msg.close();
if (option_ == ZMQ_XPUB_VERBOSE)
verbose_subs = (*static_cast <const int*> (optval_) != 0);
else
if (option_ == ZMQ_XPUB_VERBOSE_UNSUBSCRIBE)
verbose_unsubs = (*static_cast <const int*> (optval_) != 0);
else
if (option_ == ZMQ_XPUB_NODROP)
lossy = (*static_cast <const int*> (optval_) == 0);
else
if (option_ == ZMQ_XPUB_MANUAL)
manual = (*static_cast <const int*> (optval_) != 0);
}
else
if (option_ == ZMQ_SUBSCRIBE && manual && last_pipe != NULL)
subscriptions.add((unsigned char *)optval_, optvallen_, last_pipe);
else
if (option_ == ZMQ_UNSUBSCRIBE && manual && last_pipe != NULL)
subscriptions.rm((unsigned char *)optval_, optvallen_, last_pipe);
else
if (option_ == ZMQ_XPUB_WELCOME_MSG) {
welcome_msg.close();
if (optvallen_ > 0) {
welcome_msg.init_size(optvallen_);
if (optvallen_ > 0) {
welcome_msg.init_size(optvallen_);
unsigned char *data = (unsigned char*)welcome_msg.data();
memcpy(data, optval_, optvallen_);
}
else
welcome_msg.init();
}
unsigned char *data = (unsigned char*)welcome_msg.data();
memcpy(data, optval_, optvallen_);
}
else
welcome_msg.init();
}
else {
errno = EINVAL;
return -1;
@@ -211,7 +211,7 @@ int zmq::xpub_t::xsend (msg_t *msg_)
int rc = -1; // Assume we fail
if (lossy || dist.check_hwm ()) {
if (dist.send_to_matching (msg_) == 0) {
// If we are at the end of multi-part message we can mark
// If we are at the end of multi-part message we can mark
// all the pipes as non-matching.
if (!msg_more)
dist.unmatch ();
@@ -244,11 +244,11 @@ int zmq::xpub_t::xrecv (msg_t *msg_)
memcpy (msg_->data (),
pending_data.front ().data (),
pending_data.front ().size ());
// set metadata only if there is some
if (metadata_t* metadata = pending_metadata.front ()) {
msg_->set_metadata (metadata);
}
// set metadata only if there is some
if (metadata_t* metadata = pending_metadata.front ()) {
msg_->set_metadata (metadata);
}
msg_->set_flags (pending_flags.front ());
pending_data.pop_front ();