From 4bbf393e38d32c19df6276a536ebae970f6ee081 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 4 May 2016 11:04:58 -0400 Subject: [PATCH] Tidy up declarations and files: * Adjust formatting * Fix inline namespace warning in main.cpp * Fix streambuf op ambiguous variadic constructor * Rename variables for clarity --- include/beast/http/impl/read.ipp | 2 +- include/beast/impl/streambuf_readstream.ipp | 29 ++++++++++--------- .../beast/websocket/impl/read_frame_op.ipp | 1 + include/beast/websocket/impl/ssl.ipp | 6 ++-- include/beast/websocket/impl/teardown.ipp | 3 +- test/main.cpp | 2 ++ test/sig_wait.hpp | 4 +-- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/include/beast/http/impl/read.ipp b/include/beast/http/impl/read.ipp index 7bd07cfe..0f07bf60 100644 --- a/include/beast/http/impl/read.ipp +++ b/include/beast/http/impl/read.ipp @@ -64,7 +64,7 @@ public: read_op(read_op const&) = default; template - read_op(DeducedHandler&& h, Stream&s, Args&&... args) + read_op(DeducedHandler&& h, Stream& s, Args&&... args) : d_(std::allocate_shared(alloc_type{h}, std::forward(h), s, std::forward(args)...)) diff --git a/include/beast/impl/streambuf_readstream.ipp b/include/beast/impl/streambuf_readstream.ipp index 6de6d212..679cf5bb 100644 --- a/include/beast/impl/streambuf_readstream.ipp +++ b/include/beast/impl/streambuf_readstream.ipp @@ -26,16 +26,16 @@ class streambuf_readstream< struct data { - streambuf_readstream& brs; + streambuf_readstream& srs; MutableBufferSequence bs; Handler h; int state = 0; template data(DeducedHandler&& h_, - streambuf_readstream& brs_, + streambuf_readstream& srs_, MutableBufferSequence const& bs_) - : brs(brs_) + : srs(srs_) , bs(bs_) , h(std::forward(h_)) { @@ -49,9 +49,10 @@ public: read_some_op(read_some_op const&) = default; template - read_some_op(DeducedHandler&& h, Args&&... args) + read_some_op(DeducedHandler&& h, + streambuf_readstream& srs, Args&&... args) : d_(std::allocate_shared(alloc_type{h}, - std::forward(h), + std::forward(h), srs, std::forward(args)...)) { (*this)(error_code{}, 0); @@ -106,44 +107,44 @@ read_some_op::operator()( switch(d.state) { case 0: - if(d.brs.sb_.size() == 0) + if(d.srs.sb_.size() == 0) { d.state = - d.brs.size_ > 0 ? 2 : 1; + d.srs.size_ > 0 ? 2 : 1; break; } d.state = 4; - d.brs.get_io_service().post( + d.srs.get_io_service().post( bind_handler(std::move(*this), ec, 0)); return; case 1: // read (unbuffered) d.state = 99; - d.brs.next_layer_.async_read_some( + d.srs.next_layer_.async_read_some( d.bs, std::move(*this)); return; case 2: // read d.state = 3; - d.brs.next_layer_.async_read_some( - d.brs.sb_.prepare(d.brs.size_), + d.srs.next_layer_.async_read_some( + d.srs.sb_.prepare(d.srs.size_), std::move(*this)); return; // got data case 3: d.state = 4; - d.brs.sb_.commit(bytes_transferred); + d.srs.sb_.commit(bytes_transferred); break; // copy case 4: bytes_transferred = boost::asio::buffer_copy( - d.bs, d.brs.sb_.data()); - d.brs.sb_.consume(bytes_transferred); + d.bs, d.srs.sb_.data()); + d.srs.sb_.consume(bytes_transferred); // call handler d.state = 99; break; diff --git a/include/beast/websocket/impl/read_frame_op.ipp b/include/beast/websocket/impl/read_frame_op.ipp index c4dbd225..33acc90f 100644 --- a/include/beast/websocket/impl/read_frame_op.ipp +++ b/include/beast/websocket/impl/read_frame_op.ipp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/include/beast/websocket/impl/ssl.ipp b/include/beast/websocket/impl/ssl.ipp index 54951b85..5dd93b04 100644 --- a/include/beast/websocket/impl/ssl.ipp +++ b/include/beast/websocket/impl/ssl.ipp @@ -60,11 +60,9 @@ public: template explicit teardown_ssl_op( - DeducedHandler&& h, - stream_type& stream) + DeducedHandler&& h, stream_type& stream) : d_(std::make_shared( - std::forward(h), - stream)) + std::forward(h), stream)) { (*this)(error_code{}, false); } diff --git a/include/beast/websocket/impl/teardown.ipp b/include/beast/websocket/impl/teardown.ipp index 61c700f9..4997842c 100644 --- a/include/beast/websocket/impl/teardown.ipp +++ b/include/beast/websocket/impl/teardown.ipp @@ -32,8 +32,7 @@ class teardown_tcp_op int state = 0; template - data(DeducedHandler&& h_, - socket_type& socket_) + data(DeducedHandler&& h_, socket_type& socket_) : socket(socket_) , h(std::forward(h_)) , cont(boost_asio_handler_cont_helpers:: diff --git a/test/main.cpp b/test/main.cpp index abc6bb99..fd985f3f 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -41,6 +41,8 @@ namespace beast { namespace detail { + +inline namespace unit_test { std::string diff --git a/test/sig_wait.hpp b/test/sig_wait.hpp index a687b712..9efd3a78 100644 --- a/test/sig_wait.hpp +++ b/test/sig_wait.hpp @@ -17,8 +17,8 @@ */ //============================================================================== -#ifndef BEAST_TEST_SIG_WAIT_H_INCLUDED -#define BEAST_TEST_SIG_WAIT_H_INCLUDED +#ifndef BEAST_TEST_SIG_WAIT_HPP +#define BEAST_TEST_SIG_WAIT_HPP #include #include