flat_static_buffer improvements (API Change):

* Revise documentation
* Specify exception safety
* Mark more functions noexcept

API Changes:

* flat_static_buffer::reset is deprecated

Actions Required:

* Replace calls to flat_static_buffer::reset with
  flat_static_buffer::clear
This commit is contained in:
Vinnie Falco
2018-12-08 12:20:55 -08:00
parent 3e695d588a
commit 8ea282ee5e
4 changed files with 39 additions and 9 deletions

View File

@@ -3,16 +3,21 @@ Version 198:
* flat_buffer improvements
* multi_buffer improvements
* static_buffer improvements
* flat_static_buffer_improvements
API Changes:
* Files return errc::bad_file_descriptor
* flat_static_buffer::reset is deprecated
Actions Required:
* Callers checking for errc::invalid_argument from calls to
file APIs should check for errc::bad_file_descriptor instead.
* Replace calls to flat_static_buffer::reset with
flat_static_buffer::clear
--------------------------------------------------------------------------------
Version 197:

View File

@@ -81,13 +81,22 @@ public:
void
clear() noexcept;
// VFALCO Deprecate this
#ifdef BOOST_BEAST_ALLOW_DEPRECATED
/// Change the number of readable and writable bytes to zero.
void
reset() noexcept
{
clear();
}
#elif ! BOOST_BEAST_DOXYGEN
template<std::size_t I = 0>
void
reset() noexcept
{
static_assert(sizeof(I) != 0,
BOOST_BEAST_DEPRECATION_STRING);
}
#endif
//--------------------------------------------------------------------------
@@ -154,6 +163,10 @@ public:
sequence.
@throws std::length_error if `size() + n` exceeds `max_size()`.
@par Exception Safety
Strong guarantee.
*/
inline
mutable_buffers_type
@@ -172,6 +185,10 @@ public:
@param n The number of bytes to append. If this number
is greater than the number of writable bytes, all
writable bytes are appended.
@par Exception Safety
No-throw guarantee.
*/
void
commit(std::size_t n) noexcept
@@ -189,6 +206,10 @@ public:
@param n The number of bytes to remove. If this number
is greater than the number of readable bytes, all
readable bytes are removed.
@par Exception Safety
No-throw guarantee.
*/
inline
void
@@ -213,6 +234,10 @@ protected:
@param p A pointer to valid storage of at least `n` bytes.
@param n The number of valid bytes pointed to by `p`.
@par Exception Safety
No-throw guarantee.
*/
inline
void

View File

@@ -63,7 +63,7 @@ do_context_takeover_read(role_type role)
(role == role_type::server &&
pmd_config_.client_no_context_takeover))
{
pmd_->zi.reset();
pmd_->zi.clear();
}
}
@@ -304,7 +304,7 @@ operator()(
if(ws_.ctrl_cb_)
ws_.ctrl_cb_(
frame_type::ping, payload);
ws_.rd_fb_.reset();
ws_.rd_fb_.clear();
ws_.template write_ping<
flat_static_buffer_base>(ws_.rd_fb_,
detail::opcode::pong, payload);
@@ -656,7 +656,7 @@ operator()(
ws_.wr_close_ = true;
// Serialize close frame
ws_.rd_fb_.reset();
ws_.rd_fb_.clear();
ws_.template write_close<
flat_static_buffer_base>(
ws_.rd_fb_, code_);

View File

@@ -341,7 +341,7 @@ operator()(
{
fh_.fin = fin_;
fh_.len = buffer_size(cb_);
ws_.wr_fb_.reset();
ws_.wr_fb_.clear();
detail::write<flat_static_buffer_base>(
ws_.wr_fb_, fh_);
ws_.wr_cont_ = ! fin_;
@@ -366,7 +366,7 @@ operator()(
fh_.len = n;
remain_ -= n;
fh_.fin = fin_ ? remain_ == 0 : false;
ws_.wr_fb_.reset();
ws_.wr_fb_.clear();
detail::write<flat_static_buffer_base>(
ws_.wr_fb_, fh_);
ws_.wr_cont_ = ! fin_;
@@ -409,7 +409,7 @@ operator()(
fh_.len = remain_;
fh_.key = ws_.create_mask();
detail::prepare_key(key_, fh_.key);
ws_.wr_fb_.reset();
ws_.wr_fb_.clear();
detail::write<flat_static_buffer_base>(
ws_.wr_fb_, fh_);
n = clamp(remain_, ws_.wr_buf_size_);
@@ -466,7 +466,7 @@ operator()(
ws_.wr_buf_.get(), n), cb_);
detail::mask_inplace(buffer(
ws_.wr_buf_.get(), n), key_);
ws_.wr_fb_.reset();
ws_.wr_fb_.clear();
detail::write<flat_static_buffer_base>(
ws_.wr_fb_, fh_);
ws_.wr_cont_ = ! fin_;
@@ -529,7 +529,7 @@ operator()(
}
fh_.fin = ! more_;
fh_.len = n;
ws_.wr_fb_.reset();
ws_.wr_fb_.clear();
detail::write<
flat_static_buffer_base>(ws_.wr_fb_, fh_);
ws_.wr_cont_ = ! fin_;