From dc151e2ba6a9417c6d97ef395cfb11132ae6935f Mon Sep 17 00:00:00 2001 From: Teebonne <80053070+Teebonne@users.noreply.github.com> Date: Mon, 10 Oct 2022 11:19:49 +0100 Subject: [PATCH] Disambiguation from other max functions Otherwise it creates an error on some environments --- zmq_addon.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zmq_addon.hpp b/zmq_addon.hpp index 147abe1..1cba08a 100644 --- a/zmq_addon.hpp +++ b/zmq_addon.hpp @@ -77,7 +77,7 @@ inline bool is_little_endian() inline void write_network_order(unsigned char *buf, const uint32_t value) { if (is_little_endian()) { - ZMQ_CONSTEXPR_VAR uint32_t mask = std::numeric_limits::max(); + ZMQ_CONSTEXPR_VAR uint32_t mask = (std::numeric_limits::max)(); *buf++ = static_cast((value >> 24) & mask); *buf++ = static_cast((value >> 16) & mask); *buf++ = static_cast((value >> 8) & mask); @@ -224,12 +224,12 @@ message_t encode(const Range &parts) // First pass check sizes for (const auto &part : parts) { const size_t part_size = part.size(); - if (part_size > std::numeric_limits::max()) { + if (part_size > (std::numeric_limits::max)()) { // Size value must fit into uint32_t. throw std::range_error("Invalid size, message part too large"); } const size_t count_size = - part_size < std::numeric_limits::max() ? 1 : 5; + part_size < (std::numeric_limits::max)() ? 1 : 5; mmsg_size += part_size + count_size; } @@ -240,12 +240,12 @@ message_t encode(const Range &parts) const unsigned char *part_data = static_cast(part.data()); - if (part_size < std::numeric_limits::max()) { + if (part_size < (std::numeric_limits::max)()) { // small part *buf++ = (unsigned char) part_size; } else { // big part - *buf++ = std::numeric_limits::max(); + *buf++ = (std::numeric_limits::max)(); detail::write_network_order(buf, part_size); buf += sizeof(part_size); } @@ -279,7 +279,7 @@ template OutputIt decode(const message_t &encoded, OutputIt out) while (source < limit) { size_t part_size = *source++; - if (part_size == std::numeric_limits::max()) { + if (part_size == (std::numeric_limits::max)()) { if (static_cast(limit - source) < sizeof(uint32_t)) { throw std::out_of_range( "Malformed encoding, overflow in reading size");