Skip to content

Commit

Permalink
Fix max clash with Windows CI (#4248) (#4253)
Browse files Browse the repository at this point in the history
* Refs #20255: Fix max clash with Windows CI

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20255: Fix OpenSSL version to 3.1.1 in Windows CI

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20255: Uncrustify

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 9b31bc2)

Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
  • Loading branch information
mergify[bot] and EduPonz authored Jan 22, 2024
1 parent 340077d commit 432d620
Show file tree
Hide file tree
Showing 21 changed files with 43 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/reusable-windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ jobs:
- name: Install OpenSSL
uses: eProsima/eprosima-CI/windows/install_openssl@v0
with:
version: '3.1.1'

- name: Update OpenSSL environment variables
run: |
Expand Down
2 changes: 1 addition & 1 deletion include/fastdds/rtps/messages/CDRMessage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ inline SequenceNumberSet_t CDRMessage::readSequenceNumberSet(
valid &= (seqNum.high >= 0);
if (valid && std::numeric_limits<int32_t>::max() == seqNum.high)
{
numBits = (std::min)(numBits, std::numeric_limits<uint32_t>::max() - seqNum.low);
numBits = (std::min)(numBits, (std::numeric_limits<uint32_t>::max)() - seqNum.low);
}

uint32_t n_longs = (numBits + 31u) / 32u;
Expand Down
2 changes: 1 addition & 1 deletion include/fastdds/rtps/security/logging/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class Logging
LogOptions log_options_;
GUID_t guid_;
std::string guid_str_;
uint32_t domain_id_ = std::numeric_limits<uint32_t>::max();
uint32_t domain_id_ = (std::numeric_limits<uint32_t>::max)();
std::string domain_id_str_;
};

