Skip to content

Commit

Permalink
Refs #21131: Linter
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Jun 18, 2024
1 parent 3fb8508 commit 94cea7a
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 47 deletions.
12 changes: 8 additions & 4 deletions test/blackbox/common/BlackboxTestsDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,8 @@ TEST(Discovery, RemoteBuiltinEndpointHonoring)

assert(hb_submsg.submsgHeader().submessageId() == HEARTBEAT);

if (eprosima::fastdds::rtps::c_EntityId_WriterLiveliness == *reinterpret_cast<EntityId_t*>(&hb_submsg.writerId()))
if (eprosima::fastdds::rtps::c_EntityId_WriterLiveliness ==
*reinterpret_cast<EntityId_t*>(&hb_submsg.writerId()))
{
num_wlp_reader_heartbeat++;
}
Expand All @@ -1991,7 +1992,8 @@ TEST(Discovery, RemoteBuiltinEndpointHonoring)

assert(acknack_submsg.submsgHeader().submessageId() == ACKNACK);

if (eprosima::fastdds::rtps::c_EntityId_WriterLiveliness == *reinterpret_cast<EntityId_t*>(&acknack_submsg.writerId()))
if (eprosima::fastdds::rtps::c_EntityId_WriterLiveliness ==
*reinterpret_cast<EntityId_t*>(&acknack_submsg.writerId()))
{
num_wlp_reader_acknack++;
}
Expand All @@ -2013,7 +2015,8 @@ TEST(Discovery, RemoteBuiltinEndpointHonoring)

assert(hb_submsg.submsgHeader().submessageId() == HEARTBEAT);

if (eprosima::fastdds::rtps::c_EntityId_WriterLiveliness == *reinterpret_cast<EntityId_t*>(&hb_submsg.writerId()))
if (eprosima::fastdds::rtps::c_EntityId_WriterLiveliness ==
*reinterpret_cast<EntityId_t*>(&hb_submsg.writerId()))
{
num_wlp_writer_heartbeat++;
}
Expand All @@ -2030,7 +2033,8 @@ TEST(Discovery, RemoteBuiltinEndpointHonoring)

assert(acknack_submsg.submsgHeader().submessageId() == ACKNACK);

if (eprosima::fastdds::rtps::c_EntityId_WriterLiveliness == *reinterpret_cast<EntityId_t*>(&acknack_submsg.writerId()))
if (eprosima::fastdds::rtps::c_EntityId_WriterLiveliness ==
*reinterpret_cast<EntityId_t*>(&acknack_submsg.writerId()))
{
num_wlp_writer_acknack++;
}
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox/common/BlackboxTestsSecurity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ TEST(Security, BuiltinAuthenticationPlugin_second_participant_creation_loop)
// Read writer entity id
eprosima::fastdds::rtps::GUID_t writer_guid;
writer_guid.entityId = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos = old_pos;

if (writer_guid.entityId == eprosima::fastdds::rtps::participant_stateless_message_writer_entity_id)
Expand Down
8 changes: 4 additions & 4 deletions test/blackbox/common/DDSBlackboxTestsDataReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,16 @@ TEST(DDSDataReader, GetFirstUntakenInfoReturnsTheFirstValidChange)
msg.pos += 2; // flags
msg.pos += 2; // octets to inline quos
readerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
writerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.high = (int32_t)eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.low = eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);

// restore buffer pos
msg.pos = old_pos;
Expand Down
40 changes: 20 additions & 20 deletions test/blackbox/common/DDSBlackboxTestsListeners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,16 +703,16 @@ void sample_lost_test_dw_init(
msg.pos += 2; // flags
msg.pos += 2; // octets to inline quos
readerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
writerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.high = (int32_t)eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.low = eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);

// restore buffer pos
msg.pos = old_pos;
Expand Down Expand Up @@ -746,20 +746,20 @@ void sample_lost_test_dw_init(
msg.pos += 2; // flags
msg.pos += 2; // octets to inline quos
readerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
writerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.high = (int32_t)eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.low = eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;

first_fragment = eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);

