Add buffer_size

This commit is contained in:
Vinnie Falco committed 2019-02-03 12:59:11 -08:00
1 parent 64149f434a
commit 35dbd140d4
64 files changed
+427 -379

No files matched your search

+1 -1
View File
@@ -13,6 +13,7 @@
#include "message_fuzz.hpp"
#include "test_parser.hpp"
#include <boost/beast/core/buffer_size.hpp>
#include <boost/beast/core/buffers_cat.hpp>
#include <boost/beast/core/buffers_prefix.hpp>
#include <boost/beast/core/buffers_suffix.hpp>
@@ -156,7 +157,6 @@ public:
parsegrind(ConstBufferSequence const& buffers,
Test const& test, bool skip = false)
{
using net::buffer_size;
auto const size = buffer_size(buffers);
for(std::size_t i = 1; i < size - 1; ++i)
{
+1 -1
View File
@@ -10,6 +10,7 @@
// Test that header file is self-contained.
#include <boost/beast/http/file_body.hpp>
#include <boost/beast/core/buffer_size.hpp>
#include <boost/beast/core/buffers_prefix.hpp>
#include <boost/beast/core/file_stdio.hpp>
#include <boost/beast/core/flat_buffer.hpp>
@@ -33,7 +34,6 @@ public:
void
operator()(error_code&, ConstBufferSequence const& buffers)
{
using net::buffer_size;
buffer.commit(net::buffer_copy(
buffer.prepare(buffer_size(buffers)),
buffers));
+4 -5
View File
@@ -14,6 +14,7 @@
#include <boost/beast/_experimental/unit_test/suite.hpp>
#include <boost/beast/test/yield_to.hpp>
#include <boost/beast/core/buffer_size.hpp>
#include <boost/beast/core/buffers_suffix.hpp>
#include <boost/beast/core/flat_buffer.hpp>
#include <boost/beast/core/multi_buffer.hpp>
@@ -51,7 +52,6 @@ public:
basic_parser<isRequest, Derived>& p,
error_code& ec)
{
using net::buffer_size;
buffers_suffix<ConstBufferSequence> cb{buffers};
for(;;)
{
@@ -75,13 +75,12 @@ public:
void
doMatrix(string_view s0, F const& f)
{
using net::buffer;
// parse a single buffer
{
auto s = s0;
error_code ec;
parser_type<isRequest> p;
put(buffer(s.data(), s.size()), p, ec);
put(net::buffer(s.data(), s.size()), p, ec);
if(! BEAST_EXPECTS(! ec, ec.message()))
return;
f(p);
@@ -94,7 +93,7 @@ public:
parser_type<isRequest> p;
p.eager(true);
auto used =
p.put(buffer(s.data(), n), ec);
p.put(net::buffer(s.data(), n), ec);
s.remove_prefix(used);
if(ec == error::need_more)
ec = {};
@@ -102,7 +101,7 @@ public:
continue;
BEAST_EXPECT(! p.is_done());
used = p.put(
buffer(s.data(), s.size()), ec);
net::buffer(s.data(), s.size()), ec);
s.remove_prefix(used);
if(! BEAST_EXPECTS(! ec, ec.message()))
continue;
-1
View File
@@ -430,7 +430,6 @@ public:
void
readgrind(string_view s, Pred&& pred)
{
using net::buffer;
for(std::size_t n = 1; n < s.size() - 1; ++n)
{
Parser p;
+1 -1
View File
@@ -10,6 +10,7 @@
// Test that header file is self-contained.
#include <boost/beast/http/serializer.hpp>
#include <boost/beast/core/buffer_size.hpp>
#include <boost/beast/http/string_body.hpp>
#include <boost/beast/_experimental/unit_test/suite.hpp>
@@ -91,7 +92,6 @@ public:
operator()(error_code&,
ConstBufferSequence const& buffers)
{
using net::buffer_size;
size = buffer_size(buffers);
}
};
+1 -1
View File
@@ -10,6 +10,7 @@
// Test that header file is self-contained.
#include <boost/beast/http/span_body.hpp>
#include <boost/beast/core/buffer_size.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/beast/_experimental/unit_test/suite.hpp>
@@ -23,7 +24,6 @@ struct span_body_test
void
testSpanBody()
{
using net::buffer_size;
{
using B = span_body<char const>;
request<B> req;
+7 -10
View File
@@ -124,10 +124,10 @@ public:
std::false_type, // isSplit
std::false_type) // isFinalEmpty
{
using net::buffer;
if(body_.s.empty())
return boost::none;
return {{buffer(body_.s.data(), body_.s.size()), false}};
return {{net::buffer(
body_.s.data(), body_.s.size()), false}};
}
boost::optional<std::pair<const_buffers_type, bool>>
@@ -135,14 +135,13 @@ public:
std::false_type, // isSplit
std::true_type) // isFinalEmpty
{
using net::buffer;
if(body_.s.empty())
return boost::none;
switch(step_)
{
case 0:
step_ = 1;
return {{buffer(
return {{net::buffer(
body_.s.data(), body_.s.size()), true}};
default:
return boost::none;
@@ -154,7 +153,6 @@ public:
std::true_type, // isSplit
std::false_type) // isFinalEmpty
{
using net::buffer;
auto const n = (body_.s.size() + 1) / 2;
switch(step_)
{
@@ -162,10 +160,10 @@ public:
if(n == 0)
return boost::none;
step_ = 1;
return {{buffer(body_.s.data(), n),
return {{net::buffer(body_.s.data(), n),
body_.s.size() > 1}};
default:
return {{buffer(body_.s.data() + n,
return {{net::buffer(body_.s.data() + n,
body_.s.size() - n), false}};
}
}
@@ -175,7 +173,6 @@ public:
std::true_type, // isSplit
std::true_type) // isFinalEmpty
{
using net::buffer;
auto const n = (body_.s.size() + 1) / 2;
switch(step_)
{
@@ -183,11 +180,11 @@ public:
if(n == 0)
return boost::none;
step_ = body_.s.size() > 1 ? 1 : 2;
return {{buffer(body_.s.data(), n), true}};
return {{net::buffer(body_.s.data(), n), true}};
case 1:
BOOST_ASSERT(body_.s.size() > 1);
step_ = 2;
return {{buffer(body_.s.data() + n,
return {{net::buffer(body_.s.data() + n,
body_.s.size() - n), true}};
default:
return boost::none;