mirror of
https://github.com/boostorg/beast.git
synced 2025-08-01 22:04:34 +02:00
@@ -1,5 +1,7 @@
|
||||
1.0.0-b19
|
||||
|
||||
* Boost library min/max guidance
|
||||
|
||||
HTTP
|
||||
|
||||
* Make chunk_encode public
|
||||
|
@@ -250,7 +250,7 @@ public:
|
||||
size_type
|
||||
max_size() const
|
||||
{
|
||||
return std::numeric_limits<std::size_t>::max();
|
||||
return (std::numeric_limits<std::size_t>::max)();
|
||||
}
|
||||
|
||||
/// Returns the maximum sum of the sizes of the input sequence and output sequence the buffer can hold without requiring reallocation.
|
||||
|
@@ -19,8 +19,8 @@ static
|
||||
std::size_t
|
||||
clamp(UInt x)
|
||||
{
|
||||
if(x >= std::numeric_limits<std::size_t>::max())
|
||||
return std::numeric_limits<std::size_t>::max();
|
||||
if(x >= (std::numeric_limits<std::size_t>::max)())
|
||||
return (std::numeric_limits<std::size_t>::max)();
|
||||
return static_cast<std::size_t>(x);
|
||||
}
|
||||
|
||||
|
@@ -249,7 +249,7 @@ update(sha1_context& ctx,
|
||||
std::uint8_t const*>(message);
|
||||
for(;;)
|
||||
{
|
||||
auto const n = std::min(
|
||||
auto const n = (std::min)(
|
||||
size, sizeof(ctx.buf) - ctx.buflen);
|
||||
std::memcpy(ctx.buf + ctx.buflen, p, n);
|
||||
ctx.buflen += n;
|
||||
|
@@ -657,7 +657,7 @@ basic_streambuf<Allocator>::commit(size_type n)
|
||||
debug_check();
|
||||
}
|
||||
|
||||
n = std::min(n, out_end_ - out_pos_);
|
||||
n = (std::min)(n, out_end_ - out_pos_);
|
||||
out_pos_ += n;
|
||||
in_size_ += n;
|
||||
if(out_pos_ == out_->size())
|
||||
@@ -862,13 +862,13 @@ read_size_helper(basic_streambuf<
|
||||
// buffer, try to fill that up first
|
||||
auto const avail = streambuf.capacity() - streambuf.size();
|
||||
if (avail > 0)
|
||||
return std::min(avail, max_size);
|
||||
return (std::min)(avail, max_size);
|
||||
// Try to have just one new block allocated
|
||||
constexpr std::size_t low = 512;
|
||||
if (streambuf.alloc_size_ > low)
|
||||
return std::min(max_size, streambuf.alloc_size_);
|
||||
return (std::min)(max_size, streambuf.alloc_size_);
|
||||
// ...but enforce a 512 byte minimum.
|
||||
return std::min(max_size, low);
|
||||
return (std::min)(max_size, low);
|
||||
}
|
||||
|
||||
template<class Alloc, class T>
|
||||
|
@@ -444,7 +444,7 @@ buffers_adapter<MutableBufferSequence>::commit(std::size_t n)
|
||||
max_size_ -= avail;
|
||||
}
|
||||
|
||||
n = std::min(n, out_end_ - out_pos_);
|
||||
n = (std::min)(n, out_end_ - out_pos_);
|
||||
out_pos_ += n;
|
||||
in_size_ += n;
|
||||
max_size_ -= n;
|
||||
|
@@ -31,7 +31,7 @@ prepare_buffer(std::size_t n,
|
||||
using boost::asio::buffer_cast;
|
||||
using boost::asio::buffer_size;
|
||||
return { buffer_cast<void const*>(buffer),
|
||||
std::min(n, buffer_size(buffer)) };
|
||||
(std::min)(n, buffer_size(buffer)) };
|
||||
}
|
||||
|
||||
/** Get a trimmed mutable buffer.
|
||||
@@ -48,7 +48,7 @@ prepare_buffer(std::size_t n,
|
||||
using boost::asio::buffer_cast;
|
||||
using boost::asio::buffer_size;
|
||||
return { buffer_cast<void*>(buffer),
|
||||
std::min(n, buffer_size(buffer)) };
|
||||
(std::min)(n, buffer_size(buffer)) };
|
||||
}
|
||||
|
||||
/** Wrapper to produce a trimmed buffer sequence.
|
||||
|
@@ -125,7 +125,7 @@ enum class body_what
|
||||
|
||||
/// The value returned when no content length is known or applicable.
|
||||
static std::uint64_t constexpr no_content_length =
|
||||
std::numeric_limits<std::uint64_t>::max();
|
||||
(std::numeric_limits<std::uint64_t>::max)();
|
||||
|
||||
/** A parser for decoding HTTP/1 wire format messages.
|
||||
|
||||
|
@@ -356,8 +356,8 @@ read_fh2(DynamicBuffer& db, close_code::value& code)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rd_size_ > std::numeric_limits<
|
||||
std::uint64_t>::max() - rd_fh_.len)
|
||||
if(rd_size_ > (std::numeric_limits<
|
||||
std::uint64_t>::max)() - rd_fh_.len)
|
||||
{
|
||||
code = close_code::too_big;
|
||||
return;
|
||||
|
@@ -230,7 +230,7 @@ utf8_checker_t<_>::write(std::uint8_t const* in, std::size_t size)
|
||||
auto const end = in + size;
|
||||
if (need_ > 0)
|
||||
{
|
||||
auto n = std::min(size, need_);
|
||||
auto n = (std::min)(size, need_);
|
||||
size -= n;
|
||||
need_ -= n;
|
||||
while(n--)
|
||||
|
@@ -20,8 +20,8 @@ public:
|
||||
void testClamp()
|
||||
{
|
||||
BEAST_EXPECT(clamp(
|
||||
std::numeric_limits<std::uint64_t>::max()) ==
|
||||
std::numeric_limits<std::size_t>::max());
|
||||
(std::numeric_limits<std::uint64_t>::max)()) ==
|
||||
(std::numeric_limits<std::size_t>::max)());
|
||||
}
|
||||
|
||||
void run() override
|
||||
|
@@ -514,7 +514,7 @@ public:
|
||||
write(db, "Transfer-Encoding: chunked\r\n\r\n");
|
||||
while(len > 0)
|
||||
{
|
||||
auto n = std::min(1 + rand(300), len);
|
||||
auto n = (std::min)(1 + rand(300), len);
|
||||
len -= n;
|
||||
write(db, to_hex(n), "\r\n");
|
||||
for(auto const& b : db.prepare(n))
|
||||
|
@@ -289,7 +289,7 @@ public:
|
||||
streambuf sb(size);
|
||||
while(n)
|
||||
{
|
||||
auto const amount = std::min(n, size);
|
||||
auto const amount = (std::min)(n, size);
|
||||
sb.commit(buffer_copy(sb.prepare(amount), cb));
|
||||
cb.consume(amount);
|
||||
n -= amount;
|
||||
|
Reference in New Issue
Block a user