Skip to content

Commit

Permalink
litteral and macros on left side of operands
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelarguedas committed Apr 14, 2018
1 parent 24603fa commit 4c4fb47
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ size_t TypeSupport<MembersType>::calculateMaxSerializedSize(
if (member->is_array_) {
array_size = member->array_size_;
// Whether it is a sequence.
if (array_size == 0 || member->is_upper_bound_) {
if (0 == array_size || member->is_upper_bound_) {
current_alignment += padding +
eprosima::fastcdr::Cdr::alignment(current_alignment, padding);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ class ClientListener : public eprosima::fastrtps::SubscriberListener
eprosima::fastrtps::SampleInfo_t sinfo;

if (sub->takeNextData(response.buffer_, &sinfo)) {
if (sinfo.sampleKind == eprosima::fastrtps::rtps::ALIVE) {
if (eprosima::fastrtps::rtps::ALIVE == sinfo.sampleKind) {
response.sample_identity_ = sinfo.related_sample_identity;

if (info_->writer_guid_ == response.sample_identity_.writer_guid()) {
if (response.sample_identity_.writer_guid() == info_->writer_guid_) {
std::lock_guard<std::mutex> lock(internalMutex_);

if (conditionMutex_ != nullptr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ServiceListener : public eprosima::fastrtps::SubscriberListener
eprosima::fastrtps::SampleInfo_t sinfo;

if (sub->takeNextData(request.buffer_, &sinfo)) {
if (sinfo.sampleKind == eprosima::fastrtps::rtps::ALIVE) {
if (eprosima::fastrtps::rtps::ALIVE == sinfo.sampleKind) {
request.sample_identity_ = sinfo.sample_identity;

std::lock_guard<std::mutex> lock(internalMutex_);
Expand Down
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/reader_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ReaderInfo : public eprosima::fastrtps::rtps::ReaderListener
const eprosima::fastrtps::rtps::CacheChange_t * const change)
{
eprosima::fastrtps::rtps::ReaderProxyData proxyData;
if (change->kind == eprosima::fastrtps::rtps::ALIVE) {
if (eprosima::fastrtps::rtps::ALIVE == change->kind) {
eprosima::fastrtps::rtps::CDRMessage_t tempMsg(0);
tempMsg.wraps = true;
if (PL_CDR_BE == change->serializedPayload.encapsulation) {
Expand Down Expand Up @@ -80,7 +80,7 @@ class ReaderInfo : public eprosima::fastrtps::rtps::ReaderListener

bool trigger = false;
mapmutex.lock();
if (change->kind == eprosima::fastrtps::rtps::ALIVE) {
if (eprosima::fastrtps::rtps::ALIVE == change->kind) {
topicNtypes[fqdn].push_back(proxyData.typeName());
trigger = true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/writer_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class WriterInfo : public eprosima::fastrtps::rtps::ReaderListener
const eprosima::fastrtps::rtps::CacheChange_t * const change)
{
eprosima::fastrtps::rtps::WriterProxyData proxyData;
if (change->kind == eprosima::fastrtps::rtps::ALIVE) {
if (eprosima::fastrtps::rtps::ALIVE == change->kind) {
eprosima::fastrtps::rtps::CDRMessage_t tempMsg(0);
tempMsg.wraps = true;
if (PL_CDR_BE == change->serializedPayload.encapsulation) {
Expand Down Expand Up @@ -78,7 +78,7 @@ class WriterInfo : public eprosima::fastrtps::rtps::ReaderListener

bool trigger = false;
mapmutex.lock();
if (change->kind == eprosima::fastrtps::rtps::ALIVE) {
if (eprosima::fastrtps::rtps::ALIVE == change->kind) {
topicNtypes[fqdn].push_back(proxyData.typeName());
trigger = true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/src/assign_partitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ _assign_partitions_to_attributes(
RMW_SET_ERROR_MSG(rcutils_get_error_string_safe());
return ret;
}
if (name_tokens.size == 1) {
if (1 == name_tokens.size) {
if (!avoid_ros_namespace_conventions) {
attributes->qos.m_partition.push_back(prefix);
}
attributes->topic.topicName = name_tokens.data[0];
ret = RCUTILS_RET_OK;
} else if (name_tokens.size == 2) {
} else if (2 == name_tokens.size) {
std::string partition;
if (avoid_ros_namespace_conventions) {
// no prefix to be used, just assign the user's namespace
Expand Down
6 changes: 3 additions & 3 deletions rmw_fastrtps_cpp/src/demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ _demangle_service_from_topic(const std::string & topic_name)
break;
}
}
if (suffix_position == std::string::npos) {
if (std::string::npos == suffix_position) {
RCUTILS_LOG_WARN_NAMED("rmw_fastrtps_cpp",
"service topic has prefix but no suffix"
", report this: '%s'", topic_name.c_str())
Expand All @@ -108,7 +108,7 @@ _demangle_service_type_only(const std::string & dds_type_name)
{
std::string ns_substring = "::srv::dds_::";
size_t ns_substring_position = dds_type_name.find(ns_substring);
if (ns_substring_position == std::string::npos) {
if (std::string::npos == ns_substring_position) {
// not a ROS service type
return "";
}
Expand All @@ -131,7 +131,7 @@ _demangle_service_type_only(const std::string & dds_type_name)
break;
}
}
if (suffix_position == std::string::npos) {
if (std::string::npos == suffix_position) {
RCUTILS_LOG_WARN_NAMED("rmw_fastrtps_cpp",
"service type contains '::srv::dds_::' but does not have a suffix"
", report this: '%s'", dds_type_name.c_str())
Expand Down
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/src/qos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ get_datareader_qos(
// ensure the history depth is at least the requested queue size
assert(sattr.topic.historyQos.depth >= 0);
if (
sattr.topic.historyQos.kind == eprosima::fastrtps::KEEP_LAST_HISTORY_QOS &&
eprosima::fastrtps::KEEP_LAST_HISTORY_QOS == sattr.topic.historyQos.kind &&
static_cast<size_t>(sattr.topic.historyQos.depth) < qos_policies.depth)
{
if (qos_policies.depth > (std::numeric_limits<int32_t>::max)()) {
Expand Down Expand Up @@ -144,7 +144,7 @@ get_datawriter_qos(
// ensure the history depth is at least the requested queue size
assert(pattr.topic.historyQos.depth >= 0);
if (
pattr.topic.historyQos.kind == eprosima::fastrtps::KEEP_LAST_HISTORY_QOS &&
eprosima::fastrtps::KEEP_LAST_HISTORY_QOS == pattr.topic.historyQos.kind &&
static_cast<size_t>(pattr.topic.historyQos.depth) < qos_policies.depth)
{
if (qos_policies.depth > (std::numeric_limits<int32_t>::max)()) {
Expand Down
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/src/rmw_service_server_is_available.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ rmw_service_server_is_available(
// error string already set
return ret;
}
if (number_of_request_subscribers == 0) {
if (0 == number_of_request_subscribers) {
// not ready
return RMW_RET_OK;
}
Expand All @@ -116,7 +116,7 @@ rmw_service_server_is_available(
// error string already set
return ret;
}
if (number_of_response_publishers == 0) {
if (0 == number_of_response_publishers) {
// not ready
return RMW_RET_OK;
}
Expand Down
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/src/rmw_take.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ rmw_take(const rmw_subscription_t * subscription, void * ros_message, bool * tak
if (info->subscriber_->takeNextData(&buffer, &sinfo)) {
info->listener_->data_taken();

if (sinfo.sampleKind == eprosima::fastrtps::rtps::ALIVE) {
if (eprosima::fastrtps::rtps::ALIVE == sinfo.sampleKind) {
_deserialize_ros_message(&buffer, ros_message, info->type_support_,
info->typesupport_identifier_);
*taken = true;
Expand Down Expand Up @@ -92,7 +92,7 @@ rmw_take_with_info(
if (info->subscriber_->takeNextData(&buffer, &sinfo)) {
info->listener_->data_taken();

if (sinfo.sampleKind == eprosima::fastrtps::rtps::ALIVE) {
if (eprosima::fastrtps::rtps::ALIVE == sinfo.sampleKind) {
_deserialize_ros_message(&buffer, ros_message, info->type_support_,
info->typesupport_identifier_);
rmw_gid_t * sender_gid = &message_info->publisher_gid;
Expand Down

0 comments on commit 4c4fb47

Please sign in to comment.