Skip to content

Commit

Permalink
Merge pull request OpenDDS#4768 from sonndinh/reduce-warnings-p4
Browse files Browse the repository at this point in the history
Address warnings (cont.)
  • Loading branch information
jrw972 authored Aug 22, 2024
2 parents 34b0ea4 + ef24624 commit 8a33db8
Show file tree
Hide file tree
Showing 26 changed files with 132 additions and 118 deletions.
2 changes: 1 addition & 1 deletion dds/DCPS/RTPS/ParameterListConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ bool from_param_list(const ParameterList& param_list,
// Interoperability note:
// Spec creators for RTPS have reliability indexed at 1
{
const CORBA::Short rtpsKind = param.reliability().kind.value;
const CORBA::Short rtpsKind = static_cast<CORBA::Short>(param.reliability().kind.value);
const CORBA::Short OLD_RELIABLE_VALUE = 3;
if (rtpsKind == RTPS::RELIABLE || rtpsKind == OLD_RELIABLE_VALUE) {
reader_data.ddsSubscriptionData.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
Expand Down
30 changes: 15 additions & 15 deletions dds/DCPS/RTPS/RtpsDiscoveryConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ void RtpsDiscoveryConfig::sedp_port_mode(PortMode value)
DDS::UInt16
RtpsDiscoveryConfig::pb() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("PB").c_str(),
default_port_base);
return static_cast<DDS::UInt16>(TheServiceParticipant->config_store()->get_uint32(config_key("PB").c_str(),
default_port_base));
}

void
Expand All @@ -206,8 +206,8 @@ RtpsDiscoveryConfig::pb(DDS::UInt16 port_base)
DDS::UInt16
RtpsDiscoveryConfig::dg() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("DG").c_str(),
default_domain_gain);
return static_cast<DDS::UInt16>(TheServiceParticipant->config_store()->get_uint32(config_key("DG").c_str(),
default_domain_gain));
}

void
Expand All @@ -220,8 +220,8 @@ RtpsDiscoveryConfig::dg(DDS::UInt16 domain_gain)
DDS::UInt16
RtpsDiscoveryConfig::pg() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("PG").c_str(),
default_part_gain);
return static_cast<DDS::UInt16>(TheServiceParticipant->config_store()->get_uint32(config_key("PG").c_str(),
default_part_gain));
}

void
Expand All @@ -241,8 +241,8 @@ RtpsDiscoveryConfig::d0() const
default_value = static_cast<DDS::UInt16>(std::atoi(from_env));
}
#endif
return TheServiceParticipant->config_store()->get_uint32(config_key("D0").c_str(),
default_value);
return static_cast<DDS::UInt16>(TheServiceParticipant->config_store()->get_uint32(config_key("D0").c_str(),
default_value));
}

void
Expand All @@ -255,8 +255,8 @@ RtpsDiscoveryConfig::d0(DDS::UInt16 spdp_multicast_offset)
DDS::UInt16
RtpsDiscoveryConfig::d1() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("D1").c_str(),
default_spdp_unicast_offset);
return static_cast<DDS::UInt16>(TheServiceParticipant->config_store()->get_uint32(config_key("D1").c_str(),
default_spdp_unicast_offset));
}

void
Expand All @@ -268,8 +268,8 @@ RtpsDiscoveryConfig::d1(DDS::UInt16 spdp_unicast_offset)
DDS::UInt16
RtpsDiscoveryConfig::dx() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("DX").c_str(),
default_sedp_multicast_offset);
return static_cast<DDS::UInt16>(TheServiceParticipant->config_store()->get_uint32(config_key("DX").c_str(),
default_sedp_multicast_offset));
}

void
Expand All @@ -282,8 +282,8 @@ RtpsDiscoveryConfig::dx(DDS::UInt16 sedp_multicast_offset)
DDS::UInt16
RtpsDiscoveryConfig::dy() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("DY").c_str(),
default_sedp_unicast_offset);
return static_cast<DDS::UInt16>(TheServiceParticipant->config_store()->get_uint32(config_key("DY").c_str(),
default_sedp_unicast_offset));
}

void
Expand All @@ -309,7 +309,7 @@ bool RtpsDiscoveryConfig::set_spdp_unicast_port(DCPS::NetworkAddress& addr, bool
unsigned char
RtpsDiscoveryConfig::ttl() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("TTL").c_str(), 1);
return static_cast<unsigned char>(TheServiceParticipant->config_store()->get_uint32(config_key("TTL").c_str(), 1));
}

void
Expand Down
8 changes: 4 additions & 4 deletions dds/DCPS/Serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ Serializer::ScopedAlignmentContext::ScopedAlignmentContext(Serializer& ser, size
: ser_(ser)
, max_align_(ser.encoding().max_align())
, start_rpos_(ser.rpos())
, rblock_((max_align_ && ser.current_) ? (ptrdiff_t(ser.current_->rd_ptr()) - ser.align_rshift_) % max_align_ : 0)
, rblock_((max_align_ && ser.current_) ? (reinterpret_cast<size_t>(ser.current_->rd_ptr()) - ser.align_rshift_) % max_align_ : 0)
, min_read_(min_read)
, start_wpos_(ser.wpos())
, wblock_((max_align_ && ser.current_) ? (ptrdiff_t(ser.current_->wr_ptr()) - ser.align_wshift_) % max_align_ : 0)
, wblock_((max_align_ && ser.current_) ? (reinterpret_cast<size_t>(ser.current_->wr_ptr()) - ser.align_wshift_) % max_align_ : 0)
{
ser_.reset_alignment();
}
Expand Down Expand Up @@ -214,7 +214,7 @@ Serializer::peek(ACE_CDR::ULong& t)
void
Serializer::reset_alignment()
{
const ptrdiff_t align = encoding().max_align();
const size_t align = encoding().max_align();
if (current_ && align) {
align_rshift_ = offset(current_->rd_ptr(), 0, align);
align_wshift_ = offset(current_->wr_ptr(), 0, align);
Expand Down Expand Up @@ -503,7 +503,7 @@ bool Serializer::read_parameter_id(unsigned& id, size_t& size, bool& must_unders
if (!(*this >> long_id) || !(*this >> long_size)) {
return false;
}
const unsigned short_size_left = short_size - 8;
const unsigned short_size_left = short_size - 8u;
if (short_size_left) {
skip(short_size_left);
}
Expand Down
2 changes: 1 addition & 1 deletion dds/DCPS/ValueHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ std::ostream& char_helper(std::ostream& o, CharType value)
return o << "\\a";
}
const unsigned cvalue = char_value(value);
if (cvalue <= UCHAR_MAX && isprint(cvalue)) {
if (cvalue <= UCHAR_MAX && isprint(static_cast<int>(cvalue))) {
return o << static_cast<char>(value);
}
return hex_value(o << "\\x", cvalue, sizeof(CharType) == 1 ? 1 : 2);
Expand Down
Loading

0 comments on commit 8a33db8

Please sign in to comment.