Tidy up static_buffer braced init

This commit is contained in:
Vinnie Falco
2017-07-29 21:22:26 -07:00
parent 6e3c63e685
commit c27fbf826d
2 changed files with 19 additions and 18 deletions

View File

@@ -5,6 +5,7 @@ Version 95:
* Fix race in test::pipe * Fix race in test::pipe
* close on test::pipe teardown * close on test::pipe teardown
* Add test::stream * Add test::stream
* Tidy up static_buffer braced init
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -37,12 +37,12 @@ data() const ->
{ {
using boost::asio::const_buffer; using boost::asio::const_buffer;
if(in_off_ + in_size_ <= capacity_) if(in_off_ + in_size_ <= capacity_)
return { return {{
const_buffer{ begin_ + in_off_, in_size_ }, const_buffer{begin_ + in_off_, in_size_},
const_buffer{ begin_, 0 } }; const_buffer{begin_, 0}}};
return { return {{
const_buffer{ begin_ + in_off_, capacity_ - in_off_ }, const_buffer{begin_ + in_off_, capacity_ - in_off_},
const_buffer{ begin_, in_size_ - (capacity_ - in_off_) } }; const_buffer{begin_, in_size_ - (capacity_ - in_off_)}}};
} }
inline inline
@@ -53,12 +53,12 @@ mutable_data() ->
{ {
using boost::asio::mutable_buffer; using boost::asio::mutable_buffer;
if(in_off_ + in_size_ <= capacity_) if(in_off_ + in_size_ <= capacity_)
return { return {{
mutable_buffer{ begin_ + in_off_, in_size_ }, mutable_buffer{begin_ + in_off_, in_size_},
mutable_buffer{ begin_, 0 } }; mutable_buffer{begin_, 0}}};
return { return {{
mutable_buffer{ begin_ + in_off_, capacity_ - in_off_ }, mutable_buffer{begin_ + in_off_, capacity_ - in_off_},
mutable_buffer{ begin_, in_size_ - (capacity_ - in_off_) } }; mutable_buffer{begin_, in_size_ - (capacity_ - in_off_)}}};
} }
inline inline
@@ -74,12 +74,12 @@ prepare(std::size_t size) ->
out_size_ = size; out_size_ = size;
auto const out_off = (in_off_ + in_size_) % capacity_; auto const out_off = (in_off_ + in_size_) % capacity_;
if(out_off + out_size_ <= capacity_ ) if(out_off + out_size_ <= capacity_ )
return { return {{
mutable_buffer{ begin_ + out_off, out_size_ }, mutable_buffer{begin_ + out_off, out_size_},
mutable_buffer{ begin_, 0 } }; mutable_buffer{begin_, 0}}};
return { return {{
mutable_buffer{ begin_ + out_off, capacity_ - out_off }, mutable_buffer{begin_ + out_off, capacity_ - out_off},
mutable_buffer{ begin_, out_size_ - (capacity_ - out_off) } }; mutable_buffer{begin_, out_size_ - (capacity_ - out_off)}}};
} }
inline inline