Fix flat_buffer copy members

fix #1621
This commit is contained in:
Vinnie Falco
2019-05-27 08:27:25 -07:00
committed by Damian Jarek
parent 8198571555
commit e9781b225e
3 changed files with 19 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ Version 257:
* Remove redundant dependencies in http/server/fast example * Remove redundant dependencies in http/server/fast example
* Remove experimental/unit_test/thread.hpp * Remove experimental/unit_test/thread.hpp
* Use `if` statement in basic_stream::transfer_op * Use `if` statement in basic_stream::transfer_op
* Fix flat_buffer copy members
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -403,7 +403,7 @@ copy_from(
if(begin_) if(begin_)
{ {
BOOST_ASSERT(other.begin_); BOOST_ASSERT(other.begin_);
std::memcpy(begin_, other.begin_, n); std::memcpy(begin_, other.in_, n);
} }
} }

View File

@@ -395,6 +395,14 @@ test_dynamic_buffer(
BEAST_EXPECT( BEAST_EXPECT(
buffers_to_string(b1.data()) == buffers_to_string(b1.data()) ==
buffers_to_string(b2.data())); buffers_to_string(b2.data()));
// https://github.com/boostorg/beast/issues/1621
b2.consume(1);
DynamicBuffer b3(b2);
BEAST_EXPECT(b3.size() == b2.size());
BEAST_EXPECT(
buffers_to_string(b2.data()) ==
buffers_to_string(b3.data()));
} }
// move constructor // move constructor
@@ -422,6 +430,15 @@ test_dynamic_buffer(
BEAST_EXPECT( BEAST_EXPECT(
buffers_to_string(b2.data()) == buffers_to_string(b2.data()) ==
buffers_to_string(b1.data())); buffers_to_string(b1.data()));
// https://github.com/boostorg/beast/issues/1621
b2.consume(1);
DynamicBuffer b3(b2);
BEAST_EXPECT(b3.size() == b2.size());
BEAST_EXPECT(
buffers_to_string(b2.data()) ==
buffers_to_string(b3.data()));
} }
// move assignment // move assignment