From dbadb79a75c46d2bedab7649b32ddcffd51446f6 Mon Sep 17 00:00:00 2001 From: Damian Jarek Date: Sun, 21 Apr 2019 00:57:20 +0200 Subject: [PATCH] Silence gcc-8 warning: The warning was caused by a false positive triggered by boost::optional. Reference: https://github.com/boostorg/optional/issues/72 Signed-off-by: Damian Jarek --- CHANGELOG.md | 1 + include/boost/beast/websocket/impl/read.hpp | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30976a3b..8e7f9fd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Version 254: * Fix data race in test::stream::connect * Fix UB in websocket close tests * Fix uninitalized memory use in deflate_stream +* Fix gcc-8 warning in websocket::stream -------------------------------------------------------------------------------- diff --git a/include/boost/beast/websocket/impl/read.hpp b/include/boost/beast/websocket/impl/read.hpp index 8be18e59..96edf845 100644 --- a/include/boost/beast/websocket/impl/read.hpp +++ b/include/boost/beast/websocket/impl/read.hpp @@ -664,21 +664,22 @@ public: auto& impl = *sp; using mutable_buffers_type = typename DynamicBuffer::mutable_buffers_type; - boost::optional mb; BOOST_ASIO_CORO_REENTER(*this) { do { - mb = beast::detail::dynamic_buffer_prepare(b_, - clamp(impl.read_size_hint_db(b_), limit_), - ec, error::buffer_overflow); - if(impl.check_stop_now(ec)) - goto upcall; - // VFALCO TODO use boost::beast::bind_continuation BOOST_ASIO_CORO_YIELD - read_some_op( - std::move(*this), sp, *mb); + { + auto mb = beast::detail::dynamic_buffer_prepare(b_, + clamp(impl.read_size_hint_db(b_), limit_), + ec, error::buffer_overflow); + if(impl.check_stop_now(ec)) + goto upcall; + read_some_op( + std::move(*this), sp, *mb); + } + b_.commit(bytes_transferred); bytes_written_ += bytes_transferred; if(ec)