diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a6a150..06ee5a94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Version 62: * Add server-framework tests * Doc fixes and tidy * Tidy up namespaces in examples +* Clear the error faster -------------------------------------------------------------------------------- diff --git a/extras/beast/test/fail_counter.hpp b/extras/beast/test/fail_counter.hpp index 29a601ef..8c577cbe 100644 --- a/extras/beast/test/fail_counter.hpp +++ b/extras/beast/test/fail_counter.hpp @@ -149,7 +149,7 @@ public: ec = ec_; return true; } - ec = {}; + ec.assign(0, ec.category()); return false; } }; diff --git a/extras/beast/test/pipe_stream.hpp b/extras/beast/test/pipe_stream.hpp index 8d1a019f..b4069024 100644 --- a/extras/beast/test/pipe_stream.hpp +++ b/extras/beast/test/pipe_stream.hpp @@ -196,7 +196,7 @@ public: teardown(websocket::teardown_tag, stream&, boost::system::error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } template @@ -368,7 +368,7 @@ read_some(MutableBufferSequence const& buffers, std::size_t bytes_transferred; if(in_.b.size() > 0) { - ec = {}; + ec.assign(0, ec.category()); bytes_transferred = buffer_copy( buffers, in_.b.data(), read_max_); in_.b.consume(bytes_transferred); @@ -480,7 +480,7 @@ write_some( else out_.cv.notify_all(); ++nwrite; - ec = {}; + ec.assign(0, ec.category()); return bytes_transferred; } diff --git a/extras/beast/test/string_iostream.hpp b/extras/beast/test/string_iostream.hpp index 77a634bd..d735d59c 100644 --- a/extras/beast/test/string_iostream.hpp +++ b/extras/beast/test/string_iostream.hpp @@ -73,7 +73,7 @@ public: buffers, buffer_prefix(read_max_, cb_)); if(n > 0) { - ec = {}; + ec.assign(0, ec.category()); cb_ = cb_ + n; } else @@ -119,7 +119,7 @@ public: write_some( ConstBufferSequence const& buffers, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); using boost::asio::buffer_size; using boost::asio::buffer_cast; auto const n = buffer_size(buffers); @@ -151,7 +151,7 @@ public: string_iostream& stream, boost::system::error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } template diff --git a/extras/beast/test/string_istream.hpp b/extras/beast/test/string_istream.hpp index 86f1af52..2e610f79 100644 --- a/extras/beast/test/string_istream.hpp +++ b/extras/beast/test/string_istream.hpp @@ -70,7 +70,7 @@ public: buffers, cb_, read_max_); if(n > 0) { - ec = {}; + ec.assign(0, ec.category()); cb_ = cb_ + n; } else @@ -116,7 +116,7 @@ public: write_some(ConstBufferSequence const& buffers, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); return boost::asio::buffer_size(buffers); } @@ -139,7 +139,7 @@ public: string_istream& stream, boost::system::error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } template diff --git a/extras/beast/test/string_ostream.hpp b/extras/beast/test/string_ostream.hpp index 7a44fb49..530d623a 100644 --- a/extras/beast/test/string_ostream.hpp +++ b/extras/beast/test/string_ostream.hpp @@ -93,7 +93,7 @@ public: write_some( ConstBufferSequence const& buffers, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); using boost::asio::buffer_size; using boost::asio::buffer_cast; auto const n = @@ -127,7 +127,7 @@ public: string_ostream& stream, boost::system::error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } template diff --git a/include/beast/core/impl/buffered_read_stream.ipp b/include/beast/core/impl/buffered_read_stream.ipp index 428db15a..725c8db0 100644 --- a/include/beast/core/impl/buffered_read_stream.ipp +++ b/include/beast/core/impl/buffered_read_stream.ipp @@ -227,7 +227,7 @@ read_some(MutableBufferSequence const& buffers, } else { - ec = {}; + ec.assign(0, ec.category()); } auto bytes_transferred = buffer_copy(buffers, sb_.data()); diff --git a/include/beast/http/buffer_body.hpp b/include/beast/http/buffer_body.hpp index 4de08315..485e87df 100644 --- a/include/beast/http/buffer_body.hpp +++ b/include/beast/http/buffer_body.hpp @@ -112,7 +112,7 @@ struct buffer_body void init(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } boost::optional< @@ -128,13 +128,13 @@ struct buffer_body } else { - ec = {}; + ec.assign(0, ec.category()); } return boost::none; } if(body_.data) { - ec = {}; + ec.assign(0, ec.category()); toggle_ = true; return {{const_buffers_type{ body_.data, body_.size}, body_.more}}; @@ -142,14 +142,14 @@ struct buffer_body if(body_.more) ec = error::need_buffer; else - ec = {}; + ec.assign(0, ec.category()); return boost::none; } void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif @@ -173,7 +173,7 @@ struct buffer_body void init(boost::optional, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } template @@ -189,7 +189,7 @@ struct buffer_body ec = error::need_buffer; return; } - ec = {}; + ec.assign(0, ec.category()); auto const bytes_transferred = buffer_copy(boost::asio::buffer( body_.data, body_.size), buffers); @@ -201,7 +201,7 @@ struct buffer_body void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif diff --git a/include/beast/http/detail/basic_parser.hpp b/include/beast/http/detail/basic_parser.hpp index dd9018f9..ed1fd9be 100644 --- a/include/beast/http/detail/basic_parser.hpp +++ b/include/beast/http/detail/basic_parser.hpp @@ -389,14 +389,14 @@ protected: { if(it == last) { - ec = {}; + ec.assign(0, ec.category()); return nullptr; } if(*it == '\r') { if(++it == last) { - ec = {}; + ec.assign(0, ec.category()); return nullptr; } if(*it != '\n') @@ -404,7 +404,7 @@ protected: ec = error::bad_line_ending; return nullptr; } - ec = {}; + ec.assign(0, ec.category()); return ++it; } // VFALCO Should we handle the legacy case @@ -425,14 +425,14 @@ protected: { if(it == last) { - ec = {}; + ec.assign(0, ec.category()); return nullptr; } if(*it == '\r') { if(++it == last) { - ec = {}; + ec.assign(0, ec.category()); return nullptr; } if(*it != '\n') @@ -442,7 +442,7 @@ protected: } if(++it == last) { - ec = {}; + ec.assign(0, ec.category()); return nullptr; } if(*it != '\r') @@ -452,7 +452,7 @@ protected: } if(++it == last) { - ec = {}; + ec.assign(0, ec.category()); return nullptr; } if(*it != '\n') @@ -460,7 +460,7 @@ protected: ec = error::bad_line_ending; return nullptr; } - ec = {}; + ec.assign(0, ec.category()); return ++it; } // VFALCO Should we handle the legacy case diff --git a/include/beast/http/dynamic_body.hpp b/include/beast/http/dynamic_body.hpp index e6bb94f4..eb4d7586 100644 --- a/include/beast/http/dynamic_body.hpp +++ b/include/beast/http/dynamic_body.hpp @@ -61,20 +61,20 @@ struct basic_dynamic_body void init(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } boost::optional> get(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); return {{body_.data(), false}}; } void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif @@ -100,7 +100,7 @@ struct basic_dynamic_body init(boost::optional< std::uint64_t> const&, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } template @@ -122,14 +122,14 @@ struct basic_dynamic_body ec = error::buffer_overflow; return; } - ec = {}; + ec.assign(0, ec.category()); body_.commit(buffer_copy(*b, buffers)); } void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif diff --git a/include/beast/http/empty_body.hpp b/include/beast/http/empty_body.hpp index 59b31d5d..684cac53 100644 --- a/include/beast/http/empty_body.hpp +++ b/include/beast/http/empty_body.hpp @@ -64,20 +64,20 @@ struct empty_body void init(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } boost::optional> get(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); return boost::none; } void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif @@ -98,7 +98,7 @@ struct empty_body init(boost::optional const&, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } template @@ -112,7 +112,7 @@ struct empty_body void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif diff --git a/include/beast/http/impl/basic_parser.ipp b/include/beast/http/impl/basic_parser.ipp index 73bb48ea..9a76272c 100644 --- a/include/beast/http/impl/basic_parser.ipp +++ b/include/beast/http/impl/basic_parser.ipp @@ -94,7 +94,7 @@ put(ConstBufferSequence const& buffers, auto const last = buffers.end(); if(p == last) { - ec = {}; + ec.assign(0, ec.category()); return 0; } if(std::next(p) == last) @@ -198,7 +198,7 @@ loop: break; case state::complete: - ec = {}; + ec.assign(0, ec.category()); goto done; } if(p < p1 && ! is_done() && eager()) @@ -228,7 +228,7 @@ put_eof(error_code& ec) ec = error::partial_message; return; } - ec = {}; + ec.assign(0, ec.category()); return; } impl().on_complete(ec); @@ -793,7 +793,7 @@ do_field(field f, continue; } } - ec = {}; + ec.assign(0, ec.category()); return; } @@ -832,7 +832,7 @@ do_field(field f, return; } - ec = {}; + ec.assign(0, ec.category()); len_ = v; f_ |= flagContentLength; return; @@ -855,7 +855,7 @@ do_field(field f, return; } - ec = {}; + ec.assign(0, ec.category()); auto const v = token_list{value}; auto const p = std::find_if(v.begin(), v.end(), [&](typename token_list::value_type const& s) @@ -874,12 +874,12 @@ do_field(field f, // Upgrade if(f == field::upgrade) { - ec = {}; + ec.assign(0, ec.category()); f_ |= flagUpgrade; return; } - ec = {}; + ec.assign(0, ec.category()); } } // http diff --git a/include/beast/http/impl/read.ipp b/include/beast/http/impl/read.ipp index b0108719..04885a25 100644 --- a/include/beast/http/impl/read.ipp +++ b/include/beast/http/impl/read.ipp @@ -121,7 +121,7 @@ operator()(error_code ec, std::size_t bytes_transferred) if(p_.got_some()) { // caller sees EOF on next read - ec = {}; + ec.assign(0, ec.category()); p_.put_eof(ec); if(ec) goto upcall; @@ -139,7 +139,7 @@ operator()(error_code ec, std::size_t bytes_transferred) b_.consume(p_.put(b_.data(), ec)); if(! ec || ec != http::error::need_more) goto do_upcall; - ec = {}; + ec.assign(0, ec.category()); do_read: try @@ -570,7 +570,7 @@ read_header( parser.eager(false); if(parser.is_header_done()) { - ec = {}; + ec.assign(0, ec.category()); return; } do @@ -649,7 +649,7 @@ read( parser.eager(true); if(parser.is_done()) { - ec = {}; + ec.assign(0, ec.category()); return; } do diff --git a/include/beast/http/impl/write.ipp b/include/beast/http/impl/write.ipp index bcfb4ab2..287f6b31 100644 --- a/include/beast/http/impl/write.ipp +++ b/include/beast/http/impl/write.ipp @@ -56,7 +56,7 @@ class write_some_op operator()(error_code& ec, ConstBufferSequence const& buffer) { - ec = {}; + ec.assign(0, ec.category()); invoked = true; return op_.s_.async_write_some( buffer, std::move(op_)); @@ -213,7 +213,7 @@ class write_op operator()(error_code& ec, ConstBufferSequence const& buffer) { - ec = {}; + ec.assign(0, ec.category()); invoked = true; return op_.s_.async_write_some( buffer, std::move(op_)); @@ -537,7 +537,7 @@ write_some(SyncWriteStream& stream, serializer< detail::write_some_lambda f{stream}; if(sr.is_done()) { - ec = {}; + ec.assign(0, ec.category()); return; } sr.get(ec, f); @@ -609,7 +609,7 @@ write_header(SyncWriteStream& stream, serializer< sr.split(true); if(sr.is_header_done()) { - ec = {}; + ec.assign(0, ec.category()); return; } detail::write_lambda f{stream}; @@ -680,7 +680,7 @@ write(SyncWriteStream& stream, serializer< sr.split(false); if(sr.is_done()) { - ec = {}; + ec.assign(0, ec.category()); return; } detail::write_lambda f{stream}; @@ -808,7 +808,7 @@ public: operator()(error_code& ec, ConstBufferSequence const& buffers) const { - ec = {}; + ec.assign(0, ec.category()); if(os_.fail()) return; std::size_t bytes_transferred = 0; @@ -868,7 +868,7 @@ operator<<(std::ostream& os, if(os.fail()) break; if(ec == error::end_of_stream) - ec = {}; + ec.assign(0, ec.category()); if(ec) { os.setstate(std::ios::failbit); diff --git a/include/beast/http/parser.hpp b/include/beast/http/parser.hpp index 73af94ac..c6c4ec46 100644 --- a/include/beast/http/parser.hpp +++ b/include/beast/http/parser.hpp @@ -185,7 +185,7 @@ private: on_request(verb method, string_view method_str, string_view target, int version, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); m_.target(target); if(method != verb::unknown) m_.method(method); @@ -199,7 +199,7 @@ private: string_view reason, int version, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); m_.result(code); m_.version = version; m_.reason(reason); @@ -209,14 +209,14 @@ private: on_field(field name, string_view name_string, string_view value, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); m_.insert(name, name_string, value); } void on_header(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void @@ -239,7 +239,7 @@ private: on_chunk(std::uint64_t, string_view, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void @@ -248,7 +248,7 @@ private: if(wr_) wr_->finish(ec); else - ec = {}; + ec.assign(0, ec.category()); } }; diff --git a/include/beast/http/string_body.hpp b/include/beast/http/string_body.hpp index eaccc9dc..faee6943 100644 --- a/include/beast/http/string_body.hpp +++ b/include/beast/http/string_body.hpp @@ -63,13 +63,13 @@ struct string_body void init(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } boost::optional> get(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); return {{const_buffers_type{ body_.data(), body_.size()}, false}}; } @@ -77,7 +77,7 @@ struct string_body void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif @@ -111,7 +111,7 @@ struct string_body errc::not_enough_memory); return; } - ec = {}; + ec.assign(0, ec.category()); body_.reserve(static_cast< std::size_t>(*content_length)); } @@ -135,7 +135,7 @@ struct string_body ec = error::buffer_overflow; return; } - ec = {}; + ec.assign(0, ec.category()); buffer_copy(boost::asio::buffer( &body_[0] + len, n), buffers); } @@ -143,7 +143,7 @@ struct string_body void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif diff --git a/include/beast/http/string_view_body.hpp b/include/beast/http/string_view_body.hpp index 2250694e..de57c48c 100644 --- a/include/beast/http/string_view_body.hpp +++ b/include/beast/http/string_view_body.hpp @@ -64,20 +64,20 @@ struct string_view_body void init(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } boost::optional> get(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); return {{{body_.data(), body_.size()}, false}}; } void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; #endif diff --git a/include/beast/websocket/detail/pmd_extension.hpp b/include/beast/websocket/detail/pmd_extension.hpp index 83cf8d6b..33978257 100644 --- a/include/beast/websocket/detail/pmd_extension.hpp +++ b/include/beast/websocket/detail/pmd_extension.hpp @@ -378,7 +378,7 @@ inflate( if( ec == zlib::error::need_buffers || ec == zlib::error::end_of_stream) { - ec = {}; + ec.assign(0, ec.category()); break; } if(ec) @@ -420,7 +420,7 @@ deflate( return false; BOOST_ASSERT(zs.avail_out == 0); BOOST_ASSERT(zs.total_out == buffer_size(out)); - ec = {}; + ec.assign(0, ec.category()); break; } if(zs.avail_out == 0) @@ -444,7 +444,7 @@ deflate( zo.write(zs, zlib::Flush::block, ec); BOOST_ASSERT(! ec || ec == zlib::error::need_buffers); if(ec == zlib::error::need_buffers) - ec = {}; + ec.assign(0, ec.category()); if(ec) return false; if(zs.avail_out >= 6) @@ -459,7 +459,7 @@ deflate( } } } - ec = {}; + ec.assign(0, ec.category()); out = buffer( buffer_cast(out), zs.total_out); return true; diff --git a/include/beast/websocket/impl/read.ipp b/include/beast/websocket/impl/read.ipp index eeb82f30..9300b931 100644 --- a/include/beast/websocket/impl/read.ipp +++ b/include/beast/websocket/impl/read.ipp @@ -178,7 +178,7 @@ operator()(error_code ec, { // Rationale: // http://stackoverflow.com/questions/25587403/boost-asio-ssl-async-shutdown-always-finishes-with-an-error - ec = {}; + ec.assign(0, ec.category()); } if(! ec) { @@ -960,7 +960,7 @@ do_close: { // Rationale: // http://stackoverflow.com/questions/25587403/boost-asio-ssl-async-shutdown-always-finishes-with-an-error - ec = {}; + ec.assign(0, ec.category()); } failed_ = ec != 0; if(failed_) @@ -975,7 +975,7 @@ do_close: if(ec == boost::asio::error::eof) { // (See above) - ec = {}; + ec.assign(0, ec.category()); } } if(! ec) diff --git a/include/beast/websocket/impl/stream.ipp b/include/beast/websocket/impl/stream.ipp index ce791296..1e185adf 100644 --- a/include/beast/websocket/impl/stream.ipp +++ b/include/beast/websocket/impl/stream.ipp @@ -302,7 +302,7 @@ do_response(http::header const& res, ec = error::handshake_failed; return; } - ec = {}; + ec.assign(0, ec.category()); detail::pmd_offer offer; pmd_read(offer, res); // VFALCO see if offer satisfies pmd_config_, diff --git a/include/beast/zlib/detail/deflate_stream.hpp b/include/beast/zlib/detail/deflate_stream.hpp index 5af73a7d..03fdcd33 100644 --- a/include/beast/zlib/detail/deflate_stream.hpp +++ b/include/beast/zlib/detail/deflate_stream.hpp @@ -997,7 +997,7 @@ doParams(z_params& zs, int level, Strategy strategy, error_code& ec) // Flush the last buffer: doWrite(zs, Flush::block, ec); if(ec == error::need_buffers && pending_ == 0) - ec = {}; + ec.assign(0, ec.category()); } if(level_ != level) { diff --git a/test/http/basic_parser.cpp b/test/http/basic_parser.cpp index 10bbe4a7..5d6ba86c 100644 --- a/test/http/basic_parser.cpp +++ b/test/http/basic_parser.cpp @@ -225,7 +225,7 @@ public: error_code ec; p.put(buffer(s.data(), i), ec); BEAST_EXPECTS(ec == error::need_more, ec.message()); - ec = {}; + ec.assign(0, ec.category()); p.put(boost::asio::buffer(s.data(), s.size()), ec); BEAST_EXPECTS(! ec, ec.message()); BEAST_EXPECT(p.is_done()); @@ -247,7 +247,7 @@ public: error_code ec; p.put(b1, ec); BEAST_EXPECTS(ec == error::need_more, ec.message()); - ec = {}; + ec.assign(0, ec.category()); p.put(buffer_cat(b1, b2), ec); BEAST_EXPECTS(! ec, ec.message()); p.put_eof(ec); diff --git a/test/http/doc_snippets.cpp b/test/http/doc_snippets.cpp index 6605fbca..5fc1bac9 100644 --- a/test/http/doc_snippets.cpp +++ b/test/http/doc_snippets.cpp @@ -213,7 +213,7 @@ print_cxx14(message const& m) sr.get(ec, [&sr](error_code& ec, auto const& buffer) { - ec = {}; + ec.assign(0, ec.category()); std::cout << buffers(buffer); sr.consume(boost::asio::buffer_size(buffer)); }); @@ -240,7 +240,7 @@ struct lambda template void operator()(error_code& ec, ConstBufferSequence const& buffer) const { - ec = {}; + ec.assign(0, ec.category()); std::cout << buffers(buffer); sr.consume(boost::asio::buffer_size(buffer)); } @@ -281,7 +281,7 @@ split_print_cxx14(message const& m) sr.get(ec, [&sr](error_code& ec, auto const& buffer) { - ec = {}; + ec.assign(0, ec.category()); std::cout << buffers(buffer); sr.consume(boost::asio::buffer_size(buffer)); }); @@ -295,7 +295,7 @@ split_print_cxx14(message const& m) sr.get(ec, [&sr](error_code& ec, auto const& buffer) { - ec = {}; + ec.assign(0, ec.category()); std::cout << buffers(buffer); sr.consume(boost::asio::buffer_size(buffer)); }); diff --git a/test/http/parser.cpp b/test/http/parser.cpp index 6a92e46a..a8436718 100644 --- a/test/http/parser.cpp +++ b/test/http/parser.cpp @@ -95,7 +95,7 @@ public: p.put(buffer(s.data(), n), ec); s.remove_prefix(used); if(ec == error::need_more) - ec = {}; + ec.assign(0, ec.category()); if(! BEAST_EXPECTS(! ec, ec.message())) continue; BEAST_EXPECT(! p.is_done()); @@ -256,7 +256,7 @@ public: used = p.put(b.data(), ec); b.consume(used); BEAST_EXPECT(ec == error::need_more); - ec = {}; + ec.assign(0, ec.category()); BEAST_EXPECT(! p.is_done()); ostream(b) << "\r\n"; // final crlf to end message @@ -300,7 +300,7 @@ public: used = p.put(b.data(), ec); BEAST_EXPECTS(ec == error::need_more, ec.message()); b.consume(used); - ec = {}; + ec.assign(0, ec.category()); ostream(b) << "User-Agent: test\r\n" "\r\n"; @@ -321,7 +321,7 @@ public: BEAST_EXPECT(ec == error::need_more); BEAST_EXPECT(! p.got_some()); BEAST_EXPECT(used == 0); - ec = {}; + ec.assign(0, ec.category()); used = p.put(buf("G"), ec); BEAST_EXPECT(ec == error::need_more); BEAST_EXPECT(p.got_some()); diff --git a/test/http/parser_bench.cpp b/test/http/parser_bench.cpp index 438eeb7f..9c5a5a33 100644 --- a/test/http/parser_bench.cpp +++ b/test/http/parser_bench.cpp @@ -168,7 +168,7 @@ public: on_request(verb, string_view, string_view, int, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void @@ -176,34 +176,34 @@ public: string_view, int, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void on_field(field, string_view, string_view, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void on_header(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void on_body(boost::optional const&, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void on_data(string_view, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void @@ -211,13 +211,13 @@ public: string_view, error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } void on_complete(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; diff --git a/test/http/test_parser.hpp b/test/http/test_parser.hpp index 84a0eb19..c45570f8 100644 --- a/test/http/test_parser.hpp +++ b/test/http/test_parser.hpp @@ -59,7 +59,7 @@ public: if(fc_) fc_->fail(ec); else - ec = {}; + ec.assign(0, ec.category()); } void @@ -75,7 +75,7 @@ public: if(fc_) fc_->fail(ec); else - ec = {}; + ec.assign(0, ec.category()); } void @@ -86,7 +86,7 @@ public: if(fc_) fc_->fail(ec); else - ec = {}; + ec.assign(0, ec.category()); } void @@ -96,7 +96,7 @@ public: if(fc_) fc_->fail(ec); else - ec = {}; + ec.assign(0, ec.category()); } void @@ -110,7 +110,7 @@ public: if(fc_) fc_->fail(ec); else - ec = {}; + ec.assign(0, ec.category()); } void @@ -121,7 +121,7 @@ public: if(fc_) fc_->fail(ec); else - ec = {}; + ec.assign(0, ec.category()); } void @@ -132,7 +132,7 @@ public: if(fc_) fc_->fail(ec); else - ec = {}; + ec.assign(0, ec.category()); } void @@ -142,7 +142,7 @@ public: if(fc_) fc_->fail(ec); else - ec = {}; + ec.assign(0, ec.category()); } }; diff --git a/test/http/write.cpp b/test/http/write.cpp index f68b5774..e9fbda6c 100644 --- a/test/http/write.cpp +++ b/test/http/write.cpp @@ -57,13 +57,13 @@ public: void init(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } boost::optional> get(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); return {{const_buffers_type{ body_.data(), body_.size()}, false}}; } @@ -71,7 +71,7 @@ public: void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } }; }; @@ -112,13 +112,13 @@ public: void init(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } boost::optional> get(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); body_.read = true; return get( std::integral_constant{}, @@ -128,7 +128,7 @@ public: void finish(error_code& ec) { - ec = {}; + ec.assign(0, ec.category()); } private: diff --git a/test/server/tests.cpp b/test/server/tests.cpp index 13643447..efd4b456 100644 --- a/test/server/tests.cpp +++ b/test/server/tests.cpp @@ -224,7 +224,7 @@ public: con.shutdown(ec); // VFALCO No idea why we get eof in the normal case if(ec == boost::asio::error::eof) - ec = {}; + ec.assign(0, ec.category()); if(! BEAST_EXPECTS(! ec, ec.message())) return; }