forked from boostorg/beast
Restyle sources
This commit is contained in:
@@ -160,7 +160,7 @@ private:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, write_op* op)
|
||||
{
|
||||
|
@@ -26,7 +26,7 @@ public:
|
||||
amount (amount const&) = default;
|
||||
amount& operator= (amount const&) = delete;
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
amount (std::size_t n, std::string const& what);
|
||||
|
||||
friend
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
operator<< (std::ostream& s, amount const& t);
|
||||
};
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
amount::amount (std::size_t n, std::string const& what)
|
||||
: n_ (n)
|
||||
, what_ (what)
|
||||
|
@@ -16,7 +16,7 @@ namespace detail {
|
||||
The interface allows for limited read only operations. Derived classes
|
||||
provide additional behavior.
|
||||
*/
|
||||
template <class Container>
|
||||
template<class Container>
|
||||
class const_container
|
||||
{
|
||||
private:
|
||||
|
@@ -33,7 +33,7 @@ static
|
||||
std::string
|
||||
prefix(suite_info const& s)
|
||||
{
|
||||
if (s.manual())
|
||||
if(s.manual())
|
||||
return "|M| ";
|
||||
return " ";
|
||||
}
|
||||
@@ -121,7 +121,7 @@ int main(int ac, char const* av[])
|
||||
match_auto(suites));
|
||||
else
|
||||
failed = r.run_each(global_suites());
|
||||
if (failed)
|
||||
if(failed)
|
||||
return EXIT_FAILURE;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@@ -45,27 +45,27 @@ private:
|
||||
std::string library_;
|
||||
|
||||
public:
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
explicit
|
||||
selector (mode_t mode, std::string const& pattern = "");
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
bool
|
||||
operator() (suite_info const& s);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
selector::selector (mode_t mode, std::string const& pattern)
|
||||
: mode_ (mode)
|
||||
, pat_ (pattern)
|
||||
{
|
||||
if (mode_ == automatch && pattern.empty())
|
||||
if(mode_ == automatch && pattern.empty())
|
||||
mode_ = all;
|
||||
}
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
bool
|
||||
selector::operator() (suite_info const& s)
|
||||
{
|
||||
@@ -73,14 +73,14 @@ selector::operator() (suite_info const& s)
|
||||
{
|
||||
case automatch:
|
||||
// suite or full name
|
||||
if (s.name() == pat_ || s.full_name() == pat_)
|
||||
if(s.name() == pat_ || s.full_name() == pat_)
|
||||
{
|
||||
mode_ = none;
|
||||
return true;
|
||||
}
|
||||
|
||||
// check module
|
||||
if (pat_ == s.module())
|
||||
if(pat_ == s.module())
|
||||
{
|
||||
mode_ = module;
|
||||
library_ = s.library();
|
||||
@@ -88,7 +88,7 @@ selector::operator() (suite_info const& s)
|
||||
}
|
||||
|
||||
// check library
|
||||
if (pat_ == s.library())
|
||||
if(pat_ == s.library())
|
||||
{
|
||||
mode_ = library;
|
||||
return ! s.manual();
|
||||
|
@@ -60,7 +60,7 @@ private:
|
||||
void
|
||||
on_case_end() override
|
||||
{
|
||||
if (m_case.tests.size() > 0)
|
||||
if(m_case.tests.size() > 0)
|
||||
m_suite.insert (std::move (m_case));
|
||||
}
|
||||
|
||||
|
@@ -157,7 +157,7 @@ results::add(suite_results const& r)
|
||||
cases += r.cases;
|
||||
failed += r.failed;
|
||||
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(),
|
||||
top.end(), elapsed,
|
||||
@@ -166,13 +166,13 @@ results::add(suite_results const& r)
|
||||
{
|
||||
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.emplace(iter, r.name, elapsed);
|
||||
}
|
||||
else if (top.size() < max_top)
|
||||
else if(top.size() < max_top)
|
||||
{
|
||||
top.emplace_back(r.name, elapsed);
|
||||
}
|
||||
@@ -214,7 +214,7 @@ reporter<_>::fmtdur(typename clock_type::duration const& d)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto const ms = duration_cast<milliseconds>(d);
|
||||
if (ms < seconds{1})
|
||||
if(ms < seconds{1})
|
||||
return std::to_string(ms.count()) + "ms";
|
||||
std::stringstream ss;
|
||||
ss << std::fixed << std::setprecision(1) <<
|
||||
|
@@ -46,7 +46,7 @@ private:
|
||||
std::size_t failed_;
|
||||
|
||||
public:
|
||||
tests_t ()
|
||||
tests_t()
|
||||
: failed_ (0)
|
||||
{
|
||||
}
|
||||
|
@@ -68,7 +68,7 @@ public:
|
||||
must be convertible to `suite_info`.
|
||||
@return `true` if any conditions failed.
|
||||
*/
|
||||
template <class FwdIter>
|
||||
template<class FwdIter>
|
||||
bool
|
||||
run (FwdIter first, FwdIter last);
|
||||
|
||||
@@ -79,14 +79,14 @@ public:
|
||||
@endcode
|
||||
@return `true` if any conditions failed.
|
||||
*/
|
||||
template <class FwdIter, class Pred>
|
||||
template<class FwdIter, class Pred>
|
||||
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.
|
||||
@return `true` if any conditions failed.
|
||||
*/
|
||||
template <class SequenceContainer>
|
||||
template<class SequenceContainer>
|
||||
bool
|
||||
run_each (SequenceContainer const& c);
|
||||
|
||||
@@ -97,9 +97,9 @@ public:
|
||||
@endcode
|
||||
@return `true` if any conditions failed.
|
||||
*/
|
||||
template <class SequenceContainer, class Pred>
|
||||
template<class SequenceContainer, class Pred>
|
||||
bool
|
||||
run_each_if (SequenceContainer const& c, Pred pred = Pred{});
|
||||
run_each_if(SequenceContainer const& c, Pred pred = Pred{});
|
||||
|
||||
protected:
|
||||
//
|
||||
@@ -159,26 +159,26 @@ private:
|
||||
friend class suite;
|
||||
|
||||
// Start a new testcase.
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
void
|
||||
testcase (std::string const& name);
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
void
|
||||
pass();
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
void
|
||||
fail (std::string const& reason);
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
void
|
||||
log (std::string const& s);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
bool
|
||||
runner::run (suite_info const& s)
|
||||
{
|
||||
@@ -194,49 +194,49 @@ runner::run (suite_info const& s)
|
||||
return failed_;
|
||||
}
|
||||
|
||||
template <class FwdIter>
|
||||
template<class FwdIter>
|
||||
bool
|
||||
runner::run (FwdIter first, FwdIter last)
|
||||
{
|
||||
bool failed (false);
|
||||
for (;first != last; ++first)
|
||||
for(;first != last; ++first)
|
||||
failed = run (*first) || failed;
|
||||
return failed;
|
||||
}
|
||||
|
||||
template <class FwdIter, class Pred>
|
||||
template<class FwdIter, class Pred>
|
||||
bool
|
||||
runner::run_if (FwdIter first, FwdIter last, Pred pred)
|
||||
runner::run_if(FwdIter first, FwdIter last, Pred pred)
|
||||
{
|
||||
bool failed (false);
|
||||
for (;first != last; ++first)
|
||||
if (pred (*first))
|
||||
for(;first != last; ++first)
|
||||
if(pred (*first))
|
||||
failed = run (*first) || failed;
|
||||
return failed;
|
||||
}
|
||||
|
||||
template <class SequenceContainer>
|
||||
template<class SequenceContainer>
|
||||
bool
|
||||
runner::run_each (SequenceContainer const& c)
|
||||
{
|
||||
bool failed (false);
|
||||
for (auto const& s : c)
|
||||
for(auto const& s : c)
|
||||
failed = run (s) || failed;
|
||||
return failed;
|
||||
}
|
||||
|
||||
template <class SequenceContainer, class Pred>
|
||||
template<class SequenceContainer, class Pred>
|
||||
bool
|
||||
runner::run_each_if (SequenceContainer const& c, Pred pred)
|
||||
runner::run_each_if(SequenceContainer const& c, Pred pred)
|
||||
{
|
||||
bool failed (false);
|
||||
for (auto const& s : c)
|
||||
if (pred (s))
|
||||
for(auto const& s : c)
|
||||
if(pred (s))
|
||||
failed = run (s) || failed;
|
||||
return failed;
|
||||
}
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
void
|
||||
runner::testcase (std::string const& name)
|
||||
{
|
||||
@@ -245,42 +245,42 @@ runner::testcase (std::string const& name)
|
||||
assert (default_ || ! name.empty());
|
||||
// Forgot to call pass or fail
|
||||
assert (default_ || cond_);
|
||||
if (! default_)
|
||||
if(! default_)
|
||||
on_case_end();
|
||||
default_ = false;
|
||||
cond_ = false;
|
||||
on_case_begin (name);
|
||||
}
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
void
|
||||
runner::pass()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
if (default_)
|
||||
if(default_)
|
||||
testcase ("");
|
||||
on_pass();
|
||||
cond_ = true;
|
||||
}
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
void
|
||||
runner::fail (std::string const& reason)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
if (default_)
|
||||
if(default_)
|
||||
testcase ("");
|
||||
on_fail (reason);
|
||||
failed_ = true;
|
||||
cond_ = true;
|
||||
}
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
void
|
||||
runner::log (std::string const& s)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
if (default_)
|
||||
if(default_)
|
||||
testcase ("");
|
||||
on_log (s);
|
||||
}
|
||||
|
@@ -127,7 +127,7 @@ private:
|
||||
scoped_testcase
|
||||
operator()(abort_t abort);
|
||||
|
||||
template <class T>
|
||||
template<class T>
|
||||
scoped_testcase
|
||||
operator<<(T const& t);
|
||||
};
|
||||
@@ -187,11 +187,11 @@ public:
|
||||
|
||||
/** Expect an exception from f() */
|
||||
/** @{ */
|
||||
template <class F, class String>
|
||||
template<class F, class String>
|
||||
bool
|
||||
except (F&& f, String const& reason);
|
||||
|
||||
template <class F>
|
||||
template<class F>
|
||||
bool
|
||||
except (F&& f)
|
||||
{
|
||||
@@ -201,11 +201,11 @@ public:
|
||||
|
||||
/** Expect an exception of the given type from f() */
|
||||
/** @{ */
|
||||
template <class E, class F, class String>
|
||||
template<class E, class F, class String>
|
||||
bool
|
||||
except (F&& f, String const& reason);
|
||||
|
||||
template <class E, class F>
|
||||
template<class E, class F>
|
||||
bool
|
||||
except (F&& f)
|
||||
{
|
||||
@@ -215,11 +215,11 @@ public:
|
||||
|
||||
/** Fail if f() throws */
|
||||
/** @{ */
|
||||
template <class F, class String>
|
||||
template<class F, class String>
|
||||
bool
|
||||
unexcept (F&& f, String const& reason);
|
||||
|
||||
template <class F>
|
||||
template<class F>
|
||||
bool
|
||||
unexcept (F&& f)
|
||||
{
|
||||
@@ -236,12 +236,12 @@ public:
|
||||
|
||||
// DEPRECATED
|
||||
// @return `true` if the test condition indicates success (a false value)
|
||||
template <class Condition, class String>
|
||||
template<class Condition, class String>
|
||||
bool
|
||||
unexpected (Condition shouldBeFalse,
|
||||
String const& reason);
|
||||
|
||||
template <class Condition>
|
||||
template<class Condition>
|
||||
bool
|
||||
unexpected (Condition shouldBeFalse)
|
||||
{
|
||||
@@ -249,12 +249,12 @@ public:
|
||||
}
|
||||
|
||||
/** Record a successful test condition. */
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
void
|
||||
pass();
|
||||
|
||||
/** Record a failure. */
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
void
|
||||
fail (std::string const& reason = "");
|
||||
|
||||
@@ -277,7 +277,7 @@ private:
|
||||
void
|
||||
propagate_abort();
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
void
|
||||
run (runner& r);
|
||||
};
|
||||
@@ -375,7 +375,7 @@ suite::operator()(runner& r)
|
||||
}
|
||||
}
|
||||
|
||||
template <class Condition, class String>
|
||||
template<class Condition, class String>
|
||||
inline
|
||||
bool
|
||||
suite::expect(Condition const& shouldBeTrue,
|
||||
@@ -390,7 +390,7 @@ suite::expect(Condition const& shouldBeTrue,
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class F, class String>
|
||||
template<class F, class String>
|
||||
bool
|
||||
suite::except (F&& f, String const& reason)
|
||||
{
|
||||
@@ -407,7 +407,7 @@ suite::except (F&& f, String const& reason)
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class E, class F, class String>
|
||||
template<class E, class F, class String>
|
||||
bool
|
||||
suite::except (F&& f, String const& reason)
|
||||
{
|
||||
@@ -424,7 +424,7 @@ suite::except (F&& f, String const& reason)
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class F, class String>
|
||||
template<class F, class String>
|
||||
bool
|
||||
suite::unexcept (F&& f, String const& reason)
|
||||
{
|
||||
@@ -441,7 +441,7 @@ suite::unexcept (F&& f, String const& reason)
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class Condition, class String>
|
||||
template<class Condition, class String>
|
||||
inline
|
||||
bool
|
||||
suite::unexpected (Condition shouldBeFalse,
|
||||
@@ -449,14 +449,14 @@ suite::unexpected (Condition shouldBeFalse,
|
||||
{
|
||||
bool const b =
|
||||
static_cast<bool>(shouldBeFalse);
|
||||
if (! b)
|
||||
if(! b)
|
||||
pass();
|
||||
else
|
||||
fail (reason);
|
||||
return ! b;
|
||||
}
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
void
|
||||
suite::pass()
|
||||
{
|
||||
@@ -464,13 +464,13 @@ suite::pass()
|
||||
runner_->pass();
|
||||
}
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
void
|
||||
suite::fail (std::string const& reason)
|
||||
{
|
||||
propagate_abort();
|
||||
runner_->fail (reason);
|
||||
if (abort_)
|
||||
if(abort_)
|
||||
{
|
||||
aborted_ = true;
|
||||
throw abort_exception();
|
||||
@@ -481,11 +481,11 @@ inline
|
||||
void
|
||||
suite::propagate_abort()
|
||||
{
|
||||
if (abort_ && aborted_)
|
||||
if(abort_ && aborted_)
|
||||
throw abort_exception();
|
||||
}
|
||||
|
||||
template <class>
|
||||
template<class>
|
||||
void
|
||||
suite::run (runner& r)
|
||||
{
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
The suite must not already exist.
|
||||
*/
|
||||
template <class Suite>
|
||||
template<class Suite>
|
||||
void
|
||||
insert(
|
||||
char const* name,
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class Suite>
|
||||
template<class Suite>
|
||||
void
|
||||
suite_list::insert(
|
||||
char const* name,
|
||||
|
@@ -44,7 +44,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class F, class... Args>
|
||||
template<class F, class... Args>
|
||||
explicit
|
||||
thread (suite& s, F&& f, Args&&... args)
|
||||
: s_ (&s)
|
||||
|
@@ -47,7 +47,7 @@ namespace beast {
|
||||
@note See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3896.pdf">
|
||||
Library Foundations For Asynchronous Operations</a>
|
||||
*/
|
||||
template <class CompletionHandler, class Signature>
|
||||
template<class CompletionHandler, class Signature>
|
||||
struct async_completion
|
||||
{
|
||||
/** The type of the final handler called by the asynchronous initiation function.
|
||||
|
@@ -44,7 +44,7 @@ namespace detail {
|
||||
|
||||
*/
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
std::string const&
|
||||
base64_alphabet()
|
||||
{
|
||||
@@ -62,7 +62,7 @@ is_base64(unsigned char c)
|
||||
return (std::isalnum(c) || (c == '+') || (c == '/'));
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
std::string
|
||||
base64_encode (std::uint8_t const* data,
|
||||
std::size_t in_len)
|
||||
@@ -112,7 +112,7 @@ base64_encode (std::uint8_t const* data,
|
||||
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
std::string
|
||||
base64_encode (std::string const& s)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ base64_encode (std::string const& s)
|
||||
std::uint8_t const*> (s.data()), s.size());
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
template<class = void>
|
||||
std::string
|
||||
base64_decode(std::string const& data)
|
||||
{
|
||||
|
@@ -54,14 +54,14 @@ public:
|
||||
operator()()
|
||||
{
|
||||
invoke(h_, args_,
|
||||
index_sequence_for<Args...> ());
|
||||
index_sequence_for<Args...>());
|
||||
}
|
||||
|
||||
void
|
||||
operator()() const
|
||||
{
|
||||
invoke(h_, args_,
|
||||
index_sequence_for<Args...> ());
|
||||
index_sequence_for<Args...>());
|
||||
}
|
||||
|
||||
friend
|
||||
|
@@ -14,7 +14,7 @@
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
template <class T>
|
||||
template<class T>
|
||||
struct empty_base_optimization_decide
|
||||
: std::integral_constant <bool,
|
||||
std::is_empty <T>::value
|
||||
@@ -25,7 +25,7 @@ struct empty_base_optimization_decide
|
||||
{
|
||||
};
|
||||
|
||||
template <
|
||||
template<
|
||||
class T,
|
||||
int UniqueID = 0,
|
||||
bool ShouldDeriveFrom =
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <
|
||||
template<
|
||||
class T,
|
||||
int UniqueID
|
||||
>
|
||||
|
@@ -13,7 +13,7 @@
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
template <class R, class C, class ...A>
|
||||
template<class R, class C, class ...A>
|
||||
auto
|
||||
is_call_possible_test(C&& c, int, A&& ...a)
|
||||
-> decltype(std::is_convertible<
|
||||
@@ -21,7 +21,7 @@ is_call_possible_test(C&& c, int, A&& ...a)
|
||||
std::is_same<R, void>::value,
|
||||
std::true_type());
|
||||
|
||||
template <class R, class C, class ...A>
|
||||
template<class R, class C, class ...A>
|
||||
std::false_type
|
||||
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)>
|
||||
*/
|
||||
/** @{ */
|
||||
template <class C, class F>
|
||||
template<class C, class F>
|
||||
struct is_call_possible
|
||||
: std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class C, class R, class ...A>
|
||||
template<class C, class R, class ...A>
|
||||
struct is_call_possible<C, R(A...)>
|
||||
: decltype(is_call_possible_test<R>(
|
||||
std::declval<C>(), 1, std::declval<A>()...))
|
||||
|
@@ -281,10 +281,10 @@ finish(sha1_context& ctx, void* digest) noexcept
|
||||
ctx.buf[ctx.buflen++] = 0x00;
|
||||
std::uint32_t block[BLOCK_INTS];
|
||||
sha1::make_block(ctx.buf, block);
|
||||
if (buflen > BLOCK_BYTES - 8)
|
||||
if(buflen > BLOCK_BYTES - 8)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ class has_get_io_service
|
||||
decltype(std::declval<U>().get_io_service()),
|
||||
boost::asio::io_service&>>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
public:
|
||||
using type = decltype(check<T>(0));
|
||||
|
@@ -227,7 +227,7 @@ public:
|
||||
|
||||
/// Write the given data to the stream. Returns the number of bytes written,
|
||||
/// or 0 if an error occurred.
|
||||
template <class ConstBufferSequence>
|
||||
template<class ConstBufferSequence>
|
||||
std::size_t
|
||||
write_some(ConstBufferSequence const& buffers,
|
||||
error_code& ec)
|
||||
|
@@ -34,10 +34,10 @@ namespace beast {
|
||||
caller is still responsible for freeing memory.
|
||||
*/
|
||||
#if GENERATING_DOCS
|
||||
template <class T, class CompletionHandler>
|
||||
template<class T, class CompletionHandler>
|
||||
class handler_alloc;
|
||||
#else
|
||||
template <class T, class CompletionHandler>
|
||||
template<class T, class CompletionHandler>
|
||||
class handler_alloc
|
||||
{
|
||||
private:
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
// should produce a compile error if CompletionHandler is not
|
||||
// constructible from H.
|
||||
//
|
||||
template <class U, class H>
|
||||
template<class U, class H>
|
||||
friend class handler_alloc;
|
||||
|
||||
CompletionHandler h_;
|
||||
|
@@ -85,7 +85,7 @@ public:
|
||||
is_continuation(op->d_->h);
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, read_some_op* op)
|
||||
{
|
||||
|
@@ -482,7 +482,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -501,7 +501,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -520,7 +520,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -539,7 +539,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -557,7 +557,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -575,7 +575,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -594,7 +594,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -613,7 +613,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -630,7 +630,7 @@ private:
|
||||
decltype(std::declval<T>().on_headers(
|
||||
std::declval<std::uint64_t>(), std::declval<error_code&>()))>>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -649,7 +649,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -667,7 +667,7 @@ private:
|
||||
std::declval<error_code&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
|
@@ -29,7 +29,7 @@ class chunk_encode_text
|
||||
// Storage for the longest hex string we might need, plus delimiters.
|
||||
std::array<char, 2 * sizeof(std::size_t) + 2> buf_;
|
||||
|
||||
template <class OutIter>
|
||||
template<class OutIter>
|
||||
static
|
||||
OutIter
|
||||
to_hex(OutIter last, std::size_t n)
|
||||
|
@@ -22,7 +22,7 @@ class has_content_length_value
|
||||
decltype(std::declval<U>().content_length()),
|
||||
std::uint64_t>>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<T>(0));
|
||||
public:
|
||||
|
@@ -91,7 +91,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, parse_op* op)
|
||||
{
|
||||
@@ -277,7 +277,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, read_op* op)
|
||||
{
|
||||
|
@@ -262,7 +262,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, write_op* op)
|
||||
{
|
||||
|
@@ -136,12 +136,12 @@ write(DynamicBuffer& db, frame_header const& fh)
|
||||
if(fh.rsv3)
|
||||
b[0] |= 0x10;
|
||||
b[1] = fh.mask ? 0x80 : 0x00;
|
||||
if (fh.len <= 125)
|
||||
if(fh.len <= 125)
|
||||
{
|
||||
b[1] |= fh.len;
|
||||
n = 2;
|
||||
}
|
||||
else if (fh.len <= 65535)
|
||||
else if(fh.len <= 65535)
|
||||
{
|
||||
b[1] |= 126;
|
||||
::new(&b[2]) big_uint16_buf_t{
|
||||
|
@@ -131,7 +131,7 @@ utf8_checker_t<_>::write(BufferSequence const& bs)
|
||||
{
|
||||
using boost::asio::buffer_cast;
|
||||
using boost::asio::buffer_size;
|
||||
for (auto const& b : bs)
|
||||
for(auto const& b : bs)
|
||||
if(! write(buffer_cast<void const*>(b),
|
||||
buffer_size(b)))
|
||||
return false;
|
||||
|
@@ -101,7 +101,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, accept_op* op)
|
||||
{
|
||||
|
@@ -97,7 +97,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, close_op* op)
|
||||
{
|
||||
|
@@ -93,7 +93,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, handshake_op* op)
|
||||
{
|
||||
|
@@ -95,7 +95,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, ping_op* op)
|
||||
{
|
||||
|
@@ -117,7 +117,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
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;
|
||||
}
|
||||
d.state = do_read_fh + 2;
|
||||
if (n == 0)
|
||||
if(n == 0)
|
||||
{
|
||||
bytes_transferred = 0;
|
||||
break;
|
||||
|
@@ -88,7 +88,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, read_op* op)
|
||||
{
|
||||
|
@@ -93,7 +93,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, response_op* op)
|
||||
{
|
||||
|
@@ -93,7 +93,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f,
|
||||
teardown_ssl_op* op)
|
||||
|
@@ -80,7 +80,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f,
|
||||
teardown_tcp_op* op)
|
||||
|
@@ -134,7 +134,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, write_frame_op* op)
|
||||
{
|
||||
|
@@ -91,7 +91,7 @@ public:
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
template<class Function>
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, write_op* op)
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@ class empty_base_optimization_test
|
||||
: public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
template <class T>
|
||||
template<class T>
|
||||
class test1
|
||||
: private empty_base_optimization<T>
|
||||
{
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
T const& member() const {return Base::member();}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template<class T>
|
||||
class test2
|
||||
{
|
||||
void* m_p;
|
||||
@@ -53,34 +53,34 @@ public:
|
||||
|
||||
static
|
||||
bool
|
||||
test_one ()
|
||||
test_one()
|
||||
{
|
||||
test1<int> t1(1);
|
||||
test2<int> t2(2);
|
||||
static_assert(sizeof(t1) == sizeof(t2), "don't optimize for int");
|
||||
if (t1.member() != 1)
|
||||
if(t1.member() != 1)
|
||||
return false;
|
||||
if (t2.member() != 2)
|
||||
if(t2.member() != 2)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static
|
||||
bool
|
||||
test_two ()
|
||||
test_two()
|
||||
{
|
||||
test1<Empty> t1((Empty()));
|
||||
test2<Empty> t2((Empty()));
|
||||
static_assert(sizeof(t1) < sizeof(t2), "do optimize for Empty");
|
||||
if (t1.member() != true)
|
||||
if(t1.member() != true)
|
||||
return false;
|
||||
if (t2.member() != true)
|
||||
if(t2.member() != true)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
run ()
|
||||
run()
|
||||
{
|
||||
BEAST_EXPECT(test_one());
|
||||
BEAST_EXPECT(test_two());
|
||||
|
@@ -30,7 +30,7 @@ escaped_string(boost::string_ref const& s)
|
||||
out.append("\\r");
|
||||
else if(*p == '\n')
|
||||
out.append("\\n");
|
||||
else if (*p == '\t')
|
||||
else if(*p == '\t')
|
||||
out.append("\\t");
|
||||
else
|
||||
out.append(p, 1);
|
||||
|
@@ -223,7 +223,7 @@ private:
|
||||
template<class T, class R =
|
||||
decltype(std::declval<T>().on_start(), std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -253,7 +253,7 @@ private:
|
||||
std::declval<std::string const&>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -283,7 +283,7 @@ private:
|
||||
decltype(std::declval<T>().on_headers_complete(
|
||||
std::declval<error_code&>()), std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -314,7 +314,7 @@ private:
|
||||
std::declval<bool>(), std::declval<bool>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -349,7 +349,7 @@ private:
|
||||
std::declval<bool>(), std::declval<bool>()),
|
||||
std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
#if 0
|
||||
using type = decltype(check<C>(0));
|
||||
@@ -389,7 +389,7 @@ private:
|
||||
std::declval<void const*>(), std::declval<std::size_t>(),
|
||||
std::declval<error_code&>()), std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -418,7 +418,7 @@ private:
|
||||
template<class T, class R =
|
||||
decltype(std::declval<T>().on_complete(), std::true_type{})>
|
||||
static R check(int);
|
||||
template <class>
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<C>(0));
|
||||
public:
|
||||
@@ -488,7 +488,7 @@ nodejs_basic_parser<Derived>::write(
|
||||
using boost::asio::buffer_cast;
|
||||
using boost::asio::buffer_size;
|
||||
std::size_t bytes_used = 0;
|
||||
for (auto const& buffer : buffers)
|
||||
for(auto const& buffer : buffers)
|
||||
{
|
||||
auto const n = write(
|
||||
buffer_cast<void const*>(buffer),
|
||||
@@ -609,7 +609,7 @@ template<class Derived>
|
||||
void
|
||||
nodejs_basic_parser<Derived>::check_header()
|
||||
{
|
||||
if (! value_.empty())
|
||||
if(! value_.empty())
|
||||
{
|
||||
//detail::trim(value_);
|
||||
call_on_field(field_, value_,
|
||||
|
@@ -29,7 +29,7 @@ public:
|
||||
{
|
||||
std::array<std::uint8_t, 256> values;
|
||||
std::uint8_t i = 0;
|
||||
for (auto& c : values)
|
||||
for(auto& c : values)
|
||||
c = i++;
|
||||
return values;
|
||||
})();
|
||||
@@ -39,12 +39,12 @@ public:
|
||||
BEAST_EXPECT(utf8.finish());
|
||||
|
||||
// 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)
|
||||
BEAST_EXPECT(! utf8.write(&(*it), 1));
|
||||
|
||||
// Invalid range 245-255
|
||||
for (auto it = std::next(buf.begin(), 245);
|
||||
for(auto it = std::next(buf.begin(), 245);
|
||||
it != buf.end(); ++it)
|
||||
BEAST_EXPECT(! utf8.write(&(*it), 1));
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
// First byte valid range 194-223
|
||||
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
|
||||
buf[1] = static_cast<std::uint8_t>(j);
|
||||
@@ -67,14 +67,14 @@ public:
|
||||
BEAST_EXPECT(utf8.finish());
|
||||
}
|
||||
|
||||
for (auto j = 0; j <= 127; ++j)
|
||||
for(auto j = 0; j <= 127; ++j)
|
||||
{
|
||||
// Second byte invalid range 0-127
|
||||
buf[1] = static_cast<std::uint8_t>(j);
|
||||
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
|
||||
buf[1] = static_cast<std::uint8_t>(j);
|
||||
@@ -88,19 +88,19 @@ public:
|
||||
{
|
||||
utf8_checker utf8;
|
||||
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
|
||||
buf[0] = static_cast<std::uint8_t>(i);
|
||||
|
||||
std::int32_t const b = (i == 224 ? 160 : 128);
|
||||
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
|
||||
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
|
||||
buf[2] = static_cast<std::uint8_t>(k);
|
||||
@@ -108,14 +108,14 @@ public:
|
||||
BEAST_EXPECT(utf8.finish());
|
||||
}
|
||||
|
||||
for (auto k = 0; k <= 127; ++k)
|
||||
for(auto k = 0; k <= 127; ++k)
|
||||
{
|
||||
// Third byte invalid range 0-127
|
||||
buf[2] = static_cast<std::uint8_t>(k);
|
||||
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
|
||||
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
|
||||
buf[1] = static_cast<std::uint8_t>(j);
|
||||
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
|
||||
buf[1] = static_cast<std::uint8_t>(j);
|
||||
@@ -145,24 +145,24 @@ public:
|
||||
using boost::asio::const_buffers_1;
|
||||
utf8_checker utf8;
|
||||
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
|
||||
buf[0] = static_cast<std::uint8_t>(i);
|
||||
|
||||
std::int32_t const b = (i == 240 ? 144 : 128);
|
||||
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
|
||||
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
|
||||
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
|
||||
buf[3] = static_cast<std::uint8_t>(n);
|
||||
@@ -170,14 +170,14 @@ public:
|
||||
BEAST_EXPECT(utf8.finish());
|
||||
}
|
||||
|
||||
for (auto n = 0; n <= 127; ++n)
|
||||
for(auto n = 0; n <= 127; ++n)
|
||||
{
|
||||
// Fourth byte invalid range 0-127
|
||||
buf[3] = static_cast<std::uint8_t>(n);
|
||||
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
|
||||
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
|
||||
buf[2] = static_cast<std::uint8_t>(k);
|
||||
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
|
||||
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
|
||||
buf[1] = static_cast<std::uint8_t>(j);
|
||||
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
|
||||
buf[1] = static_cast<std::uint8_t>(j);
|
||||
|
Reference in New Issue
Block a user