From 19234a4268faff614e1e473d582dc769d18f8730 Mon Sep 17 00:00:00 2001 From: elianalf <62831776+elianalf@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:59:10 +0200 Subject: [PATCH] Refs #21129: Uncrustify Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --- include/fastdds/rtps/common/BinaryProperty.h | 292 ++++++++++-------- .../fastdds/rtps/reader/ReaderDiscoveryInfo.h | 4 +- .../rtps/resources/ResourceManagement.h | 13 +- .../fastdds/rtps/writer/WriterDiscoveryInfo.h | 4 +- include/fastrtps/common/KeyedChanges.h | 7 +- src/cpp/rtps/common/Token.cpp | 80 +++-- src/cpp/rtps/messages/RTPSGapBuilder.cpp | 4 +- .../rtps/transport/tcp/RTCPMessageManager.cpp | 2 +- src/cpp/security/accesscontrol/CommonParser.h | 12 +- .../security/accesscontrol/GovernanceParser.h | 39 ++- .../accesscontrol/PermissionsParser.h | 48 ++- .../security/accesscontrol/PermissionsTypes.h | 8 +- .../cryptography/AESGCMGMAC_Types.cpp | 2 +- test/blackbox/api/dds-pim/PubSubWriter.hpp | 4 +- .../rtps/security/SecurityPluginFactory.cpp | 32 +- .../mutex_testing_tool/TMutexTests.cpp | 38 ++- test/unittest/rtps/writer/RTPSWriterTests.cpp | 3 +- 17 files changed, 361 insertions(+), 231 deletions(-) diff --git a/include/fastdds/rtps/common/BinaryProperty.h b/include/fastdds/rtps/common/BinaryProperty.h index 9223818d2be..21786c620c1 100644 --- a/include/fastdds/rtps/common/BinaryProperty.h +++ b/include/fastdds/rtps/common/BinaryProperty.h @@ -30,149 +30,189 @@ namespace rtps { class BinaryProperty { - public: - - BinaryProperty() : propagate_(false) {} - - BinaryProperty(const BinaryProperty& property) : - name_(property.name_), - value_(property.value_), - propagate_(property.propagate_) {} - - BinaryProperty(BinaryProperty&& property) : - name_(std::move(property.name_)), - value_(std::move(property.value_)), - propagate_(property.propagate_) {} - - BinaryProperty(const std::string& name, - const std::vector& value) : - name_(name), value_(value) {} - - BinaryProperty(std::string&& name, - std::vector&& value) : - name_(std::move(name)), value_(std::move(value)) {} - - BinaryProperty& operator=(const BinaryProperty& property) - { - name_ = property.name_; - value_ = property.value_; - propagate_ = property.propagate_; - return *this; - } - - BinaryProperty& operator=(BinaryProperty&& property) - { - name_ = std::move(property.name_); - value_ = std::move(property.value_); - propagate_ = property.propagate_; - return *this; - } - - bool operator==(const BinaryProperty& b) const - { - return (this->name_ == b.name_) && - (this->value_ == b.value_); - } - - void name(const std::string& name) - { - name_ = name; - } - - void name(std::string&& name) - { - name_ = std::move(name); - } - - const std::string& name() const - { - return name_; - } - - std::string& name() - { - return name_; - } - - void value(const std::vector& value) - { - value_ = value; - } - - void value(std::vector&& value) - { - value_ = std::move(value); - } - - const std::vector& value() const - { - return value_; - } - - std::vector& value() - { - return value_; - } - - void propagate(bool propagate) - { - propagate_ = propagate; - } - - bool propagate() const - { - return propagate_; - } - - bool& propagate() - { - return propagate_; - } - - private: - - std::string name_; - - std::vector value_; - - bool propagate_; +public: + + BinaryProperty() + : propagate_(false) + { + } + + BinaryProperty( + const BinaryProperty& property) + : name_(property.name_) + , value_(property.value_) + , propagate_(property.propagate_) + { + } + + BinaryProperty( + BinaryProperty&& property) + : name_(std::move(property.name_)) + , value_(std::move(property.value_)) + , propagate_(property.propagate_) + { + } + + BinaryProperty( + const std::string& name, + const std::vector& value) + : name_(name) + , value_(value) + { + } + + BinaryProperty( + std::string&& name, + std::vector&& value) + : name_(std::move(name)) + , value_(std::move(value)) + { + } + + BinaryProperty& operator =( + const BinaryProperty& property) + { + name_ = property.name_; + value_ = property.value_; + propagate_ = property.propagate_; + return *this; + } + + BinaryProperty& operator =( + BinaryProperty&& property) + { + name_ = std::move(property.name_); + value_ = std::move(property.value_); + propagate_ = property.propagate_; + return *this; + } + + bool operator ==( + const BinaryProperty& b) const + { + return (this->name_ == b.name_) && + (this->value_ == b.value_); + } + + void name( + const std::string& name) + { + name_ = name; + } + + void name( + std::string&& name) + { + name_ = std::move(name); + } + + const std::string& name() const + { + return name_; + } + + std::string& name() + { + return name_; + } + + void value( + const std::vector& value) + { + value_ = value; + } + + void value( + std::vector&& value) + { + value_ = std::move(value); + } + + const std::vector& value() const + { + return value_; + } + + std::vector& value() + { + return value_; + } + + void propagate( + bool propagate) + { + propagate_ = propagate; + } + + bool propagate() const + { + return propagate_; + } + + bool& propagate() + { + return propagate_; + } + +private: + + std::string name_; + + std::vector value_; + + bool propagate_; }; typedef std::vector BinaryPropertySeq; class BinaryPropertyHelper { - public: +public: - static size_t serialized_size(const BinaryProperty& binary_property, size_t current_alignment = 0) + static size_t serialized_size( + const BinaryProperty& binary_property, + size_t current_alignment = 0) + { + if (binary_property.propagate()) { - if(binary_property.propagate()) - { - size_t initial_alignment = current_alignment; + size_t initial_alignment = current_alignment; - current_alignment += 4 + alignment(current_alignment, 4) + binary_property.name().size() + 1; - current_alignment += 4 + alignment(current_alignment, 4) + binary_property.value().size(); + current_alignment += 4 + alignment(current_alignment, 4) + binary_property.name().size() + 1; + current_alignment += 4 + alignment(current_alignment, 4) + binary_property.value().size(); - return current_alignment - initial_alignment; - } - else - return 0; + return current_alignment - initial_alignment; } - - static size_t serialized_size(const BinaryPropertySeq& binary_properties, size_t current_alignment = 0) + else { - size_t initial_alignment = current_alignment; + return 0; + } + } - current_alignment += 4 + alignment(current_alignment, 4); - for(auto binary_property = binary_properties.begin(); binary_property != binary_properties.end(); ++binary_property) - current_alignment += serialized_size(*binary_property, current_alignment); + static size_t serialized_size( + const BinaryPropertySeq& binary_properties, + size_t current_alignment = 0) + { + size_t initial_alignment = current_alignment; - return current_alignment - initial_alignment; + current_alignment += 4 + alignment(current_alignment, 4); + for (auto binary_property = binary_properties.begin(); binary_property != binary_properties.end(); + ++binary_property) + { + current_alignment += serialized_size(*binary_property, current_alignment); } - private: + return current_alignment - initial_alignment; + } + +private: + + inline static size_t alignment( + size_t current_alignment, + size_t dataSize) + { + return (dataSize - (current_alignment % dataSize)) & (dataSize - 1); + } - inline static size_t alignment(size_t current_alignment, size_t dataSize) { return (dataSize - (current_alignment % dataSize)) & (dataSize-1);} }; } //namespace rtps diff --git a/include/fastdds/rtps/reader/ReaderDiscoveryInfo.h b/include/fastdds/rtps/reader/ReaderDiscoveryInfo.h index ec59d89177e..3305016a8e3 100644 --- a/include/fastdds/rtps/reader/ReaderDiscoveryInfo.h +++ b/include/fastdds/rtps/reader/ReaderDiscoveryInfo.h @@ -37,6 +37,8 @@ struct ReaderDiscoveryInfo //!Enum DISCOVERY_STATUS, four different status for discovered readers. //!@ingroup RTPS_MODULE + // *INDENT-OFF* : Does not understand the #if correctly and ends up removing the ; + // at the end of the enum, which does not build. #if defined(_WIN32) enum FASTDDS_EXPORTED_API DISCOVERY_STATUS #else @@ -48,7 +50,7 @@ struct ReaderDiscoveryInfo REMOVED_READER, IGNORED_READER }; - + // *INDENT-ON* ReaderDiscoveryInfo( const ReaderProxyData& data) : status(DISCOVERED_READER) diff --git a/include/fastdds/rtps/resources/ResourceManagement.h b/include/fastdds/rtps/resources/ResourceManagement.h index 0fa8e82081e..c21f5bc77b0 100644 --- a/include/fastdds/rtps/resources/ResourceManagement.h +++ b/include/fastdds/rtps/resources/ResourceManagement.h @@ -21,15 +21,16 @@ #define _FASTDDS_RTPS_RESOURCE_MANAGEMENT_H_ -namespace eprosima{ -namespace fastdds{ -namespace rtps{ +namespace eprosima { +namespace fastdds { +namespace rtps { /** * Enum MemoryuManagementPolicy_t, indicated the way memory is managed in terms of dealing with CacheChanges */ -typedef enum MemoryManagementPolicy{ +typedef enum MemoryManagementPolicy +{ PREALLOCATED_MEMORY_MODE, //!< Preallocated memory. Size set to the data type maximum. Largest memory footprint but smallest allocation count. PREALLOCATED_WITH_REALLOC_MEMORY_MODE, //!< Default size preallocated, requires reallocation when a bigger message arrives. Smaller memory footprint at the cost of an increased allocation count. DYNAMIC_RESERVE_MEMORY_MODE, //< Dynamic allocation at the time of message arrival. Least memory footprint but highest allocation count. @@ -38,7 +39,7 @@ typedef enum MemoryManagementPolicy{ } // end namespaces -} -} +} // namespace fastdds +} // namespace eprosima #endif /* _FASTDDS_RTPS_RESOURCE_MANAGEMENT_H_ */ diff --git a/include/fastdds/rtps/writer/WriterDiscoveryInfo.h b/include/fastdds/rtps/writer/WriterDiscoveryInfo.h index d1de54ecad8..66ac46dacb9 100644 --- a/include/fastdds/rtps/writer/WriterDiscoveryInfo.h +++ b/include/fastdds/rtps/writer/WriterDiscoveryInfo.h @@ -35,6 +35,8 @@ struct WriterDiscoveryInfo //!Enum DISCOVERY_STATUS, four different status for discovered writers. //!@ingroup RTPS_MODULE + // *INDENT-OFF* : Does not understand the #if correctly and ends up removing the ; + // at the end of the enum, which does not build. #if defined(_WIN32) enum FASTDDS_EXPORTED_API DISCOVERY_STATUS #else @@ -46,7 +48,7 @@ struct WriterDiscoveryInfo REMOVED_WRITER, IGNORED_WRITER }; - + // *INDENT-ON* WriterDiscoveryInfo( const WriterProxyData& data) : status(DISCOVERED_WRITER) diff --git a/include/fastrtps/common/KeyedChanges.h b/include/fastrtps/common/KeyedChanges.h index 1a9b094cb25..1af425acb84 100644 --- a/include/fastrtps/common/KeyedChanges.h +++ b/include/fastrtps/common/KeyedChanges.h @@ -23,8 +23,8 @@ #include #include -namespace eprosima{ -namespace fastdds{ +namespace eprosima { +namespace fastdds { /** * @brief A struct storing a vector of cache changes and the next deadline in the group @@ -40,7 +40,8 @@ struct KeyedChanges } //! Copy constructor - KeyedChanges(const KeyedChanges& other) + KeyedChanges( + const KeyedChanges& other) : cache_changes(other.cache_changes) , next_deadline_us(other.next_deadline_us) { diff --git a/src/cpp/rtps/common/Token.cpp b/src/cpp/rtps/common/Token.cpp index c32f4f787ab..e6f22cce8c3 100644 --- a/src/cpp/rtps/common/Token.cpp +++ b/src/cpp/rtps/common/Token.cpp @@ -20,13 +20,15 @@ using namespace eprosima::fastdds::rtps; -std::string* DataHolderHelper::find_property_value(DataHolder& data_holder, const std::string& name) +std::string* DataHolderHelper::find_property_value( + DataHolder& data_holder, + const std::string& name) { std::string* returnedValue = nullptr; - for(auto property = data_holder.properties().begin(); property != data_holder.properties().end(); ++property) + for (auto property = data_holder.properties().begin(); property != data_holder.properties().end(); ++property) { - if(property->name().compare(name) == 0) + if (property->name().compare(name) == 0) { returnedValue = &property->value(); break; @@ -36,13 +38,15 @@ std::string* DataHolderHelper::find_property_value(DataHolder& data_holder, cons return returnedValue; } -const std::string* DataHolderHelper::find_property_value(const DataHolder& data_holder, const std::string& name) +const std::string* DataHolderHelper::find_property_value( + const DataHolder& data_holder, + const std::string& name) { const std::string* returnedValue = nullptr; - for(auto property = data_holder.properties().begin(); property != data_holder.properties().end(); ++property) + for (auto property = data_holder.properties().begin(); property != data_holder.properties().end(); ++property) { - if(property->name().compare(name) == 0) + if (property->name().compare(name) == 0) { returnedValue = &property->value(); break; @@ -52,13 +56,15 @@ const std::string* DataHolderHelper::find_property_value(const DataHolder& data_ return returnedValue; } -Property* DataHolderHelper::find_property(DataHolder& data_holder, const std::string& name) +Property* DataHolderHelper::find_property( + DataHolder& data_holder, + const std::string& name) { Property* returnedValue = nullptr; - for(auto property = data_holder.properties().begin(); property != data_holder.properties().end(); ++property) + for (auto property = data_holder.properties().begin(); property != data_holder.properties().end(); ++property) { - if(property->name().compare(name) == 0) + if (property->name().compare(name) == 0) { returnedValue = &(*property); break; @@ -68,13 +74,15 @@ Property* DataHolderHelper::find_property(DataHolder& data_holder, const std::st return returnedValue; } -const Property* DataHolderHelper::find_property(const DataHolder& data_holder, const std::string& name) +const Property* DataHolderHelper::find_property( + const DataHolder& data_holder, + const std::string& name) { const Property* returnedValue = nullptr; - for(auto property = data_holder.properties().begin(); property != data_holder.properties().end(); ++property) + for (auto property = data_holder.properties().begin(); property != data_holder.properties().end(); ++property) { - if(property->name().compare(name) == 0) + if (property->name().compare(name) == 0) { returnedValue = &(*property); break; @@ -84,13 +92,16 @@ const Property* DataHolderHelper::find_property(const DataHolder& data_holder, c return returnedValue; } -std::vector* DataHolderHelper::find_binary_property_value(DataHolder& data_holder, const std::string& name) +std::vector* DataHolderHelper::find_binary_property_value( + DataHolder& data_holder, + const std::string& name) { std::vector* returnedValue = nullptr; - for(auto property = data_holder.binary_properties().begin(); property != data_holder.binary_properties().end(); ++property) + for (auto property = data_holder.binary_properties().begin(); property != data_holder.binary_properties().end(); + ++property) { - if(property->name().compare(name) == 0) + if (property->name().compare(name) == 0) { returnedValue = &property->value(); break; @@ -100,13 +111,16 @@ std::vector* DataHolderHelper::find_binary_property_value(DataHolder& d return returnedValue; } -const std::vector* DataHolderHelper::find_binary_property_value(const DataHolder& data_holder, const std::string& name) +const std::vector* DataHolderHelper::find_binary_property_value( + const DataHolder& data_holder, + const std::string& name) { const std::vector* returnedValue = nullptr; - for(auto property = data_holder.binary_properties().begin(); property != data_holder.binary_properties().end(); ++property) + for (auto property = data_holder.binary_properties().begin(); property != data_holder.binary_properties().end(); + ++property) { - if(property->name().compare(name) == 0) + if (property->name().compare(name) == 0) { returnedValue = &property->value(); break; @@ -116,13 +130,16 @@ const std::vector* DataHolderHelper::find_binary_property_value(const D return returnedValue; } -BinaryProperty* DataHolderHelper::find_binary_property(DataHolder& data_holder, const std::string& name) +BinaryProperty* DataHolderHelper::find_binary_property( + DataHolder& data_holder, + const std::string& name) { BinaryProperty* returnedValue = nullptr; - for(auto property = data_holder.binary_properties().begin(); property != data_holder.binary_properties().end(); ++property) + for (auto property = data_holder.binary_properties().begin(); property != data_holder.binary_properties().end(); + ++property) { - if(property->name().compare(name) == 0) + if (property->name().compare(name) == 0) { returnedValue = &(*property); break; @@ -132,13 +149,16 @@ BinaryProperty* DataHolderHelper::find_binary_property(DataHolder& data_holder, return returnedValue; } -const BinaryProperty* DataHolderHelper::find_binary_property(const DataHolder& data_holder, const std::string& name) +const BinaryProperty* DataHolderHelper::find_binary_property( + const DataHolder& data_holder, + const std::string& name) { const BinaryProperty* returnedValue = nullptr; - for(auto property = data_holder.binary_properties().begin(); property != data_holder.binary_properties().end(); ++property) + for (auto property = data_holder.binary_properties().begin(); property != data_holder.binary_properties().end(); + ++property) { - if(property->name().compare(name) == 0) + if (property->name().compare(name) == 0) { returnedValue = &(*property); break; @@ -148,7 +168,9 @@ const BinaryProperty* DataHolderHelper::find_binary_property(const DataHolder& d return returnedValue; } -size_t DataHolderHelper::serialized_size(const DataHolder& data_holder, size_t current_alignment) +size_t DataHolderHelper::serialized_size( + const DataHolder& data_holder, + size_t current_alignment) { size_t initial_alignment = current_alignment; @@ -159,13 +181,17 @@ size_t DataHolderHelper::serialized_size(const DataHolder& data_holder, size_t c return current_alignment - initial_alignment; } -size_t DataHolderHelper::serialized_size(const DataHolderSeq& data_holders, size_t current_alignment) +size_t DataHolderHelper::serialized_size( + const DataHolderSeq& data_holders, + size_t current_alignment) { size_t initial_alignment = current_alignment; current_alignment += 4 + alignment(current_alignment, 4); - for(auto data_holder = data_holders.begin(); data_holder != data_holders.end(); ++data_holder) + for (auto data_holder = data_holders.begin(); data_holder != data_holders.end(); ++data_holder) + { current_alignment += serialized_size(*data_holder, current_alignment); + } return current_alignment - initial_alignment; } diff --git a/src/cpp/rtps/messages/RTPSGapBuilder.cpp b/src/cpp/rtps/messages/RTPSGapBuilder.cpp index d37be586ce0..d614d256cf9 100644 --- a/src/cpp/rtps/messages/RTPSGapBuilder.cpp +++ b/src/cpp/rtps/messages/RTPSGapBuilder.cpp @@ -69,8 +69,8 @@ bool RTPSGapBuilder::flush() if (is_gap_pending_) { bool ok = with_specific_destination_ ? - group_.add_gap(initial_sequence_, gap_bitmap_, reader_guid_) : - group_.add_gap(initial_sequence_, gap_bitmap_); + group_.add_gap(initial_sequence_, gap_bitmap_, reader_guid_) : + group_.add_gap(initial_sequence_, gap_bitmap_); if (!ok) { return false; diff --git a/src/cpp/rtps/transport/tcp/RTCPMessageManager.cpp b/src/cpp/rtps/transport/tcp/RTCPMessageManager.cpp index a984a194537..35566afd799 100644 --- a/src/cpp/rtps/transport/tcp/RTCPMessageManager.cpp +++ b/src/cpp/rtps/transport/tcp/RTCPMessageManager.cpp @@ -38,7 +38,7 @@ namespace eprosima { namespace fastdds { namespace rtps { - + using Log = fastdds::dds::Log; static void endpoint_to_locator( diff --git a/src/cpp/security/accesscontrol/CommonParser.h b/src/cpp/security/accesscontrol/CommonParser.h index 18605d2ac90..c7e69463879 100644 --- a/src/cpp/security/accesscontrol/CommonParser.h +++ b/src/cpp/security/accesscontrol/CommonParser.h @@ -24,11 +24,13 @@ namespace fastdds { namespace rtps { namespace security { -bool parse_domain_id_set(tinyxml2::XMLElement* root, Domains& domains); +bool parse_domain_id_set( + tinyxml2::XMLElement* root, + Domains& domains); -} -} -} -} +} // namespace security +} // namespace rtps +} // namespace fastdds +} // namespace eprosima #endif // __SECURITY_ACCESSCONTROL_COMMON_H__ diff --git a/src/cpp/security/accesscontrol/GovernanceParser.h b/src/cpp/security/accesscontrol/GovernanceParser.h index 0c1d7563982..51888449c69 100644 --- a/src/cpp/security/accesscontrol/GovernanceParser.h +++ b/src/cpp/security/accesscontrol/GovernanceParser.h @@ -62,30 +62,41 @@ struct DomainAccessRules class GovernanceParser { - public: +public: - bool parse_stream(const char* stream, size_t stream_length); + bool parse_stream( + const char* stream, + size_t stream_length); - void swap(DomainAccessRules& rules); + void swap( + DomainAccessRules& rules); - private: +private: - bool parse_domain_access_rules_node(tinyxml2::XMLElement* root); + bool parse_domain_access_rules_node( + tinyxml2::XMLElement* root); - bool parse_domain_access_rules(tinyxml2::XMLElement* root); + bool parse_domain_access_rules( + tinyxml2::XMLElement* root); - bool parse_domain_rule(tinyxml2::XMLElement* root, DomainRule& rule); + bool parse_domain_rule( + tinyxml2::XMLElement* root, + DomainRule& rule); - bool parse_topic_access_rules(tinyxml2::XMLElement* root, std::vector& rules); + bool parse_topic_access_rules( + tinyxml2::XMLElement* root, + std::vector& rules); - bool parse_topic_rule(tinyxml2::XMLElement* root, TopicRule& rule); + bool parse_topic_rule( + tinyxml2::XMLElement* root, + TopicRule& rule); - DomainAccessRules access_rules_; + DomainAccessRules access_rules_; }; -} -} -} -} +} // namespace security +} // namespace rtps +} // namespace fastdds +} // namespace eprosima #endif // __SECURITY_ACCESSCONTROL_GOVERNANCEPARSER_H__ diff --git a/src/cpp/security/accesscontrol/PermissionsParser.h b/src/cpp/security/accesscontrol/PermissionsParser.h index 7159a180d5a..0d977e7a83a 100644 --- a/src/cpp/security/accesscontrol/PermissionsParser.h +++ b/src/cpp/security/accesscontrol/PermissionsParser.h @@ -31,34 +31,50 @@ struct PermissionsData class PermissionsParser { - public: +public: - bool parse_stream(const char* stream, size_t stream_length); + bool parse_stream( + const char* stream, + size_t stream_length); - void swap(PermissionsData& permissions); + void swap( + PermissionsData& permissions); - private: +private: - bool parse_permissions(tinyxml2::XMLElement* root); + bool parse_permissions( + tinyxml2::XMLElement* root); - bool parse_grant(tinyxml2::XMLElement* root, Grant& grant); + bool parse_grant( + tinyxml2::XMLElement* root, + Grant& grant); - bool parse_validity(tinyxml2::XMLElement* root, Validity& validity); + bool parse_validity( + tinyxml2::XMLElement* root, + Validity& validity); - bool parse_rule(tinyxml2::XMLElement* root, Rule& rule); + bool parse_rule( + tinyxml2::XMLElement* root, + Rule& rule); - bool parse_criteria(tinyxml2::XMLElement* root, Criteria& criteria); + bool parse_criteria( + tinyxml2::XMLElement* root, + Criteria& criteria); - bool parse_topic(tinyxml2::XMLElement* root, std::vector& topics); + bool parse_topic( + tinyxml2::XMLElement* root, + std::vector& topics); - bool parse_partition(tinyxml2::XMLElement* root, std::vector& partitions); + bool parse_partition( + tinyxml2::XMLElement* root, + std::vector& partitions); - PermissionsData permissions_; + PermissionsData permissions_; }; -} -} -} -} +} // namespace security +} // namespace rtps +} // namespace fastdds +} // namespace eprosima #endif // __SECURITY_ACCESSCONTROL_PERMISSIONSPARSER_H__ diff --git a/src/cpp/security/accesscontrol/PermissionsTypes.h b/src/cpp/security/accesscontrol/PermissionsTypes.h index be5902086d7..9743f2f4f24 100644 --- a/src/cpp/security/accesscontrol/PermissionsTypes.h +++ b/src/cpp/security/accesscontrol/PermissionsTypes.h @@ -63,9 +63,9 @@ struct Grant bool is_default_allow; }; -} -} -} -} +} // namespace security +} // namespace rtps +} // namespace fastdds +} // namespace eprosima #endif // __SECURITY_ACCESSCONTROL_PERMISSIONSTYPES_H__ diff --git a/src/cpp/security/cryptography/AESGCMGMAC_Types.cpp b/src/cpp/security/cryptography/AESGCMGMAC_Types.cpp index 30427d086b4..1744516d60c 100644 --- a/src/cpp/security/cryptography/AESGCMGMAC_Types.cpp +++ b/src/cpp/security/cryptography/AESGCMGMAC_Types.cpp @@ -23,4 +23,4 @@ using namespace eprosima::fastdds::rtps::security; const char* const ParticipantKeyHandle::class_id_ = "ParticipantCryptohandle"; -const char * const EntityKeyHandle::class_id_ = "EntityCryptohandle"; +const char* const EntityKeyHandle::class_id_ = "EntityCryptohandle"; diff --git a/test/blackbox/api/dds-pim/PubSubWriter.hpp b/test/blackbox/api/dds-pim/PubSubWriter.hpp index 46dfd7b8235..9aedebd508d 100644 --- a/test/blackbox/api/dds-pim/PubSubWriter.hpp +++ b/test/blackbox/api/dds-pim/PubSubWriter.hpp @@ -767,7 +767,7 @@ class PubSubWriter auto secs = std::chrono::duration_cast(nsecs); nsecs -= secs; eprosima::fastdds::Duration_t timeout {static_cast(secs.count()), - static_cast(nsecs.count())}; + static_cast(nsecs.count())}; return (eprosima::fastdds::dds::RETCODE_OK == datawriter_->wait_for_acknowledgments(timeout)); } @@ -784,7 +784,7 @@ class PubSubWriter auto secs = std::chrono::duration_cast(nsecs); nsecs -= secs; eprosima::fastdds::Duration_t timeout {static_cast(secs.count()), - static_cast(nsecs.count())}; + static_cast(nsecs.count())}; return (eprosima::fastdds::dds::RETCODE_OK == datawriter_->wait_for_acknowledgments(data, instance_handle, timeout)); } diff --git a/test/mock/rtps/SecurityPluginFactory/rtps/security/SecurityPluginFactory.cpp b/test/mock/rtps/SecurityPluginFactory/rtps/security/SecurityPluginFactory.cpp index 0e35d9b8a31..9ab1ff3fae6 100644 --- a/test/mock/rtps/SecurityPluginFactory/rtps/security/SecurityPluginFactory.cpp +++ b/test/mock/rtps/SecurityPluginFactory/rtps/security/SecurityPluginFactory.cpp @@ -29,84 +29,92 @@ Cryptography* SecurityPluginFactory::crypto_plugin_ = nullptr; Logging* SecurityPluginFactory::logging_plugin_ = nullptr; -Authentication* SecurityPluginFactory::create_authentication_plugin(const PropertyPolicy& /*property_policy*/) +Authentication* SecurityPluginFactory::create_authentication_plugin( + const PropertyPolicy& /*property_policy*/) { Authentication* ret = auth_plugin_; auth_plugin_ = nullptr; return ret; } -void SecurityPluginFactory::set_auth_plugin(Authentication* plugin) +void SecurityPluginFactory::set_auth_plugin( + Authentication* plugin) { auth_plugin_ = plugin; } void SecurityPluginFactory::release_auth_plugin() { - if(auth_plugin_ != nullptr) + if (auth_plugin_ != nullptr) { delete auth_plugin_; auth_plugin_ = nullptr; } } -AccessControl* SecurityPluginFactory::create_access_control_plugin(const PropertyPolicy& /*property_policy*/) +AccessControl* SecurityPluginFactory::create_access_control_plugin( + const PropertyPolicy& /*property_policy*/) { AccessControl* ret = access_plugin_; access_plugin_ = nullptr; return ret; } -void SecurityPluginFactory::set_access_control_plugin(AccessControl* plugin) +void SecurityPluginFactory::set_access_control_plugin( + AccessControl* plugin) { access_plugin_ = plugin; } void SecurityPluginFactory::release_access_control_plugin() { - if(access_plugin_ != nullptr) + if (access_plugin_ != nullptr) { delete access_plugin_; access_plugin_ = nullptr; } } -Cryptography* SecurityPluginFactory::create_cryptography_plugin(const PropertyPolicy& /*property_policy*/) +Cryptography* SecurityPluginFactory::create_cryptography_plugin( + const PropertyPolicy& /*property_policy*/) { Cryptography* ret = crypto_plugin_; crypto_plugin_ = nullptr; return ret; } -void SecurityPluginFactory::set_crypto_plugin(Cryptography* plugin) +void SecurityPluginFactory::set_crypto_plugin( + Cryptography* plugin) { crypto_plugin_ = plugin; } void SecurityPluginFactory::release_crypto_plugin() { - if(crypto_plugin_ != nullptr) + if (crypto_plugin_ != nullptr) { delete crypto_plugin_; crypto_plugin_ = nullptr; } } -Logging* SecurityPluginFactory::create_logging_plugin(const PropertyPolicy& /*property_policy*/) +Logging* SecurityPluginFactory::create_logging_plugin( + const PropertyPolicy& /*property_policy*/) { Logging* ret = logging_plugin_; logging_plugin_ = nullptr; return ret; } -void SecurityPluginFactory::set_logging_plugin(Logging* plugin) +void SecurityPluginFactory::set_logging_plugin( + Logging* plugin) { logging_plugin_ = plugin; } void SecurityPluginFactory::release_logging_plugin() { - if(logging_plugin_ != nullptr) + if (logging_plugin_ != nullptr) { delete logging_plugin_; logging_plugin_ = nullptr; diff --git a/test/realtime/mutex_testing_tool/TMutexTests.cpp b/test/realtime/mutex_testing_tool/TMutexTests.cpp index a0cbe0ba055..bedbf4108a6 100644 --- a/test/realtime/mutex_testing_tool/TMutexTests.cpp +++ b/test/realtime/mutex_testing_tool/TMutexTests.cpp @@ -91,10 +91,22 @@ TEST(TMutexTests, lock_mutexes) std::future future_2 = promise_2.get_future(); std::future future_3 = promise_3.get_future(); std::future future_4 = promise_4.get_future(); - std::thread([&]{ mutex_1.lock(); promise_1.set_value_at_thread_exit(0); }).detach(); - std::thread([&]{ mutex_2.lock(); promise_2.set_value_at_thread_exit(0); }).detach(); - std::thread([&]{ mutex_3.lock(); promise_3.set_value_at_thread_exit(0); }).detach(); - std::thread([&]{ mutex_4.lock(); promise_4.set_value_at_thread_exit(0); }).detach(); + std::thread([&] + { + mutex_1.lock(); promise_1.set_value_at_thread_exit(0); + }).detach(); + std::thread([&] + { + mutex_2.lock(); promise_2.set_value_at_thread_exit(0); + }).detach(); + std::thread([&] + { + mutex_3.lock(); promise_3.set_value_at_thread_exit(0); + }).detach(); + std::thread([&] + { + mutex_4.lock(); promise_4.set_value_at_thread_exit(0); + }).detach(); std::cout << "Waiting..." << std::endl; ASSERT_TRUE(future_1.wait_for(std::chrono::milliseconds(200)) == std::future_status::timeout); @@ -142,10 +154,16 @@ TEST(TMutexTests, lock_timed_mutexes) std::promise promise_2; std::future future_1 = promise_1.get_future(); std::future future_2 = promise_2.get_future(); - std::thread([&]{ mutex_1.try_lock_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(100)); - promise_1.set_value_at_thread_exit(0); }).detach(); - std::thread([&]{ mutex_2.try_lock_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(100)); - promise_2.set_value_at_thread_exit(0); }).detach(); + std::thread([&] + { + mutex_1.try_lock_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(100)); + promise_1.set_value_at_thread_exit(0); + }).detach(); + std::thread([&] + { + mutex_2.try_lock_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(100)); + promise_2.set_value_at_thread_exit(0); + }).detach(); std::cout << "Waiting..." << std::endl; future_1.wait(); @@ -157,7 +175,9 @@ TEST(TMutexTests, lock_timed_mutexes) } } -int main(int argc, char **argv) +int main( + int argc, + char** argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/test/unittest/rtps/writer/RTPSWriterTests.cpp b/test/unittest/rtps/writer/RTPSWriterTests.cpp index 5372874c75e..bcc100fcf25 100644 --- a/test/unittest/rtps/writer/RTPSWriterTests.cpp +++ b/test/unittest/rtps/writer/RTPSWriterTests.cpp @@ -92,7 +92,8 @@ class TestDataType { return TestDataType::data_size; } -#endif + +#endif // if FASTCDR_VERSION_MAJOR == 1 };