Skip to content

Commit 2aee6cd

Browse files
authored
Merge pull request #578 from Teebonne/patch-1
Disambiguation from other max functions
2 parents d67b635 + dc151e2 commit 2aee6cd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

zmq_addon.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ inline bool is_little_endian()
7777
inline void write_network_order(unsigned char *buf, const uint32_t value)
7878
{
7979
if (is_little_endian()) {
80-
ZMQ_CONSTEXPR_VAR uint32_t mask = std::numeric_limits<std::uint8_t>::max();
80+
ZMQ_CONSTEXPR_VAR uint32_t mask = (std::numeric_limits<std::uint8_t>::max)();
8181
*buf++ = static_cast<unsigned char>((value >> 24) & mask);
8282
*buf++ = static_cast<unsigned char>((value >> 16) & mask);
8383
*buf++ = static_cast<unsigned char>((value >> 8) & mask);
@@ -224,12 +224,12 @@ message_t encode(const Range &parts)
224224
// First pass check sizes
225225
for (const auto &part : parts) {
226226
const size_t part_size = part.size();
227-
if (part_size > std::numeric_limits<std::uint32_t>::max()) {
227+
if (part_size > (std::numeric_limits<std::uint32_t>::max)()) {
228228
// Size value must fit into uint32_t.
229229
throw std::range_error("Invalid size, message part too large");
230230
}
231231
const size_t count_size =
232-
part_size < std::numeric_limits<std::uint8_t>::max() ? 1 : 5;
232+
part_size < (std::numeric_limits<std::uint8_t>::max)() ? 1 : 5;
233233
mmsg_size += part_size + count_size;
234234
}
235235

@@ -240,12 +240,12 @@ message_t encode(const Range &parts)
240240
const unsigned char *part_data =
241241
static_cast<const unsigned char *>(part.data());
242242

243-
if (part_size < std::numeric_limits<std::uint8_t>::max()) {
243+
if (part_size < (std::numeric_limits<std::uint8_t>::max)()) {
244244
// small part
245245
*buf++ = (unsigned char) part_size;
246246
} else {
247247
// big part
248-
*buf++ = std::numeric_limits<uint8_t>::max();
248+
*buf++ = (std::numeric_limits<uint8_t>::max)();
249249
detail::write_network_order(buf, part_size);
250250
buf += sizeof(part_size);
251251
}
@@ -279,7 +279,7 @@ template<class OutputIt> OutputIt decode(const message_t &encoded, OutputIt out)
279279

280280
while (source < limit) {
281281
size_t part_size = *source++;
282-
if (part_size == std::numeric_limits<std::uint8_t>::max()) {
282+
if (part_size == (std::numeric_limits<std::uint8_t>::max)()) {
283283
if (static_cast<size_t>(limit - source) < sizeof(uint32_t)) {
284284
throw std::out_of_range(
285285
"Malformed encoding, overflow in reading size");

0 commit comments

Comments
 (0)