diff --git a/CHANGELOG.md b/CHANGELOG.md index 58eab959..171c3a1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/include/boost/beast/core/flat_static_buffer.hpp b/include/boost/beast/core/flat_static_buffer.hpp index c3bbd223..9c1f6359 100644 --- a/include/boost/beast/core/flat_static_buffer.hpp +++ b/include/boost/beast/core/flat_static_buffer.hpp @@ -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 + 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 diff --git a/include/boost/beast/websocket/impl/read.ipp b/include/boost/beast/websocket/impl/read.ipp index a146832b..88dba0cc 100644 --- a/include/boost/beast/websocket/impl/read.ipp +++ b/include/boost/beast/websocket/impl/read.ipp @@ -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_); diff --git a/include/boost/beast/websocket/impl/write.ipp b/include/boost/beast/websocket/impl/write.ipp index 765462df..12f10bbd 100644 --- a/include/boost/beast/websocket/impl/write.ipp +++ b/include/boost/beast/websocket/impl/write.ipp @@ -341,7 +341,7 @@ operator()( { fh_.fin = fin_; fh_.len = buffer_size(cb_); - ws_.wr_fb_.reset(); + ws_.wr_fb_.clear(); detail::write( 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( 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( 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( 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_;