From 261c9a0742b15b0bd311b1ec4f05713e41536248 Mon Sep 17 00:00:00 2001 From: cferreiragonz Date: Tue, 12 Mar 2024 08:11:21 +0100 Subject: [PATCH] Refs #20352: Fix windows build Signed-off-by: cferreiragonz --- include/fastdds/rtps/network/NetworkBuffer.hpp | 9 ++++----- src/cpp/rtps/messages/RTPSMessageGroup.cpp | 9 ++++++--- src/cpp/rtps/transport/TCPChannelResource.h | 2 +- src/cpp/rtps/transport/test_UDPv4Transport.cpp | 1 + 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/fastdds/rtps/network/NetworkBuffer.hpp b/include/fastdds/rtps/network/NetworkBuffer.hpp index f9f49db3e65..6048ec75aab 100644 --- a/include/fastdds/rtps/network/NetworkBuffer.hpp +++ b/include/fastdds/rtps/network/NetworkBuffer.hpp @@ -19,8 +19,7 @@ #ifndef _FASTDDS_RTPS_NETWORK_NETWORKBUFFER_HPP #define _FASTDDS_RTPS_NETWORK_NETWORKBUFFER_HPP -#include // uint32_t -#include // size_t +#include #include namespace eprosima { @@ -36,11 +35,11 @@ struct NetworkBuffer final //! Pointer to the buffer where the data is stored. const void* buffer; //! Number of bytes to use starting at @c buffer. - size_t size; + uint32_t size; NetworkBuffer( const void* ptr, - size_t s) + uint32_t s) : buffer(ptr) , size(s) { @@ -54,7 +53,7 @@ struct NetworkBuffer final NetworkBuffer( const fastrtps::rtps::octet* ptr, - size_t s) + uint32_t s) : buffer(ptr) , size(s) { diff --git a/src/cpp/rtps/messages/RTPSMessageGroup.cpp b/src/cpp/rtps/messages/RTPSMessageGroup.cpp index 8565f64a5f5..558b93cc162 100644 --- a/src/cpp/rtps/messages/RTPSMessageGroup.cpp +++ b/src/cpp/rtps/messages/RTPSMessageGroup.cpp @@ -108,8 +108,8 @@ bool RTPSMessageGroup::append_submessage() // - If header_msg_ is not reseted, put submessage_msg_ into a new buffer and add it to buffers_to_send_ // Final msg Struct: | header_msg_ + submessage_msg_ | payload | padding | submessage_msg_ | payload | padding | ... // - - if (participant_->security_attributes().is_rtps_protected) +#if HAVE_SECURITY + if (protect_rtps = participant_->security_attributes().is_rtps_protected) { // If the RTPS message is protected, the whole message will be encrypted at once // so we need to keep the whole message in a single buffer @@ -118,8 +118,11 @@ bool RTPSMessageGroup::append_submessage() EPROSIMA_LOG_ERROR(RTPS_WRITER, "Cannot add RTPS submesage to the CDRMessage. Buffer too small"); return false; } + return true; } - else if (header_msg_->pos == RTPSMESSAGE_HEADER_SIZE && header_msg_->length == RTPSMESSAGE_HEADER_SIZE) +#endif // if HAVE_SECURITY + + if (header_msg_->pos == RTPSMESSAGE_HEADER_SIZE && header_msg_->length == RTPSMESSAGE_HEADER_SIZE) { // header_msg_ is reseted. This is the first submessage if (!append_message(participant_, header_msg_, submessage_msg_)) diff --git a/src/cpp/rtps/transport/TCPChannelResource.h b/src/cpp/rtps/transport/TCPChannelResource.h index 673fd4956e3..8473472fcea 100644 --- a/src/cpp/rtps/transport/TCPChannelResource.h +++ b/src/cpp/rtps/transport/TCPChannelResource.h @@ -152,7 +152,7 @@ class TCPChannelResource : public ChannelResource const fastrtps::rtps::octet* header, size_t header_size, const fastrtps::rtps::octet* data, - size_t data_size, + uint32_t data_size, asio::error_code& ec) { NetworkBuffer buffers(data, data_size); diff --git a/src/cpp/rtps/transport/test_UDPv4Transport.cpp b/src/cpp/rtps/transport/test_UDPv4Transport.cpp index 6df9b8aac86..bf032d24045 100644 --- a/src/cpp/rtps/transport/test_UDPv4Transport.cpp +++ b/src/cpp/rtps/transport/test_UDPv4Transport.cpp @@ -494,6 +494,7 @@ bool test_UDPv4Transport::log_drop( const std::list& buffers, uint32_t size) { + static_cast(size); if (test_UDPv4Transport_DropLog.size() < test_UDPv4Transport_DropLogLength) { vector message;