Expand Down
4 changes: 2 additions & 2 deletions include/fastrtps/utils/fixed_size_bitmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class BitmapRange
const T& from,
const T& to)
{
constexpr uint32_t full_mask = std::numeric_limits<uint32_t>::max();
constexpr uint32_t full_mask = (std::numeric_limits<uint32_t>::max)();

// Adapt incoming range to range limits
T min = (base_ >= from) ? base_ : from;
Expand Down Expand Up @@ -431,7 +431,7 @@ class BitmapRange
short shift = num_bits & 31u;
if (0 < num_bits && shift != 0)
{
bitmap_[num_items - 1] &= ~(std::numeric_limits<uint32_t>::max() >> shift);
bitmap_[num_items - 1] &= ~((std::numeric_limits<uint32_t>::max)() >> shift);
}
calc_maximum_bit_set(num_items, 0);
}
Expand Down
8 changes: 4 additions & 4 deletions src/cpp/fastdds/subscriber/history/DataReaderInstance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct DataReaderInstance
//! The list of alive writers for this instance
WriterCollection alive_writers;
//! GUID and strength of the current maximum strength writer
WriterOwnership current_owner{ {}, std::numeric_limits<uint32_t>::max() };
WriterOwnership current_owner{ {}, (std::numeric_limits<uint32_t>::max)() };
//! The time when the group will miss the deadline
std::chrono::steady_clock::time_point next_deadline_us;
//! Current view state of the instance
Expand Down Expand Up @@ -195,10 +195,10 @@ struct DataReaderInstance
current_owner.first = writer_guid;
ret_val = true;
}
else if (std::numeric_limits<uint32_t>::max() == ownership_strength) // uint32_t::max indicates we are in SHARED_OWNERSHIP_QOS.
else if ((std::numeric_limits<uint32_t>::max)() == ownership_strength) // uint32_t::max indicates we are in SHARED_OWNERSHIP_QOS.
{
assert(eprosima::fastrtps::rtps::c_Guid_Unknown == current_owner.first);
assert(std::numeric_limits<uint32_t>::max() == current_owner.second);
assert((std::numeric_limits<uint32_t>::max)() == current_owner.second);
ret_val = true;
}
else if (eprosima::fastrtps::rtps::c_Guid_Unknown == current_owner.first) // Without owner.
Expand Down Expand Up @@ -247,7 +247,7 @@ struct DataReaderInstance
writer_guid < current_owner.first)
)
{
if (std::numeric_limits<uint32_t>::max() != ownership_strength) // Not SHARED_OWNERSHIP_QOS
if ((std::numeric_limits<uint32_t>::max)() != ownership_strength) // Not SHARED_OWNERSHIP_QOS
{
current_owner.first = writer_guid;
current_owner.second = ownership_strength;
Expand Down
3 changes: 2 additions & 1 deletion src/cpp/rtps/DataSharing/WriterPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ class WriterPool : public DataSharingPayloadPool
{
EPROSIMA_LOG_ERROR(DATASHARING_PAYLOADPOOL, "Failed to create segment " << segment_name_
<< ": Segment size is too large: " << estimated_size_for_payloads_pool
<< " (max is " << std::numeric_limits<uint32_t>::max() << ")."
<< " (max is " <<
(std::numeric_limits<uint32_t>::max)() << ")."
<< " Please reduce the maximum size of the history");
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/liveliness/WLP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static void set_builtin_reader_history_attributes(
const ResourceLimitedContainerConfig& allocation,
bool is_secure)
{
constexpr uint32_t c_upper_limit = std::numeric_limits<uint32_t>::max() / 2u;
constexpr uint32_t c_upper_limit = (std::numeric_limits<uint32_t>::max)() / 2u;

hatt.payloadMaxSize = is_secure ? 128 : 28;

Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/flowcontrol/FlowControllerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ class FlowControllerImpl : public FlowController
{
uint32_t limitation = get_max_payload();

if (std::numeric_limits<uint32_t>::max() != limitation)
if ((std::numeric_limits<uint32_t>::max)() != limitation)
{
sched.set_bandwith_limitation(limitation);
}
Expand Down Expand Up @@ -1457,7 +1457,7 @@ class FlowControllerImpl : public FlowController
typename std::enable_if<!std::is_base_of<FlowControllerLimitedAsyncPublishMode, PubMode>::value, uint32_t>::type
constexpr get_max_payload_impl() const
{
return std::numeric_limits<uint32_t>::max();
return (std::numeric_limits<uint32_t>::max)();
}

fastrtps::TimedMutex mutex_;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/history/CacheChangePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void CacheChangePool::init(
}
else
{
max_pool_size_ = std::numeric_limits<uint32_t>::max();
max_pool_size_ = (std::numeric_limits<uint32_t>::max)();
}

switch (memory_mode_)
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/history/TopicPayloadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void TopicPayloadPool::update_maximum_size(
{
if (config.maximum_size == 0)
{
max_pool_size_ = std::numeric_limits<uint32_t>::max();
max_pool_size_ = (std::numeric_limits<uint32_t>::max)();
++infinite_histories_count_;
}
else
Expand Down
6 changes: 3 additions & 3 deletions src/cpp/rtps/network/NetworkFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ using SendResourceList = fastdds::rtps::SendResourceList;

NetworkFactory::NetworkFactory(
const RTPSParticipantAttributes& PParam)
: maxMessageSizeBetweenTransports_(std::numeric_limits<uint32_t>::max())
, minSendBufferSize_(std::numeric_limits<uint32_t>::max())
: maxMessageSizeBetweenTransports_((std::numeric_limits<uint32_t>::max)())
, minSendBufferSize_((std::numeric_limits<uint32_t>::max)())
, network_configuration_(0)
{
const std::string* enforce_metatraffic = nullptr;
Expand Down Expand Up @@ -121,7 +121,7 @@ bool NetworkFactory::RegisterTransport(
{
bool wasRegistered = false;

uint32_t minSendBufferSize = std::numeric_limits<uint32_t>::max();
uint32_t minSendBufferSize = (std::numeric_limits<uint32_t>::max)();

std::unique_ptr<TransportInterface> transport(descriptor->create_transport());

Expand Down
8 changes: 4 additions & 4 deletions src/cpp/rtps/participant/RTPSParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1695,9 +1695,9 @@ bool RTPSParticipantImpl::createReceiverResources(
// An auxilary buffer is needed in the ReceiverResource to to decrypt the message,
// that imposes a limit in the received messages size even if the transport allows (uint32_t) messages size.
uint32_t max_receiver_buffer_size =
is_secure() ? std::numeric_limits<uint16_t>::max() : std::numeric_limits<uint32_t>::max();
is_secure() ? std::numeric_limits<uint16_t>::max() : (std::numeric_limits<uint32_t>::max)();
#else
uint32_t max_receiver_buffer_size = std::numeric_limits<uint32_t>::max();
uint32_t max_receiver_buffer_size = (std::numeric_limits<uint32_t>::max)();
#endif // if HAVE_SECURITY

for (auto it_loc = Locator_list.begin(); it_loc != Locator_list.end(); ++it_loc)
Expand Down Expand Up @@ -2076,9 +2076,9 @@ uint32_t RTPSParticipantImpl::getMaxMessageSize() const
// that imposes a limit in the received messages size even if the transport allows (uint32_t) messages size.
// So the sender limits also its size.
uint32_t max_receiver_buffer_size =
is_secure() ? std::numeric_limits<uint16_t>::max() : std::numeric_limits<uint32_t>::max();
is_secure() ? std::numeric_limits<uint16_t>::max() : (std::numeric_limits<uint32_t>::max)();
#else
uint32_t max_receiver_buffer_size = std::numeric_limits<uint32_t>::max();
uint32_t max_receiver_buffer_size = (std::numeric_limits<uint32_t>::max)();
#endif // if HAVE_SECURITY

return (std::min)(
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/reader/StatefulReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ bool StatefulReader::processDataMsg(
EPROSIMA_LOG_WARNING(RTPS_MSG_IN, IDSTRING "Problem copying CacheChange, received data is: "
<< change->serializedPayload.length << " bytes and max size in reader "
<< m_guid << " is "
<< (fixed_payload_size_ > 0 ? fixed_payload_size_ : std::numeric_limits<uint32_t>::max()));
<< (fixed_payload_size_ > 0 ? fixed_payload_size_ : (std::numeric_limits<uint32_t>::max)()));
change_pool_->release_cache(change_to_add);
return false;
}
Expand Down Expand Up @@ -1082,7 +1082,7 @@ bool StatefulReader::change_received(
}
else
{
a_change->reader_info.writer_ownership_strength = std::numeric_limits<uint32_t>::max();
a_change->reader_info.writer_ownership_strength = (std::numeric_limits<uint32_t>::max)();
}

// NOTE: Depending on QoS settings, one change can be removed from history
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/reader/StatelessReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ bool StatelessReader::change_received(
}
else
{
change->reader_info.writer_ownership_strength = std::numeric_limits<uint32_t>::max();
change->reader_info.writer_ownership_strength = (std::numeric_limits<uint32_t>::max)();
}

if (mp_history->received_change(change, 0))
Expand Down Expand Up @@ -562,7 +562,7 @@ bool StatelessReader::processDataMsg(
EPROSIMA_LOG_WARNING(RTPS_MSG_IN, IDSTRING "Problem copying CacheChange, received data is: "
<< change->serializedPayload.length << " bytes and max size in reader "
<< m_guid << " is "
<< (fixed_payload_size_ > 0 ? fixed_payload_size_ : std::numeric_limits<uint32_t>::max()));
<< (fixed_payload_size_ > 0 ? fixed_payload_size_ : (std::numeric_limits<uint32_t>::max)()));
change_pool_->release_cache(change_to_add);
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/security/logging/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ bool Logging::set_domain_id(
const uint32_t id,
SecurityException& exception)
{
if (std::numeric_limits<uint32_t>::max() == id)
if ((std::numeric_limits<uint32_t>::max)() == id)
{
exception = SecurityException("Invalid domaine id value.");
return false;
}
else if (std::numeric_limits<uint32_t>::max() != domain_id_)
else if ((std::numeric_limits<uint32_t>::max)() != domain_id_)
{
exception = SecurityException("Domaine id already set (" + std::to_string(domain_id_) + ")");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace rtps {
test_SharedMemTransportDescriptor::test_SharedMemTransportDescriptor()
: SharedMemTransportDescriptor()
{
big_buffer_size_ = std::numeric_limits<uint32_t>::max();
big_buffer_size_ = (std::numeric_limits<uint32_t>::max)();
big_buffer_size_send_count_ = nullptr;
big_buffer_size_recv_count_ = nullptr;
}
Expand Down
8 changes: 4 additions & 4 deletions src/cpp/security/cryptography/AESGCMGMAC_KeyFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ std::shared_ptr<ParticipantCryptoHandle> AESGCMGMAC_KeyFactory::register_matched

(*RPCrypto)->max_blocks_per_session = local_participant_handle->max_blocks_per_session;
(*RPCrypto)->Session.session_block_counter = local_participant_handle->max_blocks_per_session + 1;
(*RPCrypto)->Session.session_id = std::numeric_limits<uint32_t>::max();
(*RPCrypto)->Session.session_id = (std::numeric_limits<uint32_t>::max)();
if ((*RPCrypto)->Session.session_id == local_participant_handle->Session.session_id)
{
(*RPCrypto)->Session.session_id -= 1;
Expand Down Expand Up @@ -529,7 +529,7 @@ DatareaderCryptoHandle* AESGCMGMAC_KeyFactory::register_matched_remote_datareade

auto session = &(*RRCrypto)->Sessions[0];
session->session_block_counter = local_writer_handle->Sessions[0].session_block_counter;
session->session_id = std::numeric_limits<uint32_t>::max();
session->session_id = (std::numeric_limits<uint32_t>::max)();
if (session->session_id == local_writer_handle->Sessions[0].session_id)
{
session->session_id -= 1;
Expand All @@ -551,7 +551,7 @@ DatareaderCryptoHandle* AESGCMGMAC_KeyFactory::register_matched_remote_datareade

session++;
session->session_block_counter = local_writer_handle->Sessions[0].session_block_counter;
session->session_id = std::numeric_limits<uint32_t>::max();
session->session_id = (std::numeric_limits<uint32_t>::max)();
if (session->session_id == local_writer_handle->Sessions[0].session_id)
{
session->session_id -= 1;
Expand Down Expand Up @@ -732,7 +732,7 @@ DatawriterCryptoHandle* AESGCMGMAC_KeyFactory::register_matched_remote_datawrite
(*RWCrypto)->max_blocks_per_session = local_reader_handle->max_blocks_per_session;
auto session = &(*RWCrypto)->Sessions[0];
session->session_block_counter = local_reader_handle->Sessions[0].session_block_counter;
session->session_id = std::numeric_limits<uint32_t>::max();
session->session_id = (std::numeric_limits<uint32_t>::max)();
if (session->session_id == local_reader_handle->Sessions[0].session_id)
{
session->session_id -= 1;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/security/cryptography/AESGCMGMAC_Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ struct SecureDataTag

struct KeySessionData
{
uint32_t session_id = std::numeric_limits<uint32_t>::max();
uint32_t session_id = (std::numeric_limits<uint32_t>::max)();
std::array<uint8_t, 32> SessionKey = c_empty_key_material;
uint64_t session_block_counter = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/dds/topic/DDSSQLFilter/DDSSQLFilterTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ class DDSSQLFilterValueGlobalData
std::array<ContentFilterTestType, 5>& data)
{
constexpr uint32_t min = std::numeric_limits<uint32_t>::lowest();
constexpr uint32_t max = std::numeric_limits<uint32_t>::max();
constexpr uint32_t max = (std::numeric_limits<uint32_t>::max)();

std::array<uint32_t, 5> values{ min, max / 4, max / 3, max / 2, max };

Expand Down
6 changes: 3 additions & 3 deletions test/unittest/utils/BitmapRangeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ TEST_F(BitmapRangeTests, serialization)

num_bits = 20u;
num_longs = 1u;
bitmap.fill(std::numeric_limits<uint32_t>::max());
bitmap.fill((std::numeric_limits<uint32_t>::max)());
uut.bitmap_set(num_bits, bitmap.data());
uut.bitmap_get(num_bits, bitmap, num_longs);
EXPECT_EQ(num_bits, 20u);
Expand All @@ -474,14 +474,14 @@ TEST_F(BitmapRangeTests, serialization)
do
{
uint32_t test_bits = test_longs * sizeof(value_type) * 8;
bitmap.fill(std::numeric_limits<uint32_t>::max());
bitmap.fill((std::numeric_limits<uint32_t>::max)());
uut.bitmap_set(test_bits, bitmap.data());
uut.bitmap_get(num_bits, bitmap, num_longs);
EXPECT_EQ(num_bits, test_bits);
EXPECT_EQ(num_longs, test_longs);

// use a vector as result pattern
std::vector<value_type> pattern(test_longs, std::numeric_limits<uint32_t>::max());
std::vector<value_type> pattern(test_longs, (std::numeric_limits<uint32_t>::max)());
pattern.resize(bitmap.max_size(), 0);
EXPECT_TRUE(std::equal(bitmap.begin(), bitmap.end(), pattern.begin()));
}
Expand Down
6 changes: 3 additions & 3 deletions test/unittest/xmlparser/XMLProfileParserTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,9 +1729,9 @@ TEST_F(XMLProfileParserBasicTests, SHM_transport_descriptors_config)
transport);

ASSERT_NE(descriptor, nullptr);
ASSERT_EQ(descriptor->segment_size(), std::numeric_limits<uint32_t>::max());
ASSERT_EQ(descriptor->port_queue_capacity(), std::numeric_limits<uint32_t>::max());
ASSERT_EQ(descriptor->healthy_check_timeout_ms(), std::numeric_limits<uint32_t>::max());
ASSERT_EQ(descriptor->segment_size(), (std::numeric_limits<uint32_t>::max)());
ASSERT_EQ(descriptor->port_queue_capacity(), (std::numeric_limits<uint32_t>::max)());
ASSERT_EQ(descriptor->healthy_check_timeout_ms(), (std::numeric_limits<uint32_t>::max)());
ASSERT_EQ(descriptor->rtps_dump_file(), "test_file.dump");
ASSERT_EQ(descriptor->maxMessageSize, 128000u);
ASSERT_EQ(descriptor->max_message_size(), 128000u);
Expand Down

0 comments on commit 432d620

Please sign in to comment.