Skip to content

Commit

Permalink
Refs #19760. Fix warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo González Moreno <[email protected]>
  • Loading branch information
richiware committed Nov 15, 2023
1 parent 7c9c5a9 commit 3aa9e16
Showing 1 changed file with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ $struct.name$PubSubType::$struct.name$PubSubType()
$if(ctx.GenerateTypesROS2)$setName("$struct.ROS2Scopedname$");$else$setName("$struct.scopedname$");$endif$
uint32_t type_size =
#if FASTCDR_VERSION_MAJOR == 1
$struct.name$::getMaxCdrSerializedSize();
static_cast<uint32_t>($struct.name$::getMaxCdrSerializedSize());
#else
$struct.cScopedname$_max_cdr_typesize;
#endif
Expand Down Expand Up @@ -198,23 +198,24 @@ std::function<uint32_t()> $struct.name$PubSubType::getSerializedSizeProvider(
return [data, data_representation]() -> uint32_t
{
#if FASTCDR_VERSION_MAJOR == 1
return static_cast<uint32_t>(type::getCdrSerializedSize(*static_cast<$struct.name$*>(data))) +
static_cast<void>(data_representation);
return static_cast<uint32_t>(type::getCdrSerializedSize(*static_cast<$struct.name$*>(data))) +
4u /*encapsulation*/;
#else
try
{
eprosima::fastcdr::CdrSizeCalculator calculator(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<$struct.name$*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return 0;
}
try
{
eprosima::fastcdr::CdrSizeCalculator calculator(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<$struct.name$*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return 0;
}
#endif // FASTCDR_VERSION_MAJOR == 1
};
}
Expand Down

0 comments on commit 3aa9e16

Please sign in to comment.