// restore buffer pos
msg.pos = old_pos;
Expand Down Expand Up @@ -1729,16 +1729,16 @@ void sample_rejected_test_dw_init(
msg.pos += 2; // flags
msg.pos += 2; // octets to inline quos
readerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
writerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.high = (int32_t)eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.low = eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);

// restore buffer pos
msg.pos = old_pos;
Expand Down Expand Up @@ -2930,16 +2930,16 @@ TEST(DDSStatus, sample_rejected_waitset)
msg.pos += 2; // flags
msg.pos += 2; // octets to inline quos
readerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
writerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.high = (int32_t)eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.low = eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);

// restore buffer pos
msg.pos = old_pos;
Expand Down Expand Up @@ -3125,13 +3125,13 @@ void reliable_on_unack_test_init(
msg.pos += 2; // inline QoS
msg.pos += 4; // readerID
writerID = eprosima::fastdds::helpers::cdr_parse_entity_id(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.high = (int32_t)eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);
msg.pos += 4;
sn.low = eprosima::fastdds::helpers::cdr_parse_u32(
(char*)&msg.buffer[msg.pos]);
(char*)&msg.buffer[msg.pos]);

// restore buffer pos
msg.pos = old_pos;
Expand Down
34 changes: 17 additions & 17 deletions test/blackbox/utils/filter_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,63 +25,63 @@ namespace fastdds {
namespace helpers {

inline rtps::core::HeartBeatSubmessage cdr_parse_heartbeat_submsg(
char* serialized_buffer,
size_t length)
char* serialized_buffer,
size_t length)
{
eprosima::fastdds::rtps::core::HeartBeatSubmessage hb_submsg;
eprosima::fastcdr::FastBuffer buffer(serialized_buffer, length);
eprosima::fastcdr::Cdr cdr(buffer,
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
cdr >> hb_submsg;
return hb_submsg;
}

inline rtps::core::AckNackSubmessage cdr_parse_acknack_submsg(
char* serialized_buffer,
size_t length)
char* serialized_buffer,
size_t length)
{
eprosima::fastdds::rtps::core::AckNackSubmessage acknack_submsg;
eprosima::fastcdr::FastBuffer buffer(serialized_buffer, length);
eprosima::fastcdr::Cdr cdr(buffer,
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
cdr >> acknack_submsg;
return acknack_submsg;
}

inline uint16_t cdr_parse_u16(
char* serialized_buffer)
char* serialized_buffer)
{
uint16_t u16;
eprosima::fastcdr::FastBuffer buffer(serialized_buffer, 2);
eprosima::fastcdr::Cdr cdr(buffer,
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
cdr >> u16;
return u16;
}

inline uint32_t cdr_parse_u32(
char* serialized_buffer)
char* serialized_buffer)
{
uint32_t u32;
eprosima::fastcdr::FastBuffer buffer(serialized_buffer, 4);
eprosima::fastcdr::Cdr cdr(buffer,
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
cdr >> u32;
return u32;
}

inline fastdds::rtps::EntityId_t cdr_parse_entity_id(
char* serialized_buffer)
char* serialized_buffer)
{
fastdds::rtps::EntityId_t entity_id;
eprosima::fastcdr::FastBuffer buffer(serialized_buffer, 4);
eprosima::fastcdr::Cdr cdr(buffer,
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::XCDRv1);
std::array<eprosima::fastdds::rtps::octet, 4> array;
cdr >> array;
memcpy(entity_id.value, array.data(), 4);
Expand Down
3 changes: 2 additions & 1 deletion test/unittest/statistics/rtps/RTPSStatisticsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,8 @@ TEST_F(RTPSStatisticsTests, statistics_rpts_unordered_datagrams)
// Send messages in different order
for (size_t idx : message_order)
{
const std::vector<octet>& msg = test_transport_descriptor_->test_transport_options->test_UDPv4Transport_DropLog[idx];
const std::vector<octet>& msg =
test_transport_descriptor_->test_transport_options->test_UDPv4Transport_DropLog[idx];
EXPECT_EQ(msg.size(), sender.send_to(asio::buffer(msg.data(), msg.size()), destination, 0, ec)) << ec;
}

Expand Down

0 comments on commit 94cea7a

Please sign in to comment.