forked from boostorg/beast
Add buffer_size
This commit is contained in:
1 parent
64149f434a
commit
35dbd140d4
64 files changed
+427
-379
No files matched your search
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_BUFFER_SIZE_HPP
|
||||
#define BOOST_BEAST_BUFFER_SIZE_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/detail/static_const.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T, class = void>
|
||||
struct has_buffer_size_impl : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct has_buffer_size_impl<T, boost::void_t<
|
||||
decltype(std::declval<std::size_t&>() =
|
||||
std::declval<T const&>().buffer_size_impl())>>
|
||||
: std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
struct buffer_size_impl
|
||||
{
|
||||
template<
|
||||
class B,
|
||||
class = typename std::enable_if<
|
||||
std::is_convertible<
|
||||
B, net::const_buffer>::value>::type>
|
||||
std::size_t
|
||||
operator()(B const& b) const
|
||||
{
|
||||
return net::const_buffer(b).size();
|
||||
}
|
||||
|
||||
template<
|
||||
class B,
|
||||
class = typename std::enable_if<
|
||||
! std::is_convertible<
|
||||
B, net::const_buffer>::value>::type,
|
||||
class = typename std::enable_if<
|
||||
net::is_const_buffer_sequence<B>::value &&
|
||||
! has_buffer_size_impl<B>::value>::type>
|
||||
std::size_t
|
||||
operator()(B const& b) const
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(b);
|
||||
}
|
||||
|
||||
template<
|
||||
class B,
|
||||
class = typename std::enable_if<
|
||||
! std::is_convertible<B, net::const_buffer>::value>::type,
|
||||
class = typename std::enable_if<
|
||||
net::is_const_buffer_sequence<B>::value>::type,
|
||||
class = typename std::enable_if<
|
||||
has_buffer_size_impl<B>::value>::type>
|
||||
std::size_t
|
||||
operator()(B const& b) const
|
||||
{
|
||||
return b.buffer_size_impl();
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
/** Return the total number of bytes in a buffer or buffer sequence
|
||||
|
||||
This function returns the total number of bytes in a buffer,
|
||||
buffer sequence, or object convertible to a buffer. Specifically
|
||||
it may be passed:
|
||||
|
||||
@li A <em>ConstBufferSequence</em> or <em>MutableBufferSequence</em>
|
||||
|
||||
@li A `net::const_buffer` or `net::mutable_buffer`
|
||||
|
||||
@li An object convertible to `net::const_buffer`
|
||||
|
||||
This function is designed as an easier-to-use replacement for
|
||||
`net::buffer_size`. It recognizes customization points found through
|
||||
argument-dependent lookup. The call `beast::buffer_size(b)` is
|
||||
equivalent to performing:
|
||||
@code
|
||||
using namespace net;
|
||||
buffer_size(b);
|
||||
@endcode
|
||||
In addition this handles types which are convertible to
|
||||
`net::const_buffer`; these are not handled by `net::buffer_size`.
|
||||
|
||||
@note It is expected that a future version of Networking will
|
||||
incorporate the features of this function.
|
||||
|
||||
@param buffers The buffer or buffer sequence to calculate the size of.
|
||||
|
||||
@return The total number of bytes in the buffer or sequence.
|
||||
*/
|
||||
#if BOOST_BEAST_DOXYGEN
|
||||
template<class Buffers>
|
||||
void
|
||||
buffer_size(Buffers const& buffers);
|
||||
#else
|
||||
BOOST_BEAST_INLINE_VARIABLE(buffer_size, detail::buffer_size_impl)
|
||||
#endif
|
||||
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_BUFFERS_PREFIX_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffer_traits.hpp>
|
||||
#include <boost/optional/optional.hpp> // for in_place_init_t
|
||||
#include <algorithm>
|
||||
@@ -128,25 +129,14 @@ public:
|
||||
end() const;
|
||||
|
||||
#if ! BOOST_BEAST_DOXYGEN
|
||||
template<class Buffers>
|
||||
friend
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<Buffers> const& buffers);
|
||||
buffer_size_impl() const noexcept
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef BOOST_BEAST_DOXYGEN
|
||||
BOOST_BEAST_DECL
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
net::const_buffer> const& buffers);
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
net::mutable_buffer> const& buffers);
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Returns a prefix of a constant or mutable buffer sequence.
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace beast {
|
||||
void send(SyncWriteStream& stream, ConstBufferSequence const& buffers)
|
||||
{
|
||||
buffers_suffix<ConstBufferSequence> bs{buffers};
|
||||
using net::buffer_size;
|
||||
while(buffer_size(bs) > 0)
|
||||
bs.consume(stream.write_some(bs));
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_BUFFERS_TO_STRING_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_range.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <string>
|
||||
@@ -48,9 +49,8 @@ buffers_to_string(ConstBufferSequence const& buffers)
|
||||
net::is_const_buffer_sequence<ConstBufferSequence>::value,
|
||||
"ConstBufferSequence requirements not met");
|
||||
std::string result;
|
||||
using net::buffer_size;
|
||||
result.reserve(buffer_size(buffers));
|
||||
for(auto const buffer : beast::buffers_range_ref(buffers))
|
||||
for(auto const buffer : buffers_range_ref(buffers))
|
||||
result.append(static_cast<char const*>(
|
||||
buffer.data()), buffer.size());
|
||||
return result;
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
@@ -44,151 +43,82 @@ namespace detail {
|
||||
template<std::size_t R>
|
||||
class chacha
|
||||
{
|
||||
void generate_block();
|
||||
void chacha_core();
|
||||
|
||||
alignas(16) std::uint32_t block_[16];
|
||||
std::uint32_t keysetup_[8];
|
||||
std::uint64_t ctr_ = 0;
|
||||
int idx_ = 16;
|
||||
|
||||
void generate_block()
|
||||
{
|
||||
std::uint32_t constexpr constants[4] = {
|
||||
0x61707865, 0x3320646e, 0x79622d32, 0x6b206574 };
|
||||
std::uint32_t input[16];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
input[i] = constants[i];
|
||||
for (int i = 0; i < 8; ++i)
|
||||
input[4 + i] = keysetup_[i];
|
||||
input[12] = (ctr_ / 16) & 0xffffffffu;
|
||||
input[13] = (ctr_ / 16) >> 32;
|
||||
input[14] = input[15] = 0xdeadbeef; // Could use 128-bit counter.
|
||||
for (int i = 0; i < 16; ++i)
|
||||
block_[i] = input[i];
|
||||
chacha_core();
|
||||
for (int i = 0; i < 16; ++i)
|
||||
block_[i] += input[i];
|
||||
}
|
||||
|
||||
void chacha_core()
|
||||
{
|
||||
#define BOOST_BEAST_CHACHA_ROTL32(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
|
||||
#define BOOST_BEAST_CHACHA_QUARTERROUND(x, a, b, c, d) \
|
||||
x[a] = x[a] + x[b]; x[d] ^= x[a]; x[d] = BOOST_BEAST_CHACHA_ROTL32(x[d], 16); \
|
||||
x[c] = x[c] + x[d]; x[b] ^= x[c]; x[b] = BOOST_BEAST_CHACHA_ROTL32(x[b], 12); \
|
||||
x[a] = x[a] + x[b]; x[d] ^= x[a]; x[d] = BOOST_BEAST_CHACHA_ROTL32(x[d], 8); \
|
||||
x[c] = x[c] + x[d]; x[b] ^= x[c]; x[b] = BOOST_BEAST_CHACHA_ROTL32(x[b], 7)
|
||||
|
||||
for (unsigned i = 0; i < R; i += 2)
|
||||
{
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 0, 4, 8, 12);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 1, 5, 9, 13);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 2, 6, 10, 14);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 3, 7, 11, 15);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 0, 5, 10, 15);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 1, 6, 11, 12);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 2, 7, 8, 13);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 3, 4, 9, 14);
|
||||
}
|
||||
|
||||
#undef BOOST_BEAST_CHACHA_QUARTERROUND
|
||||
#undef BOOST_BEAST_CHACHA_ROTL32
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr std::size_t state_size = sizeof(chacha::keysetup_);
|
||||
|
||||
using result_type = std::uint32_t;
|
||||
|
||||
chacha(std::uint32_t const* v, std::uint64_t stream);
|
||||
|
||||
std::uint32_t
|
||||
operator()();
|
||||
|
||||
#if 0
|
||||
template<std::size_t R_>
|
||||
friend
|
||||
bool
|
||||
operator==(chacha<R_> const& lhs, chacha<R_> const& rhs);
|
||||
|
||||
template<std::size_t R_>
|
||||
friend
|
||||
bool
|
||||
operator!=(chacha<R_> const& lhs, chacha<R_> const& rhs);
|
||||
|
||||
static
|
||||
constexpr
|
||||
std::uint32_t
|
||||
min()
|
||||
chacha(std::uint32_t const* v, std::uint64_t stream)
|
||||
{
|
||||
return (std::numeric_limits<std::uint32_t>::min)();
|
||||
for (int i = 0; i < 6; ++i)
|
||||
keysetup_[i] = v[i];
|
||||
keysetup_[6] = v[6] + (stream & 0xffffffff);
|
||||
keysetup_[7] = v[7] + ((stream >> 32) & 0xffffffff);
|
||||
}
|
||||
|
||||
static
|
||||
constexpr
|
||||
std::uint32_t
|
||||
max()
|
||||
operator()()
|
||||
{
|
||||
return (std::numeric_limits<std::uint32_t>::max)();
|
||||
if(idx_ == 16)
|
||||
{
|
||||
idx_ = 0;
|
||||
++ctr_;
|
||||
generate_block();
|
||||
}
|
||||
return block_[idx_++];
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template<std::size_t R>
|
||||
chacha<R>::
|
||||
chacha(std::uint32_t const* v, std::uint64_t stream)
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
keysetup_[i] = v[i];
|
||||
keysetup_[6] = v[6] + (stream & 0xffffffff);
|
||||
keysetup_[7] = v[7] + ((stream >> 32) & 0xffffffff);
|
||||
}
|
||||
|
||||
template<std::size_t R>
|
||||
std::uint32_t
|
||||
chacha<R>::
|
||||
operator()()
|
||||
{
|
||||
if(idx_ == 16)
|
||||
{
|
||||
idx_ = 0;
|
||||
++ctr_;
|
||||
generate_block();
|
||||
}
|
||||
return block_[idx_++];
|
||||
}
|
||||
|
||||
template<std::size_t R>
|
||||
void
|
||||
chacha<R>::
|
||||
generate_block()
|
||||
{
|
||||
std::uint32_t constexpr constants[4] = {
|
||||
0x61707865, 0x3320646e, 0x79622d32, 0x6b206574 };
|
||||
std::uint32_t input[16];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
input[i] = constants[i];
|
||||
for (int i = 0; i < 8; ++i)
|
||||
input[4 + i] = keysetup_[i];
|
||||
input[12] = (ctr_ / 16) & 0xffffffffu;
|
||||
input[13] = (ctr_ / 16) >> 32;
|
||||
input[14] = input[15] = 0xdeadbeef; // Could use 128-bit counter.
|
||||
for (int i = 0; i < 16; ++i)
|
||||
block_[i] = input[i];
|
||||
chacha_core();
|
||||
for (int i = 0; i < 16; ++i)
|
||||
block_[i] += input[i];
|
||||
}
|
||||
|
||||
template<std::size_t R>
|
||||
void
|
||||
chacha<R>::
|
||||
chacha_core()
|
||||
{
|
||||
#define BOOST_BEAST_CHACHA_ROTL32(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
|
||||
#define BOOST_BEAST_CHACHA_QUARTERROUND(x, a, b, c, d) \
|
||||
x[a] = x[a] + x[b]; x[d] ^= x[a]; x[d] = BOOST_BEAST_CHACHA_ROTL32(x[d], 16); \
|
||||
x[c] = x[c] + x[d]; x[b] ^= x[c]; x[b] = BOOST_BEAST_CHACHA_ROTL32(x[b], 12); \
|
||||
x[a] = x[a] + x[b]; x[d] ^= x[a]; x[d] = BOOST_BEAST_CHACHA_ROTL32(x[d], 8); \
|
||||
x[c] = x[c] + x[d]; x[b] ^= x[c]; x[b] = BOOST_BEAST_CHACHA_ROTL32(x[b], 7)
|
||||
|
||||
for (unsigned i = 0; i < R; i += 2)
|
||||
{
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 0, 4, 8, 12);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 1, 5, 9, 13);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 2, 6, 10, 14);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 3, 7, 11, 15);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 0, 5, 10, 15);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 1, 6, 11, 12);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 2, 7, 8, 13);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 3, 4, 9, 14);
|
||||
}
|
||||
|
||||
#undef BOOST_BEAST_CHACHA_QUARTERROUND
|
||||
#undef BOOST_BEAST_CHACHA_ROTL32
|
||||
}
|
||||
|
||||
//#endif
|
||||
|
||||
#if 0
|
||||
// Implement <random> interface.
|
||||
|
||||
template<std::size_t R>
|
||||
bool
|
||||
operator==(chacha<R> const& lhs, chacha<R> const& rhs)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
if (lhs.keysetup_[i] != rhs.keysetup_[i])
|
||||
return false;
|
||||
return lhs.ctr_ == rhs.ctr_;
|
||||
}
|
||||
|
||||
template<std::size_t R>
|
||||
bool
|
||||
operator!=(chacha<R> const& lhs, chacha<R> const& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace net = boost::asio;
|
||||
#define BOOST_BEAST_INLINE_VARIABLE(name, type) \
|
||||
inline namespace \
|
||||
{ \
|
||||
constexpr auto &name = \
|
||||
constexpr auto& name = \
|
||||
::boost::beast::detail::static_const<type>::value; \
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_BUFFERS_ADAPTOR_HPP
|
||||
#define BOOST_BEAST_IMPL_BUFFERS_ADAPTOR_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
@@ -400,7 +401,6 @@ buffers_adaptor(MutableBufferSequence const& bs)
|
||||
, max_size_(
|
||||
[&bs]
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(bs);
|
||||
}())
|
||||
{
|
||||
@@ -418,7 +418,6 @@ buffers_adaptor(
|
||||
, max_size_(
|
||||
[&]
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(bs_);
|
||||
}())
|
||||
{
|
||||
@@ -502,7 +501,6 @@ prepare(std::size_t n) ->
|
||||
end_ = out_;
|
||||
if(end_ != net::buffer_sequence_end(bs_))
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto size = buffer_size(*end_) - out_pos_;
|
||||
if(n > size)
|
||||
{
|
||||
@@ -545,7 +543,6 @@ commit(std::size_t n) noexcept
|
||||
auto const last = std::prev(end_);
|
||||
while(out_ != last)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const avail =
|
||||
buffer_size(*out_) - out_pos_;
|
||||
if(n < avail)
|
||||
@@ -579,7 +576,6 @@ consume(std::size_t n) noexcept
|
||||
{
|
||||
while(begin_ != out_)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const avail =
|
||||
buffer_size(*begin_) - in_pos_;
|
||||
if(n < avail)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_BUFFERS_PREFIX_HPP
|
||||
#define BOOST_BEAST_IMPL_BUFFERS_PREFIX_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
@@ -149,7 +150,6 @@ setup(std::size_t size)
|
||||
auto const last = bs_.end();
|
||||
while(end_ != last)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const len = buffer_size(*end_++);
|
||||
if(len >= size)
|
||||
{
|
||||
@@ -248,14 +248,6 @@ end() const ->
|
||||
*this, std::true_type{}};
|
||||
}
|
||||
|
||||
template<class Buffers>
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
Buffers> const& buffers)
|
||||
{
|
||||
return buffers.size_;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<>
|
||||
@@ -290,14 +282,13 @@ public:
|
||||
std::forward<Args>(args)...))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
net::const_buffer> const& buffers)
|
||||
{
|
||||
return buffers.size();
|
||||
}
|
||||
std::size_t
|
||||
buffer_size_impl() const noexcept
|
||||
{
|
||||
return this->size();
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -333,14 +324,13 @@ public:
|
||||
std::forward<Args>(args)...))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
net::mutable_buffer> const& buffers)
|
||||
{
|
||||
return buffers.size();
|
||||
}
|
||||
std::size_t
|
||||
buffer_size_impl() const noexcept
|
||||
{
|
||||
return this->size();
|
||||
}
|
||||
};
|
||||
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_BUFFERS_SUFFIX_HPP
|
||||
#define BOOST_BEAST_IMPL_BUFFERS_SUFFIX_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffer_traits.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <algorithm>
|
||||
@@ -206,7 +207,6 @@ consume(std::size_t amount)
|
||||
net::buffer_sequence_end(bs_);
|
||||
for(;amount > 0 && begin_ != end; ++begin_)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const len =
|
||||
buffer_size(*begin_) - skip_;
|
||||
if(amount < len)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_MULTI_BUFFER_HPP
|
||||
#define BOOST_BEAST_IMPL_MULTI_BUFFER_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <boost/core/exchange.hpp>
|
||||
@@ -195,11 +196,10 @@ public:
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
friend
|
||||
std::size_t
|
||||
buffer_size(readable_bytes const& buffers) noexcept
|
||||
buffer_size() const noexcept
|
||||
{
|
||||
return buffers.b_->size();
|
||||
return b_->size();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1132,7 +1132,6 @@ basic_multi_buffer<Allocator>::
|
||||
debug_check() const
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
using net::buffer_size;
|
||||
BOOST_ASSERT(buffer_size(data()) == in_size_);
|
||||
if(list_.empty())
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_MAKE_PRINTABLE_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <ostream>
|
||||
|
||||
@@ -73,7 +74,6 @@ operator<<(std::ostream& os,
|
||||
void
|
||||
print (ConstBufferSequence const& buffers)
|
||||
{
|
||||
using net::buffer_size;
|
||||
std::cout <<
|
||||
"Buffer size: " << buffer_size(buffers) << " bytes\n"
|
||||
"Buffer data: '" << make_printable(buffers) << "'\n";
|
||||
|
||||
Reference in new issue
Block a user