Restyle sources

This commit is contained in:
Vinnie Falco
2016-08-26 08:01:44 -04:00
parent 9c11d3fc33
commit c17f467601
44 changed files with 173 additions and 173 deletions

View File

@@ -160,7 +160,7 @@ private:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, write_op* op) void asio_handler_invoke(Function&& f, write_op* op)
{ {

View File

@@ -26,7 +26,7 @@ public:
amount (amount const&) = default; amount (amount const&) = default;
amount& operator= (amount const&) = delete; amount& operator= (amount const&) = delete;
template <class = void> template<class = void>
amount (std::size_t n, std::string const& what); amount (std::size_t n, std::string const& what);
friend friend
@@ -34,7 +34,7 @@ public:
operator<< (std::ostream& s, amount const& t); operator<< (std::ostream& s, amount const& t);
}; };
template <class> template<class>
amount::amount (std::size_t n, std::string const& what) amount::amount (std::size_t n, std::string const& what)
: n_ (n) : n_ (n)
, what_ (what) , what_ (what)

View File

@@ -16,7 +16,7 @@ namespace detail {
The interface allows for limited read only operations. Derived classes The interface allows for limited read only operations. Derived classes
provide additional behavior. provide additional behavior.
*/ */
template <class Container> template<class Container>
class const_container class const_container
{ {
private: private:

View File

@@ -33,7 +33,7 @@ static
std::string std::string
prefix(suite_info const& s) prefix(suite_info const& s)
{ {
if (s.manual()) if(s.manual())
return "|M| "; return "|M| ";
return " "; return " ";
} }
@@ -121,7 +121,7 @@ int main(int ac, char const* av[])
match_auto(suites)); match_auto(suites));
else else
failed = r.run_each(global_suites()); failed = r.run_each(global_suites());
if (failed) if(failed)
return EXIT_FAILURE; return EXIT_FAILURE;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@@ -45,27 +45,27 @@ private:
std::string library_; std::string library_;
public: public:
template <class = void> template<class = void>
explicit explicit
selector (mode_t mode, std::string const& pattern = ""); selector (mode_t mode, std::string const& pattern = "");
template <class = void> template<class = void>
bool bool
operator() (suite_info const& s); operator() (suite_info const& s);
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class> template<class>
selector::selector (mode_t mode, std::string const& pattern) selector::selector (mode_t mode, std::string const& pattern)
: mode_ (mode) : mode_ (mode)
, pat_ (pattern) , pat_ (pattern)
{ {
if (mode_ == automatch && pattern.empty()) if(mode_ == automatch && pattern.empty())
mode_ = all; mode_ = all;
} }
template <class> template<class>
bool bool
selector::operator() (suite_info const& s) selector::operator() (suite_info const& s)
{ {
@@ -73,14 +73,14 @@ selector::operator() (suite_info const& s)
{ {
case automatch: case automatch:
// suite or full name // suite or full name
if (s.name() == pat_ || s.full_name() == pat_) if(s.name() == pat_ || s.full_name() == pat_)
{ {
mode_ = none; mode_ = none;
return true; return true;
} }
// check module // check module
if (pat_ == s.module()) if(pat_ == s.module())
{ {
mode_ = module; mode_ = module;
library_ = s.library(); library_ = s.library();
@@ -88,7 +88,7 @@ selector::operator() (suite_info const& s)
} }
// check library // check library
if (pat_ == s.library()) if(pat_ == s.library())
{ {
mode_ = library; mode_ = library;
return ! s.manual(); return ! s.manual();

View File

@@ -60,7 +60,7 @@ private:
void void
on_case_end() override on_case_end() override
{ {
if (m_case.tests.size() > 0) if(m_case.tests.size() > 0)
m_suite.insert (std::move (m_case)); m_suite.insert (std::move (m_case));
} }

View File

@@ -157,7 +157,7 @@ results::add(suite_results const& r)
cases += r.cases; cases += r.cases;
failed += r.failed; failed += r.failed;
auto const elapsed = clock_type::now() - r.start; auto const elapsed = clock_type::now() - r.start;
if (elapsed >= std::chrono::seconds{1}) if(elapsed >= std::chrono::seconds{1})
{ {
auto const iter = std::lower_bound(top.begin(), auto const iter = std::lower_bound(top.begin(),
top.end(), elapsed, top.end(), elapsed,
@@ -166,13 +166,13 @@ results::add(suite_results const& r)
{ {
return t1.second > t2; return t1.second > t2;
}); });
if (iter != top.end()) if(iter != top.end())
{ {
if (top.size() == max_top) if(top.size() == max_top)
top.resize(top.size() - 1); top.resize(top.size() - 1);
top.emplace(iter, r.name, elapsed); top.emplace(iter, r.name, elapsed);
} }
else if (top.size() < max_top) else if(top.size() < max_top)
{ {
top.emplace_back(r.name, elapsed); top.emplace_back(r.name, elapsed);
} }
@@ -214,7 +214,7 @@ reporter<_>::fmtdur(typename clock_type::duration const& d)
{ {
using namespace std::chrono; using namespace std::chrono;
auto const ms = duration_cast<milliseconds>(d); auto const ms = duration_cast<milliseconds>(d);
if (ms < seconds{1}) if(ms < seconds{1})
return std::to_string(ms.count()) + "ms"; return std::to_string(ms.count()) + "ms";
std::stringstream ss; std::stringstream ss;
ss << std::fixed << std::setprecision(1) << ss << std::fixed << std::setprecision(1) <<

View File

@@ -46,7 +46,7 @@ private:
std::size_t failed_; std::size_t failed_;
public: public:
tests_t () tests_t()
: failed_ (0) : failed_ (0)
{ {
} }

View File

@@ -68,7 +68,7 @@ public:
must be convertible to `suite_info`. must be convertible to `suite_info`.
@return `true` if any conditions failed. @return `true` if any conditions failed.
*/ */
template <class FwdIter> template<class FwdIter>
bool bool
run (FwdIter first, FwdIter last); run (FwdIter first, FwdIter last);
@@ -79,14 +79,14 @@ public:
@endcode @endcode
@return `true` if any conditions failed. @return `true` if any conditions failed.
*/ */
template <class FwdIter, class Pred> template<class FwdIter, class Pred>
bool bool
run_if (FwdIter first, FwdIter last, Pred pred = Pred{}); run_if(FwdIter first, FwdIter last, Pred pred = Pred{});
/** Run all suites in a container. /** Run all suites in a container.
@return `true` if any conditions failed. @return `true` if any conditions failed.
*/ */
template <class SequenceContainer> template<class SequenceContainer>
bool bool
run_each (SequenceContainer const& c); run_each (SequenceContainer const& c);
@@ -97,9 +97,9 @@ public:
@endcode @endcode
@return `true` if any conditions failed. @return `true` if any conditions failed.
*/ */
template <class SequenceContainer, class Pred> template<class SequenceContainer, class Pred>
bool bool
run_each_if (SequenceContainer const& c, Pred pred = Pred{}); run_each_if(SequenceContainer const& c, Pred pred = Pred{});
protected: protected:
// //
@@ -159,26 +159,26 @@ private:
friend class suite; friend class suite;
// Start a new testcase. // Start a new testcase.
template <class = void> template<class = void>
void void
testcase (std::string const& name); testcase (std::string const& name);
template <class = void> template<class = void>
void void
pass(); pass();
template <class = void> template<class = void>
void void
fail (std::string const& reason); fail (std::string const& reason);
template <class = void> template<class = void>
void void
log (std::string const& s); log (std::string const& s);
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class> template<class>
bool bool
runner::run (suite_info const& s) runner::run (suite_info const& s)
{ {
@@ -194,49 +194,49 @@ runner::run (suite_info const& s)
return failed_; return failed_;
} }
template <class FwdIter> template<class FwdIter>
bool bool
runner::run (FwdIter first, FwdIter last) runner::run (FwdIter first, FwdIter last)
{ {
bool failed (false); bool failed (false);
for (;first != last; ++first) for(;first != last; ++first)
failed = run (*first) || failed; failed = run (*first) || failed;
return failed; return failed;
} }
template <class FwdIter, class Pred> template<class FwdIter, class Pred>
bool bool
runner::run_if (FwdIter first, FwdIter last, Pred pred) runner::run_if(FwdIter first, FwdIter last, Pred pred)
{ {
bool failed (false); bool failed (false);
for (;first != last; ++first) for(;first != last; ++first)
if (pred (*first)) if(pred (*first))
failed = run (*first) || failed; failed = run (*first) || failed;
return failed; return failed;
} }
template <class SequenceContainer> template<class SequenceContainer>
bool bool
runner::run_each (SequenceContainer const& c) runner::run_each (SequenceContainer const& c)
{ {
bool failed (false); bool failed (false);
for (auto const& s : c) for(auto const& s : c)
failed = run (s) || failed; failed = run (s) || failed;
return failed; return failed;
} }
template <class SequenceContainer, class Pred> template<class SequenceContainer, class Pred>
bool bool
runner::run_each_if (SequenceContainer const& c, Pred pred) runner::run_each_if(SequenceContainer const& c, Pred pred)
{ {
bool failed (false); bool failed (false);
for (auto const& s : c) for(auto const& s : c)
if (pred (s)) if(pred (s))
failed = run (s) || failed; failed = run (s) || failed;
return failed; return failed;
} }
template <class> template<class>
void void
runner::testcase (std::string const& name) runner::testcase (std::string const& name)
{ {
@@ -245,42 +245,42 @@ runner::testcase (std::string const& name)
assert (default_ || ! name.empty()); assert (default_ || ! name.empty());
// Forgot to call pass or fail // Forgot to call pass or fail
assert (default_ || cond_); assert (default_ || cond_);
if (! default_) if(! default_)
on_case_end(); on_case_end();
default_ = false; default_ = false;
cond_ = false; cond_ = false;
on_case_begin (name); on_case_begin (name);
} }
template <class> template<class>
void void
runner::pass() runner::pass()
{ {
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
if (default_) if(default_)
testcase (""); testcase ("");
on_pass(); on_pass();
cond_ = true; cond_ = true;
} }
template <class> template<class>
void void
runner::fail (std::string const& reason) runner::fail (std::string const& reason)
{ {
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
if (default_) if(default_)
testcase (""); testcase ("");
on_fail (reason); on_fail (reason);
failed_ = true; failed_ = true;
cond_ = true; cond_ = true;
} }
template <class> template<class>
void void
runner::log (std::string const& s) runner::log (std::string const& s)
{ {
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
if (default_) if(default_)
testcase (""); testcase ("");
on_log (s); on_log (s);
} }

View File

@@ -127,7 +127,7 @@ private:
scoped_testcase scoped_testcase
operator()(abort_t abort); operator()(abort_t abort);
template <class T> template<class T>
scoped_testcase scoped_testcase
operator<<(T const& t); operator<<(T const& t);
}; };
@@ -187,11 +187,11 @@ public:
/** Expect an exception from f() */ /** Expect an exception from f() */
/** @{ */ /** @{ */
template <class F, class String> template<class F, class String>
bool bool
except (F&& f, String const& reason); except (F&& f, String const& reason);
template <class F> template<class F>
bool bool
except (F&& f) except (F&& f)
{ {
@@ -201,11 +201,11 @@ public:
/** Expect an exception of the given type from f() */ /** Expect an exception of the given type from f() */
/** @{ */ /** @{ */
template <class E, class F, class String> template<class E, class F, class String>
bool bool
except (F&& f, String const& reason); except (F&& f, String const& reason);
template <class E, class F> template<class E, class F>
bool bool
except (F&& f) except (F&& f)
{ {
@@ -215,11 +215,11 @@ public:
/** Fail if f() throws */ /** Fail if f() throws */
/** @{ */ /** @{ */
template <class F, class String> template<class F, class String>
bool bool
unexcept (F&& f, String const& reason); unexcept (F&& f, String const& reason);
template <class F> template<class F>
bool bool
unexcept (F&& f) unexcept (F&& f)
{ {
@@ -236,12 +236,12 @@ public:
// DEPRECATED // DEPRECATED
// @return `true` if the test condition indicates success (a false value) // @return `true` if the test condition indicates success (a false value)
template <class Condition, class String> template<class Condition, class String>
bool bool
unexpected (Condition shouldBeFalse, unexpected (Condition shouldBeFalse,
String const& reason); String const& reason);
template <class Condition> template<class Condition>
bool bool
unexpected (Condition shouldBeFalse) unexpected (Condition shouldBeFalse)
{ {
@@ -249,12 +249,12 @@ public:
} }
/** Record a successful test condition. */ /** Record a successful test condition. */
template <class = void> template<class = void>
void void
pass(); pass();
/** Record a failure. */ /** Record a failure. */
template <class = void> template<class = void>
void void
fail (std::string const& reason = ""); fail (std::string const& reason = "");
@@ -277,7 +277,7 @@ private:
void void
propagate_abort(); propagate_abort();
template <class = void> template<class = void>
void void
run (runner& r); run (runner& r);
}; };
@@ -375,7 +375,7 @@ suite::operator()(runner& r)
} }
} }
template <class Condition, class String> template<class Condition, class String>
inline inline
bool bool
suite::expect(Condition const& shouldBeTrue, suite::expect(Condition const& shouldBeTrue,
@@ -390,7 +390,7 @@ suite::expect(Condition const& shouldBeTrue,
return false; return false;
} }
template <class F, class String> template<class F, class String>
bool bool
suite::except (F&& f, String const& reason) suite::except (F&& f, String const& reason)
{ {
@@ -407,7 +407,7 @@ suite::except (F&& f, String const& reason)
return true; return true;
} }
template <class E, class F, class String> template<class E, class F, class String>
bool bool
suite::except (F&& f, String const& reason) suite::except (F&& f, String const& reason)
{ {
@@ -424,7 +424,7 @@ suite::except (F&& f, String const& reason)
return true; return true;
} }
template <class F, class String> template<class F, class String>
bool bool
suite::unexcept (F&& f, String const& reason) suite::unexcept (F&& f, String const& reason)
{ {
@@ -441,7 +441,7 @@ suite::unexcept (F&& f, String const& reason)
return false; return false;
} }
template <class Condition, class String> template<class Condition, class String>
inline inline
bool bool
suite::unexpected (Condition shouldBeFalse, suite::unexpected (Condition shouldBeFalse,
@@ -449,14 +449,14 @@ suite::unexpected (Condition shouldBeFalse,
{ {
bool const b = bool const b =
static_cast<bool>(shouldBeFalse); static_cast<bool>(shouldBeFalse);
if (! b) if(! b)
pass(); pass();
else else
fail (reason); fail (reason);
return ! b; return ! b;
} }
template <class> template<class>
void void
suite::pass() suite::pass()
{ {
@@ -464,13 +464,13 @@ suite::pass()
runner_->pass(); runner_->pass();
} }
template <class> template<class>
void void
suite::fail (std::string const& reason) suite::fail (std::string const& reason)
{ {
propagate_abort(); propagate_abort();
runner_->fail (reason); runner_->fail (reason);
if (abort_) if(abort_)
{ {
aborted_ = true; aborted_ = true;
throw abort_exception(); throw abort_exception();
@@ -481,11 +481,11 @@ inline
void void
suite::propagate_abort() suite::propagate_abort()
{ {
if (abort_ && aborted_) if(abort_ && aborted_)
throw abort_exception(); throw abort_exception();
} }
template <class> template<class>
void void
suite::run (runner& r) suite::run (runner& r)
{ {

View File

@@ -33,7 +33,7 @@ public:
The suite must not already exist. The suite must not already exist.
*/ */
template <class Suite> template<class Suite>
void void
insert( insert(
char const* name, char const* name,
@@ -44,7 +44,7 @@ public:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class Suite> template<class Suite>
void void
suite_list::insert( suite_list::insert(
char const* name, char const* name,

View File

@@ -44,7 +44,7 @@ public:
return *this; return *this;
} }
template <class F, class... Args> template<class F, class... Args>
explicit explicit
thread (suite& s, F&& f, Args&&... args) thread (suite& s, F&& f, Args&&... args)
: s_ (&s) : s_ (&s)

View File

@@ -47,7 +47,7 @@ namespace beast {
@note See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3896.pdf"> @note See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3896.pdf">
Library Foundations For Asynchronous Operations</a> Library Foundations For Asynchronous Operations</a>
*/ */
template <class CompletionHandler, class Signature> template<class CompletionHandler, class Signature>
struct async_completion struct async_completion
{ {
/** The type of the final handler called by the asynchronous initiation function. /** The type of the final handler called by the asynchronous initiation function.

View File

@@ -44,7 +44,7 @@ namespace detail {
*/ */
template <class = void> template<class = void>
std::string const& std::string const&
base64_alphabet() base64_alphabet()
{ {
@@ -62,7 +62,7 @@ is_base64(unsigned char c)
return (std::isalnum(c) || (c == '+') || (c == '/')); return (std::isalnum(c) || (c == '+') || (c == '/'));
} }
template <class = void> template<class = void>
std::string std::string
base64_encode (std::uint8_t const* data, base64_encode (std::uint8_t const* data,
std::size_t in_len) std::size_t in_len)
@@ -112,7 +112,7 @@ base64_encode (std::uint8_t const* data,
} }
template <class = void> template<class = void>
std::string std::string
base64_encode (std::string const& s) base64_encode (std::string const& s)
{ {
@@ -120,7 +120,7 @@ base64_encode (std::string const& s)
std::uint8_t const*> (s.data()), s.size()); std::uint8_t const*> (s.data()), s.size());
} }
template <class = void> template<class = void>
std::string std::string
base64_decode(std::string const& data) base64_decode(std::string const& data)
{ {

View File

@@ -54,14 +54,14 @@ public:
operator()() operator()()
{ {
invoke(h_, args_, invoke(h_, args_,
index_sequence_for<Args...> ()); index_sequence_for<Args...>());
} }
void void
operator()() const operator()() const
{ {
invoke(h_, args_, invoke(h_, args_,
index_sequence_for<Args...> ()); index_sequence_for<Args...>());
} }
friend friend

View File

@@ -14,7 +14,7 @@
namespace beast { namespace beast {
namespace detail { namespace detail {
template <class T> template<class T>
struct empty_base_optimization_decide struct empty_base_optimization_decide
: std::integral_constant <bool, : std::integral_constant <bool,
std::is_empty <T>::value std::is_empty <T>::value
@@ -25,7 +25,7 @@ struct empty_base_optimization_decide
{ {
}; };
template < template<
class T, class T,
int UniqueID = 0, int UniqueID = 0,
bool ShouldDeriveFrom = bool ShouldDeriveFrom =
@@ -57,7 +57,7 @@ public:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template < template<
class T, class T,
int UniqueID int UniqueID
> >

View File

@@ -13,7 +13,7 @@
namespace beast { namespace beast {
namespace detail { namespace detail {
template <class R, class C, class ...A> template<class R, class C, class ...A>
auto auto
is_call_possible_test(C&& c, int, A&& ...a) is_call_possible_test(C&& c, int, A&& ...a)
-> decltype(std::is_convertible< -> decltype(std::is_convertible<
@@ -21,7 +21,7 @@ is_call_possible_test(C&& c, int, A&& ...a)
std::is_same<R, void>::value, std::is_same<R, void>::value,
std::true_type()); std::true_type());
template <class R, class C, class ...A> template<class R, class C, class ...A>
std::false_type std::false_type
is_call_possible_test(C&& c, long, A&& ...a); is_call_possible_test(C&& c, long, A&& ...a);
@@ -30,13 +30,13 @@ is_call_possible_test(C&& c, long, A&& ...a);
is_call_possible<T, void(std::string)> is_call_possible<T, void(std::string)>
*/ */
/** @{ */ /** @{ */
template <class C, class F> template<class C, class F>
struct is_call_possible struct is_call_possible
: std::false_type : std::false_type
{ {
}; };
template <class C, class R, class ...A> template<class C, class R, class ...A>
struct is_call_possible<C, R(A...)> struct is_call_possible<C, R(A...)>
: decltype(is_call_possible_test<R>( : decltype(is_call_possible_test<R>(
std::declval<C>(), 1, std::declval<A>()...)) std::declval<C>(), 1, std::declval<A>()...))

View File

@@ -281,10 +281,10 @@ finish(sha1_context& ctx, void* digest) noexcept
ctx.buf[ctx.buflen++] = 0x00; ctx.buf[ctx.buflen++] = 0x00;
std::uint32_t block[BLOCK_INTS]; std::uint32_t block[BLOCK_INTS];
sha1::make_block(ctx.buf, block); sha1::make_block(ctx.buf, block);
if (buflen > BLOCK_BYTES - 8) if(buflen > BLOCK_BYTES - 8)
{ {
sha1::transform(ctx.digest, block); sha1::transform(ctx.digest, block);
for (size_t i = 0; i < BLOCK_INTS - 2; i++) for(size_t i = 0; i < BLOCK_INTS - 2; i++)
block[i] = 0; block[i] = 0;
} }

View File

@@ -34,7 +34,7 @@ class has_get_io_service
decltype(std::declval<U>().get_io_service()), decltype(std::declval<U>().get_io_service()),
boost::asio::io_service&>> boost::asio::io_service&>>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
public: public:
using type = decltype(check<T>(0)); using type = decltype(check<T>(0));

View File

@@ -227,7 +227,7 @@ public:
/// Write the given data to the stream. Returns the number of bytes written, /// Write the given data to the stream. Returns the number of bytes written,
/// or 0 if an error occurred. /// or 0 if an error occurred.
template <class ConstBufferSequence> template<class ConstBufferSequence>
std::size_t std::size_t
write_some(ConstBufferSequence const& buffers, write_some(ConstBufferSequence const& buffers,
error_code& ec) error_code& ec)

View File

@@ -34,10 +34,10 @@ namespace beast {
caller is still responsible for freeing memory. caller is still responsible for freeing memory.
*/ */
#if GENERATING_DOCS #if GENERATING_DOCS
template <class T, class CompletionHandler> template<class T, class CompletionHandler>
class handler_alloc; class handler_alloc;
#else #else
template <class T, class CompletionHandler> template<class T, class CompletionHandler>
class handler_alloc class handler_alloc
{ {
private: private:
@@ -46,7 +46,7 @@ private:
// should produce a compile error if CompletionHandler is not // should produce a compile error if CompletionHandler is not
// constructible from H. // constructible from H.
// //
template <class U, class H> template<class U, class H>
friend class handler_alloc; friend class handler_alloc;
CompletionHandler h_; CompletionHandler h_;

View File

@@ -85,7 +85,7 @@ public:
is_continuation(op->d_->h); is_continuation(op->d_->h);
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, read_some_op* op) void asio_handler_invoke(Function&& f, read_some_op* op)
{ {

View File

@@ -482,7 +482,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -501,7 +501,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -520,7 +520,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -539,7 +539,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -557,7 +557,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -575,7 +575,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -594,7 +594,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -613,7 +613,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -630,7 +630,7 @@ private:
decltype(std::declval<T>().on_headers( decltype(std::declval<T>().on_headers(
std::declval<std::uint64_t>(), std::declval<error_code&>()))>> std::declval<std::uint64_t>(), std::declval<error_code&>()))>>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -649,7 +649,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -667,7 +667,7 @@ private:
std::declval<error_code&>()), std::declval<error_code&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:

View File

@@ -29,7 +29,7 @@ class chunk_encode_text
// Storage for the longest hex string we might need, plus delimiters. // Storage for the longest hex string we might need, plus delimiters.
std::array<char, 2 * sizeof(std::size_t) + 2> buf_; std::array<char, 2 * sizeof(std::size_t) + 2> buf_;
template <class OutIter> template<class OutIter>
static static
OutIter OutIter
to_hex(OutIter last, std::size_t n) to_hex(OutIter last, std::size_t n)

View File

@@ -22,7 +22,7 @@ class has_content_length_value
decltype(std::declval<U>().content_length()), decltype(std::declval<U>().content_length()),
std::uint64_t>> std::uint64_t>>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<T>(0)); using type = decltype(check<T>(0));
public: public:

View File

@@ -91,7 +91,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, parse_op* op) void asio_handler_invoke(Function&& f, parse_op* op)
{ {
@@ -277,7 +277,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, read_op* op) void asio_handler_invoke(Function&& f, read_op* op)
{ {

View File

@@ -262,7 +262,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, write_op* op) void asio_handler_invoke(Function&& f, write_op* op)
{ {

View File

@@ -136,12 +136,12 @@ write(DynamicBuffer& db, frame_header const& fh)
if(fh.rsv3) if(fh.rsv3)
b[0] |= 0x10; b[0] |= 0x10;
b[1] = fh.mask ? 0x80 : 0x00; b[1] = fh.mask ? 0x80 : 0x00;
if (fh.len <= 125) if(fh.len <= 125)
{ {
b[1] |= fh.len; b[1] |= fh.len;
n = 2; n = 2;
} }
else if (fh.len <= 65535) else if(fh.len <= 65535)
{ {
b[1] |= 126; b[1] |= 126;
::new(&b[2]) big_uint16_buf_t{ ::new(&b[2]) big_uint16_buf_t{

View File

@@ -131,7 +131,7 @@ utf8_checker_t<_>::write(BufferSequence const& bs)
{ {
using boost::asio::buffer_cast; using boost::asio::buffer_cast;
using boost::asio::buffer_size; using boost::asio::buffer_size;
for (auto const& b : bs) for(auto const& b : bs)
if(! write(buffer_cast<void const*>(b), if(! write(buffer_cast<void const*>(b),
buffer_size(b))) buffer_size(b)))
return false; return false;

View File

@@ -101,7 +101,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, accept_op* op) void asio_handler_invoke(Function&& f, accept_op* op)
{ {

View File

@@ -97,7 +97,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, close_op* op) void asio_handler_invoke(Function&& f, close_op* op)
{ {

View File

@@ -93,7 +93,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, handshake_op* op) void asio_handler_invoke(Function&& f, handshake_op* op)
{ {

View File

@@ -95,7 +95,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, ping_op* op) void asio_handler_invoke(Function&& f, ping_op* op)
{ {

View File

@@ -117,7 +117,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, read_frame_op* op) void asio_handler_invoke(Function&& f, read_frame_op* op)
{ {
@@ -252,7 +252,7 @@ operator()(error_code ec,std::size_t bytes_transferred, bool again)
break; break;
} }
d.state = do_read_fh + 2; d.state = do_read_fh + 2;
if (n == 0) if(n == 0)
{ {
bytes_transferred = 0; bytes_transferred = 0;
break; break;

View File

@@ -88,7 +88,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, read_op* op) void asio_handler_invoke(Function&& f, read_op* op)
{ {

View File

@@ -93,7 +93,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, response_op* op) void asio_handler_invoke(Function&& f, response_op* op)
{ {

View File

@@ -93,7 +93,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, void asio_handler_invoke(Function&& f,
teardown_ssl_op* op) teardown_ssl_op* op)

View File

@@ -80,7 +80,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, void asio_handler_invoke(Function&& f,
teardown_tcp_op* op) teardown_tcp_op* op)

View File

@@ -134,7 +134,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, write_frame_op* op) void asio_handler_invoke(Function&& f, write_frame_op* op)
{ {

View File

@@ -91,7 +91,7 @@ public:
return op->d_->cont; return op->d_->cont;
} }
template <class Function> template<class Function>
friend friend
void asio_handler_invoke(Function&& f, write_op* op) void asio_handler_invoke(Function&& f, write_op* op)
{ {

View File

@@ -17,7 +17,7 @@ class empty_base_optimization_test
: public beast::unit_test::suite : public beast::unit_test::suite
{ {
public: public:
template <class T> template<class T>
class test1 class test1
: private empty_base_optimization<T> : private empty_base_optimization<T>
{ {
@@ -32,7 +32,7 @@ public:
T const& member() const {return Base::member();} T const& member() const {return Base::member();}
}; };
template <class T> template<class T>
class test2 class test2
{ {
void* m_p; void* m_p;
@@ -53,34 +53,34 @@ public:
static static
bool bool
test_one () test_one()
{ {
test1<int> t1(1); test1<int> t1(1);
test2<int> t2(2); test2<int> t2(2);
static_assert(sizeof(t1) == sizeof(t2), "don't optimize for int"); static_assert(sizeof(t1) == sizeof(t2), "don't optimize for int");
if (t1.member() != 1) if(t1.member() != 1)
return false; return false;
if (t2.member() != 2) if(t2.member() != 2)
return false; return false;
return true; return true;
} }
static static
bool bool
test_two () test_two()
{ {
test1<Empty> t1((Empty())); test1<Empty> t1((Empty()));
test2<Empty> t2((Empty())); test2<Empty> t2((Empty()));
static_assert(sizeof(t1) < sizeof(t2), "do optimize for Empty"); static_assert(sizeof(t1) < sizeof(t2), "do optimize for Empty");
if (t1.member() != true) if(t1.member() != true)
return false; return false;
if (t2.member() != true) if(t2.member() != true)
return false; return false;
return true; return true;
} }
void void
run () run()
{ {
BEAST_EXPECT(test_one()); BEAST_EXPECT(test_one());
BEAST_EXPECT(test_two()); BEAST_EXPECT(test_two());

View File

@@ -30,7 +30,7 @@ escaped_string(boost::string_ref const& s)
out.append("\\r"); out.append("\\r");
else if(*p == '\n') else if(*p == '\n')
out.append("\\n"); out.append("\\n");
else if (*p == '\t') else if(*p == '\t')
out.append("\\t"); out.append("\\t");
else else
out.append(p, 1); out.append(p, 1);

View File

@@ -223,7 +223,7 @@ private:
template<class T, class R = template<class T, class R =
decltype(std::declval<T>().on_start(), std::true_type{})> decltype(std::declval<T>().on_start(), std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -253,7 +253,7 @@ private:
std::declval<std::string const&>()), std::declval<std::string const&>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -283,7 +283,7 @@ private:
decltype(std::declval<T>().on_headers_complete( decltype(std::declval<T>().on_headers_complete(
std::declval<error_code&>()), std::true_type{})> std::declval<error_code&>()), std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -314,7 +314,7 @@ private:
std::declval<bool>(), std::declval<bool>()), std::declval<bool>(), std::declval<bool>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -349,7 +349,7 @@ private:
std::declval<bool>(), std::declval<bool>()), std::declval<bool>(), std::declval<bool>()),
std::true_type{})> std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
#if 0 #if 0
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
@@ -389,7 +389,7 @@ private:
std::declval<void const*>(), std::declval<std::size_t>(), std::declval<void const*>(), std::declval<std::size_t>(),
std::declval<error_code&>()), std::true_type{})> std::declval<error_code&>()), std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -418,7 +418,7 @@ private:
template<class T, class R = template<class T, class R =
decltype(std::declval<T>().on_complete(), std::true_type{})> decltype(std::declval<T>().on_complete(), std::true_type{})>
static R check(int); static R check(int);
template <class> template<class>
static std::false_type check(...); static std::false_type check(...);
using type = decltype(check<C>(0)); using type = decltype(check<C>(0));
public: public:
@@ -488,7 +488,7 @@ nodejs_basic_parser<Derived>::write(
using boost::asio::buffer_cast; using boost::asio::buffer_cast;
using boost::asio::buffer_size; using boost::asio::buffer_size;
std::size_t bytes_used = 0; std::size_t bytes_used = 0;
for (auto const& buffer : buffers) for(auto const& buffer : buffers)
{ {
auto const n = write( auto const n = write(
buffer_cast<void const*>(buffer), buffer_cast<void const*>(buffer),
@@ -609,7 +609,7 @@ template<class Derived>
void void
nodejs_basic_parser<Derived>::check_header() nodejs_basic_parser<Derived>::check_header()
{ {
if (! value_.empty()) if(! value_.empty())
{ {
//detail::trim(value_); //detail::trim(value_);
call_on_field(field_, value_, call_on_field(field_, value_,

View File

@@ -29,7 +29,7 @@ public:
{ {
std::array<std::uint8_t, 256> values; std::array<std::uint8_t, 256> values;
std::uint8_t i = 0; std::uint8_t i = 0;
for (auto& c : values) for(auto& c : values)
c = i++; c = i++;
return values; return values;
})(); })();
@@ -39,12 +39,12 @@ public:
BEAST_EXPECT(utf8.finish()); BEAST_EXPECT(utf8.finish());
// Invalid range 128-193 // Invalid range 128-193
for (auto it = std::next(buf.begin(), 128); for(auto it = std::next(buf.begin(), 128);
it != std::next(buf.begin(), 194); ++it) it != std::next(buf.begin(), 194); ++it)
BEAST_EXPECT(! utf8.write(&(*it), 1)); BEAST_EXPECT(! utf8.write(&(*it), 1));
// Invalid range 245-255 // Invalid range 245-255
for (auto it = std::next(buf.begin(), 245); for(auto it = std::next(buf.begin(), 245);
it != buf.end(); ++it) it != buf.end(); ++it)
BEAST_EXPECT(! utf8.write(&(*it), 1)); BEAST_EXPECT(! utf8.write(&(*it), 1));
} }
@@ -59,7 +59,7 @@ public:
// First byte valid range 194-223 // First byte valid range 194-223
buf[0] = static_cast<std::uint8_t>(i); buf[0] = static_cast<std::uint8_t>(i);
for (auto j = 128; j <= 191; ++j) for(auto j = 128; j <= 191; ++j)
{ {
// Second byte valid range 128-191 // Second byte valid range 128-191
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);
@@ -67,14 +67,14 @@ public:
BEAST_EXPECT(utf8.finish()); BEAST_EXPECT(utf8.finish());
} }
for (auto j = 0; j <= 127; ++j) for(auto j = 0; j <= 127; ++j)
{ {
// Second byte invalid range 0-127 // Second byte invalid range 0-127
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);
BEAST_EXPECT(! utf8.write(buf, 2)); BEAST_EXPECT(! utf8.write(buf, 2));
} }
for (auto j = 192; j <= 255; ++j) for(auto j = 192; j <= 255; ++j)
{ {
// Second byte invalid range 192-255 // Second byte invalid range 192-255
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);
@@ -88,19 +88,19 @@ public:
{ {
utf8_checker utf8; utf8_checker utf8;
std::uint8_t buf[3]; std::uint8_t buf[3];
for (auto i = 224; i <= 239; ++i) for(auto i = 224; i <= 239; ++i)
{ {
// First byte valid range 224-239 // First byte valid range 224-239
buf[0] = static_cast<std::uint8_t>(i); buf[0] = static_cast<std::uint8_t>(i);
std::int32_t const b = (i == 224 ? 160 : 128); std::int32_t const b = (i == 224 ? 160 : 128);
std::int32_t const e = (i == 237 ? 159 : 191); std::int32_t const e = (i == 237 ? 159 : 191);
for (auto j = b; j <= e; ++j) for(auto j = b; j <= e; ++j)
{ {
// Second byte valid range 128-191 or 160-191 or 128-159 // Second byte valid range 128-191 or 160-191 or 128-159
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);
for (auto k = 128; k <= 191; ++k) for(auto k = 128; k <= 191; ++k)
{ {
// Third byte valid range 128-191 // Third byte valid range 128-191
buf[2] = static_cast<std::uint8_t>(k); buf[2] = static_cast<std::uint8_t>(k);
@@ -108,14 +108,14 @@ public:
BEAST_EXPECT(utf8.finish()); BEAST_EXPECT(utf8.finish());
} }
for (auto k = 0; k <= 127; ++k) for(auto k = 0; k <= 127; ++k)
{ {
// Third byte invalid range 0-127 // Third byte invalid range 0-127
buf[2] = static_cast<std::uint8_t>(k); buf[2] = static_cast<std::uint8_t>(k);
BEAST_EXPECT(! utf8.write(buf, 3)); BEAST_EXPECT(! utf8.write(buf, 3));
} }
for (auto k = 192; k <= 255; ++k) for(auto k = 192; k <= 255; ++k)
{ {
// Third byte invalid range 192-255 // Third byte invalid range 192-255
buf[2] = static_cast<std::uint8_t>(k); buf[2] = static_cast<std::uint8_t>(k);
@@ -123,14 +123,14 @@ public:
} }
} }
for (auto j = 0; j < b; ++j) for(auto j = 0; j < b; ++j)
{ {
// Second byte invalid range 0-127 or 0-159 // Second byte invalid range 0-127 or 0-159
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);
BEAST_EXPECT(! utf8.write(buf, 3)); BEAST_EXPECT(! utf8.write(buf, 3));
} }
for (auto j = e + 1; j <= 255; ++j) for(auto j = e + 1; j <= 255; ++j)
{ {
// Second byte invalid range 160-255 or 192-255 // Second byte invalid range 160-255 or 192-255
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);
@@ -145,24 +145,24 @@ public:
using boost::asio::const_buffers_1; using boost::asio::const_buffers_1;
utf8_checker utf8; utf8_checker utf8;
std::uint8_t buf[4]; std::uint8_t buf[4];
for (auto i = 240; i <= 244; ++i) for(auto i = 240; i <= 244; ++i)
{ {
// First byte valid range 240-244 // First byte valid range 240-244
buf[0] = static_cast<std::uint8_t>(i); buf[0] = static_cast<std::uint8_t>(i);
std::int32_t const b = (i == 240 ? 144 : 128); std::int32_t const b = (i == 240 ? 144 : 128);
std::int32_t const e = (i == 244 ? 143 : 191); std::int32_t const e = (i == 244 ? 143 : 191);
for (auto j = b; j <= e; ++j) for(auto j = b; j <= e; ++j)
{ {
// Second byte valid range 128-191 or 144-191 or 128-143 // Second byte valid range 128-191 or 144-191 or 128-143
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);
for (auto k = 128; k <= 191; ++k) for(auto k = 128; k <= 191; ++k)
{ {
// Third byte valid range 128-191 // Third byte valid range 128-191
buf[2] = static_cast<std::uint8_t>(k); buf[2] = static_cast<std::uint8_t>(k);
for (auto n = 128; n <= 191; ++n) for(auto n = 128; n <= 191; ++n)
{ {
// Fourth byte valid range 128-191 // Fourth byte valid range 128-191
buf[3] = static_cast<std::uint8_t>(n); buf[3] = static_cast<std::uint8_t>(n);
@@ -170,14 +170,14 @@ public:
BEAST_EXPECT(utf8.finish()); BEAST_EXPECT(utf8.finish());
} }
for (auto n = 0; n <= 127; ++n) for(auto n = 0; n <= 127; ++n)
{ {
// Fourth byte invalid range 0-127 // Fourth byte invalid range 0-127
buf[3] = static_cast<std::uint8_t>(n); buf[3] = static_cast<std::uint8_t>(n);
BEAST_EXPECT(! utf8.write(const_buffers_1{buf, 4})); BEAST_EXPECT(! utf8.write(const_buffers_1{buf, 4}));
} }
for (auto n = 192; n <= 255; ++n) for(auto n = 192; n <= 255; ++n)
{ {
// Fourth byte invalid range 192-255 // Fourth byte invalid range 192-255
buf[3] = static_cast<std::uint8_t>(n); buf[3] = static_cast<std::uint8_t>(n);
@@ -185,14 +185,14 @@ public:
} }
} }
for (auto k = 0; k <= 127; ++k) for(auto k = 0; k <= 127; ++k)
{ {
// Third byte invalid range 0-127 // Third byte invalid range 0-127
buf[2] = static_cast<std::uint8_t>(k); buf[2] = static_cast<std::uint8_t>(k);
BEAST_EXPECT(! utf8.write(buf, 4)); BEAST_EXPECT(! utf8.write(buf, 4));
} }
for (auto k = 192; k <= 255; ++k) for(auto k = 192; k <= 255; ++k)
{ {
// Third byte invalid range 192-255 // Third byte invalid range 192-255
buf[2] = static_cast<std::uint8_t>(k); buf[2] = static_cast<std::uint8_t>(k);
@@ -200,14 +200,14 @@ public:
} }
} }
for (auto j = 0; j < b; ++j) for(auto j = 0; j < b; ++j)
{ {
// Second byte invalid range 0-127 or 0-143 // Second byte invalid range 0-127 or 0-143
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);
BEAST_EXPECT(! utf8.write(buf, 3)); BEAST_EXPECT(! utf8.write(buf, 3));
} }
for (auto j = e + 1; j <= 255; ++j) for(auto j = e + 1; j <= 255; ++j)
{ {
// Second byte invalid range 144-255 or 192-255 // Second byte invalid range 144-255 or 192-255
buf[1] = static_cast<std::uint8_t>(j); buf[1] = static_cast<std::uint8_t>(j);