diff --git a/CHANGELOG.md b/CHANGELOG.md index 80c11224..ba8321b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 139: + +* Revisit boost library min/max guidance + +-------------------------------------------------------------------------------- + Version 138: * Tidy up some documentation diff --git a/include/boost/beast/core/flat_static_buffer.hpp b/include/boost/beast/core/flat_static_buffer.hpp index cfac9855..141ae552 100644 --- a/include/boost/beast/core/flat_static_buffer.hpp +++ b/include/boost/beast/core/flat_static_buffer.hpp @@ -124,7 +124,7 @@ public: void commit(std::size_t n) { - out_ += std::min(n, last_ - out_); + out_ += (std::min)(n, last_ - out_); } /// Remove bytes from the input sequence. diff --git a/include/boost/beast/core/impl/flat_buffer.ipp b/include/boost/beast/core/impl/flat_buffer.ipp index 95c38d89..ffca651c 100644 --- a/include/boost/beast/core/impl/flat_buffer.ipp +++ b/include/boost/beast/core/impl/flat_buffer.ipp @@ -263,9 +263,9 @@ prepare(std::size_t n) -> BOOST_THROW_EXCEPTION(std::length_error{ "basic_flat_buffer overflow"}); // allocate a new buffer - auto const new_size = std::min( + auto const new_size = (std::min)( max_, - std::max(2 * len, len + n)); + (std::max)(2 * len, len + n)); auto const p = alloc_traits::allocate( this->member(), new_size); if(begin_) diff --git a/include/boost/beast/core/impl/multi_buffer.ipp b/include/boost/beast/core/impl/multi_buffer.ipp index c55f396f..7b66694c 100644 --- a/include/boost/beast/core/impl/multi_buffer.ipp +++ b/include/boost/beast/core/impl/multi_buffer.ipp @@ -700,9 +700,9 @@ prepare(size_type n) -> { static auto const growth_factor = 2.0f; auto const size = - std::min( + (std::min)( max_ - total, - std::max({ + (std::max)({ static_cast( in_size_ * growth_factor - in_size_), 512, diff --git a/include/boost/beast/core/impl/read_size.ipp b/include/boost/beast/core/impl/read_size.ipp index d29eeaa7..ddcaf397 100644 --- a/include/boost/beast/core/impl/read_size.ipp +++ b/include/boost/beast/core/impl/read_size.ipp @@ -45,9 +45,9 @@ read_size(DynamicBuffer& buffer, auto const size = buffer.size(); auto const limit = buffer.max_size() - size; BOOST_ASSERT(size <= buffer.max_size()); - return std::min( - std::max(512, buffer.capacity() - size), - std::min(max_size, limit)); + return (std::min)( + (std::max)(512, buffer.capacity() - size), + (std::min)(max_size, limit)); } } // detail diff --git a/include/boost/beast/http/impl/basic_parser.ipp b/include/boost/beast/http/impl/basic_parser.ipp index 66cef690..1930ae23 100644 --- a/include/boost/beast/http/impl/basic_parser.ipp +++ b/include/boost/beast/http/impl/basic_parser.ipp @@ -167,7 +167,7 @@ loop: maybe_need_more(p, n, ec); if(ec) goto done; - parse_start_line(p, p + std::min( + parse_start_line(p, p + (std::min)( header_limit_, n), ec, is_request{}); if(ec) { @@ -198,7 +198,7 @@ loop: maybe_need_more(p, n, ec); if(ec) goto done; - parse_fields(p, p + std::min( + parse_fields(p, p + (std::min)( header_limit_, n), ec); if(ec) { diff --git a/include/boost/beast/http/impl/file_body_win32.ipp b/include/boost/beast/http/impl/file_body_win32.ipp index eb91d6a7..00bea44a 100644 --- a/include/boost/beast/http/impl/file_body_win32.ipp +++ b/include/boost/beast/http/impl/file_body_win32.ipp @@ -417,8 +417,8 @@ operator()() } auto& r = sr_.reader_impl(); boost::winapi::DWORD_ const nNumberOfBytesToWrite = - std::min( - beast::detail::clamp(std::min( + (std::min)( + beast::detail::clamp((std::min)( r.body_.last_ - r.pos_, sr_.limit())), 2147483646); boost::asio::windows::overlapped_ptr overlapped{ @@ -514,8 +514,8 @@ write_some( if(ec) return 0; boost::winapi::DWORD_ const nNumberOfBytesToWrite = - std::min( - beast::detail::clamp(std::min( + (std::min)( + beast::detail::clamp((std::min)( r.body_.last_ - r.pos_, sr.limit())), 2147483646); auto const bSuccess = ::TransmitFile( diff --git a/include/boost/beast/websocket/detail/pmd_extension.hpp b/include/boost/beast/websocket/detail/pmd_extension.hpp index 4aab7f50..a28b844c 100644 --- a/include/boost/beast/websocket/detail/pmd_extension.hpp +++ b/include/boost/beast/websocket/detail/pmd_extension.hpp @@ -277,7 +277,7 @@ pmd_negotiate( s += "; client_no_context_takeover"; if(offer.server_max_window_bits != 0) - config.server_max_window_bits = std::min( + config.server_max_window_bits = (std::min)( offer.server_max_window_bits, o.server_max_window_bits); else @@ -326,7 +326,7 @@ pmd_negotiate( default: // extension parameter has value in [8..15] - config.client_max_window_bits = std::min( + config.client_max_window_bits = (std::min)( o.client_max_window_bits, offer.client_max_window_bits); s += "; client_max_window_bits=";