Skip to content

Commit

Permalink
Loss of data warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sonndinh committed Aug 21, 2024
1 parent 48715ad commit ef24624
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
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
4 changes: 2 additions & 2 deletions dds/DCPS/transport/multicast/MulticastInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ MulticastInst::port_offset(u_short po)
u_short
MulticastInst::port_offset() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("PORT_OFFSET").c_str(), DEFAULT_PORT_OFFSET);
return static_cast<u_short>(TheServiceParticipant->config_store()->get_uint32(config_key("PORT_OFFSET").c_str(), DEFAULT_PORT_OFFSET));
}

void
Expand Down Expand Up @@ -338,7 +338,7 @@ MulticastInst::ttl(unsigned char t)
unsigned char
MulticastInst::ttl() const
{
return TheServiceParticipant->config_store()->get_uint32(config_key("TTL").c_str(), DEFAULT_TTL);
return static_cast<unsigned char>(TheServiceParticipant->config_store()->get_uint32(config_key("TTL").c_str(), DEFAULT_TTL));
}

void
Expand Down

0 comments on commit ef24624

Please sign in to comment.