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
@@ -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())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user