Skip to content

Commit

Permalink
Merge pull request OpenDDS#4755 from sonndinh/reduce-warnings-p2
Browse files Browse the repository at this point in the history
Address warnings (cont.)
  • Loading branch information
jrw972 authored Aug 1, 2024
2 parents f1820e7 + fb02550 commit 0299e08
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions dds/DCPS/DataReaderImpl_T.h
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ void store_instance_data(unique_ptr<MessageTypeWithAllocator> instance_data,
const std::pair<typename SubscriptionInstanceMapType::iterator, bool> bpair =
instances_.insert(typename SubscriptionInstanceMapType::value_type(handle, instance));

if (bpair.second == false) {
if (!bpair.second) {
if (DCPS_debug_level > 0) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("(%P|%t) ")
Expand All @@ -1875,9 +1875,9 @@ void store_instance_data(unique_ptr<MessageTypeWithAllocator> instance_data,
}

if (new_handle) {
const std::pair<typename InstanceMap::iterator, bool> bpair =
const std::pair<typename InstanceMap::iterator, bool> res =
inst->insert(typename InstanceMap::value_type(*instance_data, handle));
if (!bpair.second) {
if (!res.second) {
if (DCPS_debug_level > 0) {
ACE_ERROR ((LM_ERROR,
ACE_TEXT("(%P|%t) ")
Expand Down Expand Up @@ -1908,7 +1908,7 @@ void store_instance_data(unique_ptr<MessageTypeWithAllocator> instance_data,
std::pair<typename InstanceMap::iterator, bool> bpair =
instance_map_.insert(typename InstanceMap::value_type(*instance_data,
handle));
if (bpair.second == false)
if (!bpair.second)
{
if (DCPS_debug_level > 0) {
ACE_ERROR ((LM_ERROR,
Expand Down
4 changes: 2 additions & 2 deletions dds/DCPS/RTPS/Spdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4681,14 +4681,14 @@ DDS::ParticipantBuiltinTopicData Spdp::get_part_bit_data(bool secure) const

VendorId_t Spdp::get_vendor_id(const GUID_t& guid) const
{
const VendorId_t unknown_vendor = { 0, 0 };
const VendorId_t unknown_vendor = {{ 0, 0 }};
ACE_GUARD_RETURN(ACE_Thread_Mutex, g, lock_, unknown_vendor);
return get_vendor_id_i(guid);
}

VendorId_t Spdp::get_vendor_id_i(const GUID_t& guid) const
{
const VendorId_t unknown_vendor = { 0, 0 };
const VendorId_t unknown_vendor = {{ 0, 0 }};
DiscoveredParticipantConstIter iter = participants_.find(make_part_guid(guid));
if (iter != participants_.end()) {
return iter->second.pdata_.participantProxy.vendorId;
Expand Down
14 changes: 7 additions & 7 deletions dds/DCPS/Serializer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ Serializer::skip(size_t n, int size)
return false;
}

for (size_t len = static_cast<size_t>(n * size); len;) {
for (size_t len = n * static_cast<size_t>(size); len;) {
if (!current_) {
good_bit_ = false;
return false;
Expand All @@ -425,7 +425,7 @@ Serializer::skip(size_t n, int size)
}

if (good_bit_) {
rpos_ += n * size;
rpos_ += n * static_cast<size_t>(size);
}
return good_bit();
}
Expand Down Expand Up @@ -783,7 +783,7 @@ bool Serializer::align_r(size_t al)
}
al = (std::min)(al, encoding().max_align());
const size_t len =
(al - ptrdiff_t(current_->rd_ptr()) + align_rshift_) % al;
(al - reinterpret_cast<size_t>(current_->rd_ptr()) + align_rshift_) % al;

return skip(static_cast<ACE_CDR::UShort>(len));
}
Expand All @@ -800,7 +800,7 @@ bool Serializer::align_w(size_t al)
}
al = (std::min)(al, encoding().max_align());
size_t len =
(al - ptrdiff_t(current_->wr_ptr()) + align_wshift_) % al;
(al - reinterpret_cast<size_t>(current_->wr_ptr()) + align_wshift_) % al;
while (len) {
if (!current_) {
good_bit_ = false;
Expand Down Expand Up @@ -830,15 +830,15 @@ bool Serializer::align_w(size_t al)
ACE_INLINE unsigned char
Serializer::offset(char* index, size_t start, size_t align)
{
return static_cast<unsigned char>((ptrdiff_t(index) - start) % align);
return static_cast<unsigned char>((reinterpret_cast<size_t>(index) - start) % align);
}

ACE_INLINE void
Serializer::align_cont_r()
{
const size_t max_align = encoding().max_align();
const size_t thisblock =
max_align ? (ptrdiff_t(current_->rd_ptr()) - align_rshift_) % max_align : 0;
max_align ? (reinterpret_cast<size_t>(current_->rd_ptr()) - align_rshift_) % max_align : 0;

current_ = current_->cont();

Expand All @@ -852,7 +852,7 @@ Serializer::align_cont_w()
{
const size_t max_align = encoding().max_align();
const size_t thisblock =
max_align ? (ptrdiff_t(current_->wr_ptr()) - align_wshift_) % max_align : 0;
max_align ? (reinterpret_cast<size_t>(current_->wr_ptr()) - align_wshift_) % max_align : 0;

current_ = current_->cont();

Expand Down
1 change: 1 addition & 0 deletions dds/idl/marshal_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ namespace {
" return strm.read_" << getSerializerName(elem)
<< "_array(" << get_buffer << ", length);\n";
}
return;
}
} else if (elem_cls & CL_INTERFACE) {
be_global->impl_ <<
Expand Down

0 comments on commit 0299e08

Please sign in to comment.