diff --git a/beast/ByteOrder.h b/beast/ByteOrder.h index 6577d616c..67c94cb6b 100644 --- a/beast/ByteOrder.h +++ b/beast/ByteOrder.h @@ -194,7 +194,7 @@ namespace detail { /** Specialized helper class template for swapping bytes. - + Normally you won't use this directly, use the helper function byteSwap instead. You can specialize this class for your own user defined types, as was done for uint24. @@ -204,7 +204,7 @@ namespace detail template struct SwapBytes { - inline IntegralType operator() (IntegralType value) const noexcept + inline IntegralType operator() (IntegralType value) const noexcept { return ByteOrder::swap (value); } @@ -215,7 +215,7 @@ struct SwapBytes template <> struct SwapBytes { - inline std::int16_t operator() (std::int16_t value) const noexcept + inline std::int16_t operator() (std::int16_t value) const noexcept { return static_cast (ByteOrder::swap (static_cast (value))); } @@ -224,7 +224,7 @@ struct SwapBytes template <> struct SwapBytes { - inline std::int32_t operator() (std::int32_t value) const noexcept + inline std::int32_t operator() (std::int32_t value) const noexcept { return static_cast (ByteOrder::swap (static_cast (value))); } @@ -233,7 +233,7 @@ struct SwapBytes template <> struct SwapBytes { - inline std::int64_t operator() (std::int64_t value) const noexcept + inline std::int64_t operator() (std::int64_t value) const noexcept { return static_cast (ByteOrder::swap (static_cast (value))); } diff --git a/beast/Config.h b/beast/Config.h index 8f10fedf0..aade21765 100644 --- a/beast/Config.h +++ b/beast/Config.h @@ -56,5 +56,5 @@ // Suffix #include - + #endif diff --git a/beast/Memory.h b/beast/Memory.h index 067242f9b..b556f3c4a 100644 --- a/beast/Memory.h +++ b/beast/Memory.h @@ -25,7 +25,7 @@ #define BEAST_MEMORY_H_INCLUDED #include - + #include namespace beast { @@ -86,7 +86,7 @@ Type* createCopyIfNotNull (const Type* pointer) ScopedAutoReleasePool(ScopedAutoReleasePool const&) = delete; ScopedAutoReleasePool& operator= (ScopedAutoReleasePool const&) = delete; - + private: void* pool; }; diff --git a/beast/asio/error.h b/beast/asio/error.h index 342e0fee3..18ab67cc9 100644 --- a/beast/asio/error.h +++ b/beast/asio/error.h @@ -34,7 +34,7 @@ is_short_read (boost::system::error_code const& ec) return (ec.category() == boost::asio::error::get_ssl_category()) && (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ); } - + /** Returns a human readable message if the error code is SSL related. */ std::string asio_message(boost::system::error_code const& ec); diff --git a/beast/asio/impl/error.cpp b/beast/asio/impl/error.cpp index c97b15a15..65ede2e83 100644 --- a/beast/asio/impl/error.cpp +++ b/beast/asio/impl/error.cpp @@ -41,8 +41,8 @@ asio_message (boost::system::error_code const& ec) + "," + boost::lexical_cast (ERR_GET_REASON (ec.value ())) + ") "; - - // + + // char buf[errorBufferSize]; ::ERR_error_string_n (ec.value (), buf, errorBufferSize); error += buf; diff --git a/beast/asio/streambuf.h b/beast/asio/streambuf.h index 7988838e5..1a5a35755 100644 --- a/beast/asio/streambuf.h +++ b/beast/asio/streambuf.h @@ -112,7 +112,7 @@ private: the output sequence is empty, out_ will point to the end of the list of buffers, and out_pos_ and out_end_ will be 0: - + |<------+------------------>| out_ == list_.end() in_pos_ out_pos_ == 0 out_end_ == 0 diff --git a/beast/asio/tests/error_test.cpp b/beast/asio/tests/error_test.cpp index bc64109de..32e43decf 100644 --- a/beast/asio/tests/error_test.cpp +++ b/beast/asio/tests/error_test.cpp @@ -28,7 +28,7 @@ class error_test : public unit_test::suite { public: void run () - { + { { boost::system::error_code ec = boost::system::error_code (335544539, boost::asio::error::get_ssl_category ()); diff --git a/beast/asio/tests/streambuf.test.cpp b/beast/asio/tests/streambuf.test.cpp index 5361ad3b6..f36c121d8 100644 --- a/beast/asio/tests/streambuf.test.cpp +++ b/beast/asio/tests/streambuf.test.cpp @@ -145,7 +145,7 @@ public: b.commit(10); expect(to_str(b.data()) == "567890ABCD"); } - + test_prepare(); test_commit(); test_consume(); diff --git a/beast/chrono/chrono_io.h b/beast/chrono/chrono_io.h index 1d2490ea5..c17fe96fa 100644 --- a/beast/chrono/chrono_io.h +++ b/beast/chrono/chrono_io.h @@ -32,7 +32,7 @@ #include #include #include - + /* chrono_io synopsis @@ -58,7 +58,7 @@ public: explicit durationpunct(size_t refs = 0); explicit durationpunct(duration_style fmt, size_t refs = 0); - + bool is_symbol_name() const noexcept; bool is_prefix_name() const noexcept; }; diff --git a/beast/chrono/impl/RelativeTime.cpp b/beast/chrono/impl/RelativeTime.cpp index a08e3558b..0eb70e445 100644 --- a/beast/chrono/impl/RelativeTime.cpp +++ b/beast/chrono/impl/RelativeTime.cpp @@ -268,7 +268,7 @@ static double monotonicCurrentTimeInSeconds() { return GetTickCount64() / 1000.0; } - + } } @@ -279,7 +279,7 @@ static double monotonicCurrentTimeInSeconds() namespace beast { namespace detail { - + static double monotonicCurrentTimeInSeconds() { struct StaticInitializer @@ -291,7 +291,7 @@ static double monotonicCurrentTimeInSeconds() mach_timebase_info_data_t timebase; (void) mach_timebase_info (&timebase); - + if (timebase.numer % 1000000 == 0) { numerator = timebase.numer / 1000000.0; @@ -304,13 +304,13 @@ static double monotonicCurrentTimeInSeconds() //denominator = timebase.denom * (std::uint64_t) 1000000 * 1000.0; denominator = timebase.denom * 1000000000.0; } - + ratio = numerator / denominator; } double ratio; }; - + static StaticInitializer const data; return mach_absolute_time() * data.ratio; @@ -319,7 +319,7 @@ static double monotonicCurrentTimeInSeconds() } #else - + #include namespace beast { @@ -334,7 +334,7 @@ static double monotonicCurrentTimeInSeconds() } } - + #endif namespace beast { @@ -349,7 +349,7 @@ static double getStartupTime() { when = detail::monotonicCurrentTimeInSeconds(); } - + double when; }; @@ -368,7 +368,7 @@ struct StartupTimeStaticInitializer }; static StartupTimeStaticInitializer startupTimeStaticInitializer; - + } RelativeTime RelativeTime::fromStartup () diff --git a/beast/container/cyclic_iterator.h b/beast/container/cyclic_iterator.h index 2afe817a0..167ced9b5 100644 --- a/beast/container/cyclic_iterator.h +++ b/beast/container/cyclic_iterator.h @@ -115,7 +115,7 @@ struct cyclic_iterator_base } // -// cyclic_iterator_decl.hpp +// cyclic_iterator_decl.hpp // /** diff --git a/beast/crypto/base64.h b/beast/crypto/base64.h index 634610da2..4f2ecbba1 100644 --- a/beast/crypto/base64.h +++ b/beast/crypto/base64.h @@ -25,7 +25,7 @@ namespace beast { -/* +/* Portions from http://www.adp-gmbh.ch/cpp/common/base64.html Copyright notice: diff --git a/beast/crypto/detail/mac_facade.h b/beast/crypto/detail/mac_facade.h index 8997048c3..6dd7ff8b8 100644 --- a/beast/crypto/detail/mac_facade.h +++ b/beast/crypto/detail/mac_facade.h @@ -44,7 +44,7 @@ public: std::array; - mac_facade() noexcept + mac_facade() noexcept { init(ctx_); } diff --git a/beast/crypto/detail/ripemd_context.h b/beast/crypto/detail/ripemd_context.h index cc5f91fbb..391fd3d4e 100644 --- a/beast/crypto/detail/ripemd_context.h +++ b/beast/crypto/detail/ripemd_context.h @@ -71,12 +71,12 @@ struct ripemd160_context #define BEAST_RIPEMD_ROL(x, n) (((x) << (n)) | ((x) >> (32-(n)))) // the five basic functions F(), G() and H() -#define BEAST_RIPEMD_F(x, y, z) ((x) ^ (y) ^ (z)) -#define BEAST_RIPEMD_G(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define BEAST_RIPEMD_F(x, y, z) ((x) ^ (y) ^ (z)) +#define BEAST_RIPEMD_G(x, y, z) (((x) & (y)) | (~(x) & (z))) #define BEAST_RIPEMD_H(x, y, z) (((x) | ~(y)) ^ (z)) -#define BEAST_RIPEMD_I(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define BEAST_RIPEMD_I(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define BEAST_RIPEMD_J(x, y, z) ((x) ^ ((y) | ~(z))) - + // the ten basic operations FF() through III() #define BEAST_RIPEMD_FF(a, b, c, d, e, x, s) { \ (a) += BEAST_RIPEMD_F((b), (c), (d)) + (x); \ @@ -166,7 +166,7 @@ void ripemd_compress (ripemd160_context& ctx, BEAST_RIPEMD_FF(cc, dd, ee, aa, bb, X[13], 7); BEAST_RIPEMD_FF(bb, cc, dd, ee, aa, X[14], 9); BEAST_RIPEMD_FF(aa, bb, cc, dd, ee, X[15], 8); - + // round 2 BEAST_RIPEMD_GG(ee, aa, bb, cc, dd, X[ 7], 7); BEAST_RIPEMD_GG(dd, ee, aa, bb, cc, X[ 4], 6); @@ -258,7 +258,7 @@ void ripemd_compress (ripemd160_context& ctx, BEAST_RIPEMD_JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6); // parallel round 2 - BEAST_RIPEMD_III(eee, aaa, bbb, ccc, ddd, X[ 6], 9); + BEAST_RIPEMD_III(eee, aaa, bbb, ccc, ddd, X[ 6], 9); BEAST_RIPEMD_III(ddd, eee, aaa, bbb, ccc, X[11], 13); BEAST_RIPEMD_III(ccc, ddd, eee, aaa, bbb, X[ 3], 15); BEAST_RIPEMD_III(bbb, ccc, ddd, eee, aaa, X[ 7], 7); diff --git a/beast/crypto/detail/sha2_context.h b/beast/crypto/detail/sha2_context.h index 101034936..4cb3449fd 100644 --- a/beast/crypto/detail/sha2_context.h +++ b/beast/crypto/detail/sha2_context.h @@ -34,7 +34,7 @@ namespace detail { /* * Updated to C++, zedwood.com 2012 * Based on Olivier Gay's version - * See Modified BSD License below: + * See Modified BSD License below: * * FIPS 180-2 SHA-224/256/384/512 implementation * Issue date: 04/30/2005 @@ -83,7 +83,7 @@ struct sha512_context { static unsigned int const block_size = 128; static unsigned int const digest_size = 64; - + unsigned int tot_len; unsigned int len; unsigned char block[2 * block_size]; @@ -369,7 +369,7 @@ void init (sha512_context& ctx) noexcept ctx.h[3] = 0xa54ff53a5f1d36f1ULL; ctx.h[4] = 0x510e527fade682d1ULL; ctx.h[5] = 0x9b05688c2b3e6c1fULL; - ctx.h[6] = 0x1f83d9abfb41bd6bULL; + ctx.h[6] = 0x1f83d9abfb41bd6bULL; ctx.h[7] = 0x5be0cd19137e2179ULL; } diff --git a/beast/cxx14/tests/integer_sequence.test.cpp b/beast/cxx14/tests/integer_sequence.test.cpp index a844290c8..0763666f9 100644 --- a/beast/cxx14/tests/integer_sequence.test.cpp +++ b/beast/cxx14/tests/integer_sequence.test.cpp @@ -55,20 +55,20 @@ public: using size2 = std::index_sequence_for; // generates size_t: 0,1 using intmix = std::integer_sequence; // generates int: 9,8,7,2 using sizemix = std::index_sequence<1, 1, 2, 3, 5>; // generates size_t: 1,1,2,3,5 - + // Make sure they're what we expect static_assert ( std::is_same ::value, "int3 type wrong" ); static_assert ( int3::static_size == 3, "int3 size wrong" ); - + static_assert ( std::is_same ::value, "size7 type wrong" ); static_assert ( size7::static_size == 7, "size7 size wrong" ); - + static_assert ( std::is_same ::value, "size4 type wrong" ); static_assert ( size4::static_size == 4, "size4 size wrong" ); - + static_assert ( std::is_same ::value, "size2 type wrong" ); static_assert ( size2::static_size == 2, "size2 size wrong" ); - + static_assert ( std::is_same ::value, "intmix type wrong" ); static_assert ( intmix::static_size == 4, "intmix size wrong" ); @@ -76,7 +76,7 @@ public: static_assert ( sizemix::static_size == 5, "sizemix size wrong" ); auto tup = std::make_tuple ( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ); - + // Use them auto t3 = extract ( tup, int3() ); static_assert ( std::tuple_size::value == int3::static_size, "t3 size wrong"); diff --git a/beast/cxx14/type_traits.h b/beast/cxx14/type_traits.h index 30f8b6920..bfd37b50c 100644 --- a/beast/cxx14/type_traits.h +++ b/beast/cxx14/type_traits.h @@ -90,7 +90,7 @@ template using add_volatile_t = typename add_volatile::type; // C++14 template using add_cv_t = typename add_cv::type; // C++14 - + // reference modifications: template using remove_reference_t = typename remove_reference::type; // C++14 @@ -98,13 +98,13 @@ template using add_lvalue_reference_t = typename add_lvalue_reference::type; // C++14 template using add_rvalue_reference_t = typename add_rvalue_reference::type; // C++14 - + // sign modifications: template using make_signed_t = typename make_signed::type; // C++14 template using make_unsigned_t = typename make_unsigned::type; // C++14 - + // array modifications: template using remove_extent_t = typename remove_extent::type; // C++14 diff --git a/beast/hash/hash_append.h b/beast/hash/hash_append.h index e7d274535..9a8615696 100644 --- a/beast/hash/hash_append.h +++ b/beast/hash/hash_append.h @@ -120,7 +120,7 @@ struct is_uniquely_represented template struct is_uniquely_represented> - : public std::integral_constant::value && + : public std::integral_constant::value && is_uniquely_represented::value && sizeof(T) + sizeof(U) == sizeof(std::pair)> { @@ -131,7 +131,7 @@ struct is_uniquely_represented> template struct is_uniquely_represented> : public std::integral_constant::value...>::value && + static_and::value...>::value && static_sum::value == sizeof(std::tuple)> { }; @@ -148,7 +148,7 @@ struct is_uniquely_represented template struct is_uniquely_represented> - : public std::integral_constant::value && + : public std::integral_constant::value && sizeof(T)*N == sizeof(std::array)> { }; @@ -159,7 +159,7 @@ struct is_uniquely_represented> combination of possible values of `T` held in `x` and `y`, if `x == y`, then it must be true that `memcmp(&x, &y, sizeof(T))` return 0; i.e. that `x` and `y` are represented by the same bit pattern. - + For example: A two's complement `int` should be contiguously hashable. Every bit pattern produces a unique value that does not compare equal to any other bit pattern's value. A IEEE floating point should not be @@ -206,7 +206,7 @@ struct is_contiguously_hashable Never Effect: Returns the reslting hash of all the input data. -*/ +*/ /** @{ */ // scalars @@ -271,21 +271,21 @@ hash_append(Hasher& h, T (&a)[N]) noexcept; template std::enable_if_t < - !is_contiguously_hashable::value + !is_contiguously_hashable::value > hash_append(Hasher& h, std::basic_string const& s) noexcept; template std::enable_if_t < - is_contiguously_hashable::value + is_contiguously_hashable::value > hash_append(Hasher& h, std::basic_string const& s) noexcept; template std::enable_if_t < - !is_contiguously_hashable, Hasher>::value + !is_contiguously_hashable, Hasher>::value > hash_append (Hasher& h, std::pair const& p) noexcept; @@ -348,7 +348,7 @@ template inline std::enable_if_t < - !is_contiguously_hashable::value + !is_contiguously_hashable::value > hash_append(Hasher& h, std::basic_string const& s) noexcept { @@ -361,7 +361,7 @@ template inline std::enable_if_t < - is_contiguously_hashable::value + is_contiguously_hashable::value > hash_append(Hasher& h, std::basic_string const& s) noexcept { diff --git a/beast/hash/impl/siphash.cpp b/beast/hash/impl/siphash.cpp index 174c9143c..22125f53e 100644 --- a/beast/hash/impl/siphash.cpp +++ b/beast/hash/impl/siphash.cpp @@ -1,27 +1,27 @@ //------------------------------- siphash.h ------------------------------------ -// +// // This software is in the public domain. The only restriction on its use is // that no one can remove it from the public domain by claiming ownership of it, // including the original authors. -// +// // There is no warranty of correctness on the software contained herein. Use // at your own risk. // // Derived from: -// +// // SipHash reference C implementation -// +// // Written in 2012 by Jean-Philippe Aumasson // Daniel J. Bernstein -// +// // To the extent possible under law, the author(s) have dedicated all copyright // and related and neighboring rights to this software to the public domain // worldwide. This software is distributed without any warranty. -// +// // You should have received a copy of the CC0 Public Domain Dedication along // with this software. If not, see // . -// +// //------------------------------------------------------------------------------ #include diff --git a/beast/hash/impl/spookyv2.cpp b/beast/hash/impl/spookyv2.cpp index 8aeeaa15c..85f65d3ee 100644 --- a/beast/hash/impl/spookyv2.cpp +++ b/beast/hash/impl/spookyv2.cpp @@ -21,7 +21,7 @@ #define ALLOW_UNALIGNED_READS 1 // -// short hash ... it could be used on any message, +// short hash ... it could be used on any message, // but it's used by Spooky just for short messages. // void SpookyHash::Short( @@ -31,16 +31,16 @@ void SpookyHash::Short( uint64 *hash2) { uint64 buf[2*sc_numVars]; - union - { - const uint8 *p8; + union + { + const uint8 *p8; uint32 *p32; - uint64 *p64; - size_t i; + uint64 *p64; + size_t i; } u; u.p8 = (const uint8 *)message; - + if (!ALLOW_UNALIGNED_READS && (u.i & 0x7)) { memcpy(buf, message, length); @@ -56,7 +56,7 @@ void SpookyHash::Short( if (length > 15) { const uint64 *end = u.p64 + (length/32)*4; - + // handle all complete sets of 32 bytes for (; u.p64 < end; u.p64 += 4) { @@ -66,7 +66,7 @@ void SpookyHash::Short( a += u.p64[2]; b += u.p64[3]; } - + //Handle the case of 16+ remaining bytes. if (remainder >= 16) { @@ -77,7 +77,7 @@ void SpookyHash::Short( remainder -= 16; } } - + // Handle the last 0..15 bytes, and its length d += ((uint64)length) << 56; switch (remainder) @@ -131,9 +131,9 @@ void SpookyHash::Short( // do the whole hash in one call void SpookyHash::Hash128( - const void *message, - size_t length, - uint64 *hash1, + const void *message, + size_t length, + uint64 *hash1, uint64 *hash2) { if (length < sc_bufSize) @@ -145,18 +145,18 @@ void SpookyHash::Hash128( uint64 h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11; uint64 buf[sc_numVars]; uint64 *end; - union - { - const uint8 *p8; - uint64 *p64; - size_t i; + union + { + const uint8 *p8; + uint64 *p64; + size_t i; } u; size_t remainder; - + h0=h3=h6=h9 = *hash1; h1=h4=h7=h10 = *hash2; h2=h5=h8=h11 = sc_const; - + u.p8 = (const uint8 *)message; end = u.p64 + (length/sc_blockSize)*sc_numVars; @@ -164,7 +164,7 @@ void SpookyHash::Hash128( if (ALLOW_UNALIGNED_READS || ((u.i & 0x7) == 0)) { while (u.p64 < end) - { + { Mix(u.p64, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11); u.p64 += sc_numVars; } @@ -185,8 +185,8 @@ void SpookyHash::Hash128( memset(((uint8 *)buf)+remainder, 0, sc_blockSize-remainder); ((uint8 *)buf)[sc_blockSize-1] = static_cast(remainder); - - // do some final mixing + + // do some final mixing End(buf, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11); *hash1 = h0; *hash2 = h1; @@ -210,14 +210,14 @@ void SpookyHash::Update(const void *message, size_t length) uint64 h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11; size_t newLength = length + m_remainder; uint8 remainder; - union - { - const uint8 *p8; - uint64 *p64; - size_t i; + union + { + const uint8 *p8; + uint64 *p64; + size_t i; } u; const uint64 *end; - + // Is this message fragment too short? If it is, stuff it away. if (newLength < sc_bufSize) { @@ -226,7 +226,7 @@ void SpookyHash::Update(const void *message, size_t length) m_remainder = (uint8)newLength; return; } - + // init the variables if (m_length < sc_bufSize) { @@ -250,7 +250,7 @@ void SpookyHash::Update(const void *message, size_t length) h11 = m_state[11]; } m_length = length + m_length; - + // if we've got anything stuffed away, use it now if (m_remainder) { @@ -266,14 +266,14 @@ void SpookyHash::Update(const void *message, size_t length) { u.p8 = (const uint8 *)message; } - + // handle all whole blocks of sc_blockSize bytes end = u.p64 + (length/sc_blockSize)*sc_numVars; remainder = (uint8)(length-((const uint8 *)end-u.p8)); if (ALLOW_UNALIGNED_READS || (u.i & 0x7) == 0) { while (u.p64 < end) - { + { Mix(u.p64, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11); u.p64 += sc_numVars; } @@ -281,7 +281,7 @@ void SpookyHash::Update(const void *message, size_t length) else { while (u.p64 < end) - { + { memcpy(m_data, u.p8, sc_blockSize); Mix(m_data, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11); u.p64 += sc_numVars; @@ -291,7 +291,7 @@ void SpookyHash::Update(const void *message, size_t length) // stuff away the last few bytes m_remainder = remainder; memcpy(m_data, end, remainder); - + // stuff away the variables m_state[0] = h0; m_state[1] = h1; @@ -319,10 +319,10 @@ void SpookyHash::Final(uint64 *hash1, uint64 *hash2) Short( m_data, m_length, hash1, hash2); return; } - + const uint64 *data = (const uint64 *)m_data; uint8 remainder = m_remainder; - + uint64 h0 = m_state[0]; uint64 h1 = m_state[1]; uint64 h2 = m_state[2]; @@ -348,7 +348,7 @@ void SpookyHash::Final(uint64 *hash1, uint64 *hash2) memset(&((uint8 *)data)[remainder], 0, (sc_blockSize-remainder)); ((uint8 *)data)[sc_blockSize-1] = remainder; - + // do some final mixing End(data, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11); diff --git a/beast/hash/impl/spookyv2.h b/beast/hash/impl/spookyv2.h index fe3ab31bb..de198b43d 100644 --- a/beast/hash/impl/spookyv2.h +++ b/beast/hash/impl/spookyv2.h @@ -8,7 +8,7 @@ // Feb 5 2012: adjusted definitions of uint* to be more portable // Mar 30 2012: 3 bytes/cycle, not 4. Alpha was 4 but wasn't thorough enough. // August 5 2012: SpookyV2 (different results) -// +// // Up to 3 bytes/cycle for long messages. Reasonably fast for short messages. // All 1 or 2 bit deltas achieve avalanche within 1% bias per output bit. // @@ -20,9 +20,9 @@ // // Google's CityHash has similar specs to SpookyHash, and CityHash is faster // on new Intel boxes. MD4 and MD5 also have similar specs, but they are orders -// of magnitude slower. CRCs are two or more times slower, but unlike -// SpookyHash, they have nice math for combining the CRCs of pieces to form -// the CRCs of wholes. There are also cryptographic hashes, but those are even +// of magnitude slower. CRCs are two or more times slower, but unlike +// SpookyHash, they have nice math for combining the CRCs of pieces to form +// the CRCs of wholes. There are also cryptographic hashes, but those are even // slower than MD5. // @@ -91,7 +91,7 @@ public: void Init( uint64 seed1, // any 64-bit value will do, including 0 uint64 seed2); // different seeds produce independent hashes - + // // Update: add a piece of a message to a SpookyHash state // @@ -134,7 +134,7 @@ public: // I tried 3 pairs of each; they all differed by at least 212 bits. // static INLINE void Mix( - const uint64 *data, + const uint64 *data, uint64 &s0, uint64 &s1, uint64 &s2, uint64 &s3, uint64 &s4, uint64 &s5, uint64 &s6, uint64 &s7, uint64 &s8, uint64 &s9, uint64 &s10,uint64 &s11) @@ -171,7 +171,7 @@ public: // static INLINE void EndPartial( uint64 &h0, uint64 &h1, uint64 &h2, uint64 &h3, - uint64 &h4, uint64 &h5, uint64 &h6, uint64 &h7, + uint64 &h4, uint64 &h5, uint64 &h6, uint64 &h7, uint64 &h8, uint64 &h9, uint64 &h10,uint64 &h11) { h11+= h1; h2 ^= h11; h1 = Rot64(h1,44); @@ -189,9 +189,9 @@ public: } static INLINE void End( - const uint64 *data, + const uint64 *data, uint64 &h0, uint64 &h1, uint64 &h2, uint64 &h3, - uint64 &h4, uint64 &h5, uint64 &h6, uint64 &h7, + uint64 &h4, uint64 &h5, uint64 &h6, uint64 &h7, uint64 &h8, uint64 &h9, uint64 &h10,uint64 &h11) { h0 += data[0]; h1 += data[1]; h2 += data[2]; h3 += data[3]; @@ -203,7 +203,7 @@ public: } // - // The goal is for each bit of the input to expand into 128 bits of + // The goal is for each bit of the input to expand into 128 bits of // apparent entropy before it is fully overwritten. // n trials both set and cleared at least m bits of h0 h1 h2 h3 // n: 2 m: 29 @@ -259,7 +259,7 @@ public: h0 ^= h3; h3 = Rot64(h3,25); h0 += h3; h1 ^= h0; h0 = Rot64(h0,63); h1 += h0; } - + private: // @@ -267,7 +267,7 @@ private: // Short has a low startup cost, the normal mode is good for long // keys, the cost crossover is at about 192 bytes. The two modes were // held to the same quality bar. - // + // static void Short( const void *message, // message (array of bytes, not necessarily aligned) size_t length, // length of message (in bytes) diff --git a/beast/hash/tests/hash_append_test.cpp b/beast/hash/tests/hash_append_test.cpp index 711435207..e40ed70c4 100644 --- a/beast/hash/tests/hash_append_test.cpp +++ b/beast/hash/tests/hash_append_test.cpp @@ -206,7 +206,7 @@ class spooky private: SpookyHash state_; -public: +public: static beast::endian const endian = beast::endian::native; spooky(std::size_t seed1 = 1, std::size_t seed2 = 2) noexcept @@ -429,9 +429,9 @@ public: { auto const start ( std::chrono::high_resolution_clock::now()); - + auto const hashes (make_hashes (keys)); - + results.elapsed = std::chrono::duration_cast ( std::chrono::high_resolution_clock::now() - start); diff --git a/beast/http/headers.h b/beast/http/headers.h index 940047312..c010dd757 100644 --- a/beast/http/headers.h +++ b/beast/http/headers.h @@ -396,4 +396,4 @@ build_map (headers const& h) } // http } // beast -#endif \ No newline at end of file +#endif diff --git a/beast/http/impl/URL.cpp b/beast/http/impl/URL.cpp index d4820614d..1ab27479b 100644 --- a/beast/http/impl/URL.cpp +++ b/beast/http/impl/URL.cpp @@ -187,7 +187,7 @@ to_string (URL const& url) s.append (url.scheme ()); s.append ("://"); - + if (!url.userinfo ().empty ()) { s.append (url.userinfo ()); diff --git a/beast/http/impl/basic_parser.cpp b/beast/http/impl/basic_parser.cpp index 8d9aefac7..a31a14b4b 100644 --- a/beast/http/impl/basic_parser.cpp +++ b/beast/http/impl/basic_parser.cpp @@ -94,7 +94,7 @@ basic_parser::basic_parser (bool request) noexcept h->on_headers_complete = &basic_parser::cb_headers_complete; h->on_body = &basic_parser::cb_body; h->on_message_complete = &basic_parser::cb_message_complete; - + joyent::http_parser_init (s, request ? joyent::http_parser_type::HTTP_REQUEST : joyent::http_parser_type::HTTP_RESPONSE); diff --git a/beast/http/impl/basic_url.cpp b/beast/http/impl/basic_url.cpp index a05bfa43b..3ae3a9615 100644 --- a/beast/http/impl/basic_url.cpp +++ b/beast/http/impl/basic_url.cpp @@ -31,7 +31,7 @@ basic_url_base::parse_impl (string_ref s, boost::system::error_code& ec) joyent::http_parser_url p; value_type const* const data (s.data()); - + int const error (joyent::http_parser_parse_url ( data, s.size(), false, &p)); diff --git a/beast/http/impl/joyent_parser.cpp b/beast/http/impl/joyent_parser.cpp index da444b1a3..2c268717b 100644 --- a/beast/http/impl/joyent_parser.cpp +++ b/beast/http/impl/joyent_parser.cpp @@ -140,7 +140,7 @@ convert_http_errno (joyent::http_errno err) { return default_error_condition (code) == condition; } - + bool equivalent (error_code const& code, int condition ) const noexcept override @@ -151,7 +151,7 @@ convert_http_errno (joyent::http_errno err) }; static http_error_category_t http_error_category; - + return boost::system::error_code ( err, http_error_category); } diff --git a/beast/http/impl/joyent_parser.h b/beast/http/impl/joyent_parser.h index c04bb093d..9987b3b46 100644 --- a/beast/http/impl/joyent_parser.h +++ b/beast/http/impl/joyent_parser.h @@ -25,7 +25,7 @@ // TODO Use #include -// Wraps the C-language joyent http parser header in a namespace +// Wraps the C-language joyent http parser header in a namespace namespace beast { namespace joyent { diff --git a/beast/http/message.h b/beast/http/message.h index 155b8ee36..4d859d14a 100644 --- a/beast/http/message.h +++ b/beast/http/message.h @@ -58,7 +58,7 @@ private: // request beast::http::method_t method_; std::string url_; - + // response int status_; std::string reason_; @@ -248,7 +248,7 @@ message::operator= (message&& other) keep_alive_ = other.keep_alive_; upgrade_ = other.upgrade_; headers = std::move(other.headers); - return *this; + return *this; } #endif diff --git a/beast/http/parser.h b/beast/http/parser.h index 8d0e8ad81..2619d050a 100644 --- a/beast/http/parser.h +++ b/beast/http/parser.h @@ -49,7 +49,7 @@ public: message& m, bool request) : beast::http::basic_parser (request) , message_(m) - , write_body_(std::move(write_body)) + , write_body_(std::move(write_body)) { message_.get().request(request); } @@ -208,4 +208,4 @@ parser::do_complete() } // http } // beast -#endif \ No newline at end of file +#endif diff --git a/beast/http/tests/URL.test.cpp b/beast/http/tests/URL.test.cpp index a13c95e9d..af4687a84 100644 --- a/beast/http/tests/URL.test.cpp +++ b/beast/http/tests/URL.test.cpp @@ -37,7 +37,7 @@ public: void test_url_parsing () { - char const* const urls[] = + char const* const urls[] = { "http://en.wikipedia.org/wiki/URI#Examples_of_URI_references", "ftp://ftp.funet.fi/pub/standards/RFC/rfc959.txt" diff --git a/beast/http/tests/chunked_encoder.test.cpp b/beast/http/tests/chunked_encoder.test.cpp index 81ea77d8d..900b3ab58 100644 --- a/beast/http/tests/chunked_encoder.test.cpp +++ b/beast/http/tests/chunked_encoder.test.cpp @@ -55,7 +55,7 @@ public: log << encode (std::string( boost::asio::buffer_cast(buf), boost::asio::buffer_size(buf))); - } + } // Convert a ConstBufferSequence to a string template diff --git a/beast/http/tests/urls_large_data.cpp b/beast/http/tests/urls_large_data.cpp index fb8440c27..60eb0251c 100644 --- a/beast/http/tests/urls_large_data.cpp +++ b/beast/http/tests/urls_large_data.cpp @@ -18,7 +18,7 @@ //============================================================================== #include - + namespace beast { namespace http { diff --git a/beast/insight/Collector.h b/beast/insight/Collector.h index e177c3f6e..954b7fb22 100644 --- a/beast/insight/Collector.h +++ b/beast/insight/Collector.h @@ -49,7 +49,7 @@ public: virtual ~Collector() = 0; /** Create a hook. - + A hook is called at each collection interval, on an implementation defined thread. This is a convenience facility for gathering metrics in the polling style. The typical usage is to update all the metrics @@ -75,7 +75,7 @@ public: */ /** @{ */ virtual Counter make_counter (std::string const& name) = 0; - + Counter make_counter (std::string const& prefix, std::string const& name) { if (prefix.empty ()) @@ -98,7 +98,7 @@ public: } /** @} */ - /** Create a gauge with the specified name. + /** Create a gauge with the specified name. @see Gauge */ /** @{ */ diff --git a/beast/insight/Counter.h b/beast/insight/Counter.h index 6ec79ec3e..268c639c3 100644 --- a/beast/insight/Counter.h +++ b/beast/insight/Counter.h @@ -29,7 +29,7 @@ namespace beast { namespace insight { /** A metric for measuring an integral value. - + A counter is a gauge calculated at the server. The owner of the counter may increment and decrement the value by an amount. diff --git a/beast/insight/CounterImpl.h b/beast/insight/CounterImpl.h index 06f57e805..c970a0721 100644 --- a/beast/insight/CounterImpl.h +++ b/beast/insight/CounterImpl.h @@ -33,7 +33,7 @@ class CounterImpl { public: using value_type = std::int64_t; - + virtual ~CounterImpl () = 0; virtual void increment (value_type amount) = 0; }; diff --git a/beast/insight/Event.h b/beast/insight/Event.h index ae504900f..0e41ded8a 100644 --- a/beast/insight/Event.h +++ b/beast/insight/Event.h @@ -32,7 +32,7 @@ namespace beast { namespace insight { /** A metric for reporting event timing. - + An event is an operation that has an associated millisecond time, or other integral value. Because events happen at a specific moment, the metric only supports a push-style interface. diff --git a/beast/insight/Gauge.h b/beast/insight/Gauge.h index 6e6c580db..60133ec5b 100644 --- a/beast/insight/Gauge.h +++ b/beast/insight/Gauge.h @@ -29,7 +29,7 @@ namespace beast { namespace insight { /** A metric for measuring an integral value. - + A gauge is an instantaneous measurement of a value, like the gas gauge in a car. The caller directly sets the value, or adjusts it by a specified amount. The value is kept in the client rather than the collector. diff --git a/beast/insight/Hook.h b/beast/insight/Hook.h index 1940189f3..31fbfe840 100644 --- a/beast/insight/Hook.h +++ b/beast/insight/Hook.h @@ -27,7 +27,7 @@ namespace beast { namespace insight { - + /** A reference to a handler for performing polled collection. */ class Hook : public Base { diff --git a/beast/insight/Meter.h b/beast/insight/Meter.h index 709b28d5b..a7325aa0b 100644 --- a/beast/insight/Meter.h +++ b/beast/insight/Meter.h @@ -29,7 +29,7 @@ namespace beast { namespace insight { /** A metric for measuring an integral value. - + A meter may be thought of as an increment-only counter. This is a lightweight reference wrapper which is cheap to copy and assign. diff --git a/beast/insight/NullCollector.h b/beast/insight/NullCollector.h index 617b71bf1..0656c94dd 100644 --- a/beast/insight/NullCollector.h +++ b/beast/insight/NullCollector.h @@ -24,7 +24,7 @@ namespace beast { namespace insight { - + /** A Collector which does not collect metrics. */ class NullCollector : public Collector { diff --git a/beast/insight/impl/NullCollector.cpp b/beast/insight/impl/NullCollector.cpp index cf7229de1..b9e407454 100644 --- a/beast/insight/impl/NullCollector.cpp +++ b/beast/insight/impl/NullCollector.cpp @@ -117,7 +117,7 @@ public: { return Gauge (std::make_shared ()); } - + Meter make_meter (std::string const&) { return Meter (std::make_shared ()); diff --git a/beast/insight/impl/StatsDCollector.cpp b/beast/insight/impl/StatsDCollector.cpp index 55f0f5b0c..c180f3e66 100644 --- a/beast/insight/impl/StatsDCollector.cpp +++ b/beast/insight/impl/StatsDCollector.cpp @@ -616,7 +616,7 @@ void StatsDGaugeImpl::flush () void StatsDGaugeImpl::do_set (GaugeImpl::value_type value) { m_value = value; - + if (m_value != m_last_value) { m_last_value = m_value; @@ -641,7 +641,7 @@ void StatsDGaugeImpl::do_increment (GaugeImpl::difference_type amount) { GaugeImpl::value_type const d ( static_cast (-amount)); - value = (d >= value) ? 0 : value - d; + value = (d >= value) ? 0 : value - d; } do_set (value); diff --git a/beast/intrusive/List.h b/beast/intrusive/List.h index d1abe618d..f0bfbe876 100644 --- a/beast/intrusive/List.h +++ b/beast/intrusive/List.h @@ -160,91 +160,91 @@ private: } /** Intrusive doubly linked list. - + This intrusive List is a container similar in operation to std::list in the Standard Template Library (STL). Like all @ref intrusive containers, List requires you to first derive your class from List<>::Node: - + @code - + struct Object : List ::Node { explicit Object (int value) : m_value (value) { } - + int m_value; }; - + @endcode - + Now we define the list, and add a couple of items. - + @code - + List list; - + list.push_back (* (new Object (1))); list.push_back (* (new Object (2))); - + @endcode - + For compatibility with the standard containers, push_back() expects a reference to the object. Unlike the standard container, however, push_back() places the actual object in the list and not a copy-constructed duplicate. - + Iterating over the list follows the same idiom as the STL: - + @code - + for (List ::iterator iter = list.begin(); iter != list.end; ++iter) std::cout << iter->m_value; - + @endcode - + You can even use BOOST_FOREACH, or range based for loops: - + @code - + BOOST_FOREACH (Object& object, list) // boost only std::cout << object.m_value; - + for (Object& object : list) // C++11 only std::cout << object.m_value; - + @endcode - + Because List is mostly STL compliant, it can be passed into STL algorithms: e.g. `std::for_each()` or `std::find_first_of()`. - + In general, objects placed into a List should be dynamically allocated although this cannot be enforced at compile time. Since the caller provides the storage for the object, the caller is also responsible for deleting the object. An object still exists after being removed from a List, until the caller deletes it. This means an element can be moved from one List to another with practically no overhead. - + Unlike the standard containers, an object may only exist in one list at a time, unless special preparations are made. The Tag template parameter is used to distinguish between different list types for the same object, allowing the object to exist in more than one list simultaneously. - + For example, consider an actor system where a global list of actors is maintained, so that they can each be periodically receive processing time. We wish to also maintain a list of the subset of actors that require a domain-dependent update. To achieve this, we declare two tags, the associated list types, and the list element thusly: - + @code - + struct Actor; // Forward declaration required - + struct ProcessTag { }; struct UpdateTag { }; - + using ProcessList = List ; using UpdateList = List ; - + // Derive from both node types so we can be in each list at once. // struct Actor : ProcessList::Node, UpdateList::Node @@ -252,15 +252,15 @@ private: bool process (); // returns true if we need an update void update (); }; - + @endcode - + @tparam T The base type of element which the list will store pointers to. - + @tparam Tag An optional unique type name used to distinguish lists and nodes, when the object can exist in multiple lists simultaneously. - + @ingroup beast_core intrusive */ template diff --git a/beast/intrusive/LockFreeStack.h b/beast/intrusive/LockFreeStack.h index 1fb1b4feb..eae0d1190 100644 --- a/beast/intrusive/LockFreeStack.h +++ b/beast/intrusive/LockFreeStack.h @@ -146,7 +146,7 @@ public: class Node { public: - Node () + Node () : m_next (nullptr) { } @@ -159,7 +159,7 @@ public: private: friend class LockFreeStack; - + template friend class LockFreeStackIterator; @@ -262,7 +262,7 @@ public: { return iterator (&m_end); } - + const_iterator begin () const { return const_iterator (m_head.load ()); @@ -272,7 +272,7 @@ public: { return const_iterator (&m_end); } - + const_iterator cbegin () const { return const_iterator (m_head.load ()); diff --git a/beast/module/asio/HTTPMessage.h b/beast/module/asio/HTTPMessage.h index a3606309e..07f1eeb92 100644 --- a/beast/module/asio/HTTPMessage.h +++ b/beast/module/asio/HTTPMessage.h @@ -62,7 +62,7 @@ public: /** Outputs all the HTTPMessage data excluding the body into a string. */ String toString () const; - + private: HTTPVersion m_version; HTTPHeaders m_headers; diff --git a/beast/module/core/containers/Array.h b/beast/module/core/containers/Array.h index c9d8295b2..dbaf274ab 100644 --- a/beast/module/core/containers/Array.h +++ b/beast/module/core/containers/Array.h @@ -727,7 +727,7 @@ public: if (isPositiveAndBelow (indexToRemove, numUsed)) { - bassert (data.elements != nullptr); + bassert (data.elements != nullptr); ElementType removed (data.elements[indexToRemove]); removeInternal (indexToRemove); return removed; diff --git a/beast/module/core/diagnostic/SemanticVersion.cpp b/beast/module/core/diagnostic/SemanticVersion.cpp index 9a31b4f33..904cfc0a8 100644 --- a/beast/module/core/diagnostic/SemanticVersion.cpp +++ b/beast/module/core/diagnostic/SemanticVersion.cpp @@ -70,7 +70,7 @@ bool chopUInt (int& value, int limit, std::string& input) auto left_iter = std::find_if_not (input.begin (), input.end (), [](std::string::value_type c) { - return std::isdigit (c, std::locale::classic()); + return std::isdigit (c, std::locale::classic()); }); std::string item (input.begin (), left_iter); @@ -163,7 +163,7 @@ bool SemanticVersion::parse (std::string const& input, bool debug) auto left_iter = std::find_if_not (input.begin (), input.end (), [](std::string::value_type c) { - return std::isspace (c, std::locale::classic()); + return std::isspace (c, std::locale::classic()); }); auto right_iter = std::find_if_not (input.rbegin (), input.rend (), diff --git a/beast/module/core/diagnostic/SemanticVersion.h b/beast/module/core/diagnostic/SemanticVersion.h index a2a3311a6..b55a4ef6b 100644 --- a/beast/module/core/diagnostic/SemanticVersion.h +++ b/beast/module/core/diagnostic/SemanticVersion.h @@ -60,7 +60,7 @@ public: std::string print () const; inline bool isRelease () const noexcept - { + { return preReleaseIdentifiers.empty(); } inline bool isPreRelease () const noexcept @@ -75,8 +75,8 @@ public: int compare (SemanticVersion const& lhs, SemanticVersion const& rhs); inline bool -operator== (SemanticVersion const& lhs, SemanticVersion const& rhs) -{ +operator== (SemanticVersion const& lhs, SemanticVersion const& rhs) +{ return compare (lhs, rhs) == 0; } diff --git a/beast/module/core/files/FileOutputStream.h b/beast/module/core/files/FileOutputStream.h index ccb1ec3ad..8e7211be1 100644 --- a/beast/module/core/files/FileOutputStream.h +++ b/beast/module/core/files/FileOutputStream.h @@ -109,4 +109,4 @@ private: } // beast -#endif \ No newline at end of file +#endif diff --git a/beast/module/core/maths/Random.h b/beast/module/core/maths/Random.h index 631c164ab..45b311b20 100644 --- a/beast/module/core/maths/Random.h +++ b/beast/module/core/maths/Random.h @@ -26,7 +26,7 @@ #include #include - + namespace beast { //============================================================================== diff --git a/beast/module/core/streams/InputStream.h b/beast/module/core/streams/InputStream.h index 2a31e03ed..d7d1fd051 100644 --- a/beast/module/core/streams/InputStream.h +++ b/beast/module/core/streams/InputStream.h @@ -91,7 +91,7 @@ public: /** Reads a boolean from the stream. - The bool is encoded as a single byte - non-zero for true, 0 for false. + The bool is encoded as a single byte - non-zero for true, 0 for false. If the stream is exhausted, this will return false. @@ -116,7 +116,7 @@ public: /** Reads two bytes from the stream as a little-endian 16-bit value. - If the next two bytes read are byte1 and byte2, this returns (byte1 | (byte2 << 8)). + If the next two bytes read are byte1 and byte2, this returns (byte1 | (byte2 << 8)). If the stream is exhausted partway through reading the bytes, this will return zero. diff --git a/beast/module/core/streams/MemoryOutputStream.h b/beast/module/core/streams/MemoryOutputStream.h index 82217a9fa..dea2b940d 100644 --- a/beast/module/core/streams/MemoryOutputStream.h +++ b/beast/module/core/streams/MemoryOutputStream.h @@ -43,7 +43,7 @@ namespace beast */ class MemoryOutputStream : public OutputStream -{ +{ public: //============================================================================== /** Creates an empty memory stream, ready to be written into. diff --git a/beast/module/core/text/LexicalCast.h b/beast/module/core/text/LexicalCast.h index 353c13373..ba2907b56 100644 --- a/beast/module/core/text/LexicalCast.h +++ b/beast/module/core/text/LexicalCast.h @@ -73,7 +73,7 @@ parse_negative_integral (Int& num, FwdIt first, FwdIt last) if (limit_digit < 0) limit_digit = -limit_digit; - return parse_integral (num, first, last, + return parse_integral (num, first, last, [limit_value, limit_digit](Int& value, Int digit) { assert ((digit >= 0) && (digit <= 9)); diff --git a/beast/module/core/thread/DeadlineTimer.h b/beast/module/core/thread/DeadlineTimer.h index ba7ff0d71..2567b72d4 100644 --- a/beast/module/core/thread/DeadlineTimer.h +++ b/beast/module/core/thread/DeadlineTimer.h @@ -49,7 +49,7 @@ public: DeadlineTimer (DeadlineTimer const&) = delete; DeadlineTimer& operator= (DeadlineTimer const&) = delete; - + ~DeadlineTimer (); /** Cancel all notifications. diff --git a/beast/module/core/thread/Workers.cpp b/beast/module/core/thread/Workers.cpp index da4cf9f98..a21256d25 100644 --- a/beast/module/core/thread/Workers.cpp +++ b/beast/module/core/thread/Workers.cpp @@ -129,7 +129,7 @@ void Workers::deleteWorkers (LockFreeStack & stack) if (worker != nullptr) { - // This call blocks until the thread orderly exits + // This call blocks until the thread orderly exits delete worker; } else diff --git a/beast/module/core/thread/detail/ScopedLock.h b/beast/module/core/thread/detail/ScopedLock.h index ad690e8d1..43c84acca 100644 --- a/beast/module/core/thread/detail/ScopedLock.h +++ b/beast/module/core/thread/detail/ScopedLock.h @@ -47,7 +47,7 @@ public: { if (m_lock_count > 0) unlock (); - } + } inline void lock (char const* fileName, int lineNumber) noexcept { @@ -233,7 +233,7 @@ public: m_mutex.unlock (); --m_lock_count; } - + private: Mutex const& m_mutex; int m_lock_count; diff --git a/beast/module/core/threads/ScopedLock.h b/beast/module/core/threads/ScopedLock.h index a481a4b83..ca52e582a 100644 --- a/beast/module/core/threads/ScopedLock.h +++ b/beast/module/core/threads/ScopedLock.h @@ -145,7 +145,7 @@ public: */ inline explicit GenericScopedUnlock (LockType& lock) noexcept : lock_ (lock) - { + { lock.unlock(); } diff --git a/beast/net/DynamicBuffer.h b/beast/net/DynamicBuffer.h index 0e4a733d8..78d01078d 100644 --- a/beast/net/DynamicBuffer.h +++ b/beast/net/DynamicBuffer.h @@ -40,7 +40,7 @@ public: /** Create the dynamic buffer with the specified block size. */ explicit DynamicBuffer (size_type blocksize = defaultBlocksize); - + DynamicBuffer (DynamicBuffer const& other); ~DynamicBuffer (); diff --git a/beast/net/IPAddress.h b/beast/net/IPAddress.h index f5bb8bbe9..1f42ab41a 100644 --- a/beast/net/IPAddress.h +++ b/beast/net/IPAddress.h @@ -146,7 +146,7 @@ public: return is_v4 () ? m_v4 == IP::AddressV4::any () : false; // m_v6 == IP::AddressV6::any(); } - + template friend void @@ -198,21 +198,21 @@ public: { return ! (lhs == rhs); } - + friend bool operator> (Address const& lhs, Address const& rhs) { return rhs < lhs; } - + friend bool operator<= (Address const& lhs, Address const& rhs) { return ! (lhs > rhs); } - + friend bool operator>= (Address const& lhs, Address const& rhs) diff --git a/beast/net/IPAddressV4.h b/beast/net/IPAddressV4.h index f47a9776f..24c9e41c5 100644 --- a/beast/net/IPAddressV4.h +++ b/beast/net/IPAddressV4.h @@ -38,7 +38,7 @@ struct AddressV4 AddressV4 (); /** Construct from a 32-bit unsigned. - @note Octets are formed in order from the MSB to the LSB. + @note Octets are formed in order from the MSB to the LSB. */ explicit AddressV4 (std::uint32_t value_); diff --git a/beast/net/impl/DynamicBuffer.cpp b/beast/net/impl/DynamicBuffer.cpp index dc9d26cd3..f7b30acfe 100644 --- a/beast/net/impl/DynamicBuffer.cpp +++ b/beast/net/impl/DynamicBuffer.cpp @@ -74,7 +74,7 @@ void DynamicBuffer::shrink_to_fit () { free (m_buffers.back ()); m_buffers.erase (m_buffers.end () - 1); - } + } } std::string DynamicBuffer::to_string () const diff --git a/beast/net/impl/IPAddressV4.cpp b/beast/net/impl/IPAddressV4.cpp index 69f08cce8..ce1f33a69 100644 --- a/beast/net/impl/IPAddressV4.cpp +++ b/beast/net/impl/IPAddressV4.cpp @@ -26,7 +26,7 @@ #include #include - + namespace beast { namespace IP { diff --git a/beast/nudb/api.h b/beast/nudb/api.h index 4891b364f..a473c62ff 100644 --- a/beast/nudb/api.h +++ b/beast/nudb/api.h @@ -66,7 +66,7 @@ struct api dat_path, key_path, log_path, appnum, salt, key_size, block_size, load_factor, args...); - } + } template static @@ -91,7 +91,7 @@ struct api return nudb::verify( dat_path, key_path, BufferSize); } - + template static bool diff --git a/beast/nudb/detail/varint.h b/beast/nudb/detail/varint.h index 98b116da9..ff138ea51 100644 --- a/beast/nudb/detail/varint.h +++ b/beast/nudb/detail/varint.h @@ -40,7 +40,7 @@ struct varint; // possible size of T represented as varint. // T must be unsigned template ::value> + bool = std::is_unsigned::value> struct varint_traits; template diff --git a/beast/nudb/store.h b/beast/nudb/store.h index a6355e782..4d903b838 100644 --- a/beast/nudb/store.h +++ b/beast/nudb/store.h @@ -62,7 +62,7 @@ namespace nudb { /* TODO - + - fingerprint / checksum on log records - size field at end of data records @@ -550,7 +550,7 @@ store::fetch ( if (item.hash != h) break; // Data Record - auto const len = + auto const len = s_->kh.key_size + // Key item.size; // Value buf0.reserve(len); diff --git a/beast/random/xor_shift_engine.h b/beast/random/xor_shift_engine.h index 3e02a8640..bf773f0df 100644 --- a/beast/random/xor_shift_engine.h +++ b/beast/random/xor_shift_engine.h @@ -47,7 +47,7 @@ public: result_type operator()(); - static + static result_type BEAST_CONSTEXPR min() { diff --git a/beast/smart_ptr/SharedPtr.h b/beast/smart_ptr/SharedPtr.h index db092d4ab..1f5f31a89 100644 --- a/beast/smart_ptr/SharedPtr.h +++ b/beast/smart_ptr/SharedPtr.h @@ -52,9 +52,9 @@ namespace beast { abbreviate the full templated name - e.g. @code - + using MyClassPtr = SharedPtr ; - + @endcode @see SharedObject, SharedObjectArray diff --git a/beast/streams/debug_ostream.h b/beast/streams/debug_ostream.h index 2d95f92b5..fc6322f41 100644 --- a/beast/streams/debug_ostream.h +++ b/beast/streams/debug_ostream.h @@ -67,7 +67,7 @@ public: OutputDebugStringA ((s + "\n").c_str()); return; } - + std::cout << s << std::endl; } }; diff --git a/beast/threads/SharedLockGuard.h b/beast/threads/SharedLockGuard.h index ea387ae3e..a20377d1d 100644 --- a/beast/threads/SharedLockGuard.h +++ b/beast/threads/SharedLockGuard.h @@ -23,7 +23,7 @@ namespace beast { -/** A scoped container that acquires a shared lock. */ +/** A scoped container that acquires a shared lock. */ template class SharedLockGuard { diff --git a/beast/threads/SharedMutexAdapter.h b/beast/threads/SharedMutexAdapter.h index 06e443da1..4dc439a4e 100644 --- a/beast/threads/SharedMutexAdapter.h +++ b/beast/threads/SharedMutexAdapter.h @@ -25,7 +25,7 @@ #include namespace beast { - + /** Adapts a regular Lockable to conform to the SharedMutex concept. Shared locks become unique locks with this interface. Two threads may not simultaneously acquire ownership of the lock. Typically the Mutex template @@ -38,7 +38,7 @@ public: using MutexType = Mutex; using LockGuardType = std::lock_guard ; using SharedLockGuardType = SharedLockGuard ; - + void lock() const { m_mutex.lock(); diff --git a/beast/threads/Stoppable.h b/beast/threads/Stoppable.h index 873ee2fb1..e08810770 100644 --- a/beast/threads/Stoppable.h +++ b/beast/threads/Stoppable.h @@ -64,7 +64,7 @@ class RootStoppable; This override is called for all Stoppable objects in the hierarchy during the prepare stage. It is guaranteed that all child Stoppable objects have already been prepared when this is called. - + Objects are called children first. 4. start() @@ -127,7 +127,7 @@ class RootStoppable; funtion areChildrenStopped() can be used after children have stopped, but before the Stoppable logic itself has stopped, to determine if the stoppable's logic is a true stop. - + Pseudo code for this process is as follows: @code @@ -236,7 +236,7 @@ private: onStop and onChildrenStopped will never be called concurrently, across all Stoppable objects descended from the same root, inclusive of the root. - + It is safe to call isStopping, isStopped, and areChildrenStopped from within this function; The values returned will always be valid and never change during the callback. diff --git a/beast/threads/Thread.h b/beast/threads/Thread.h index f6ce9b3e8..ddf1850f7 100644 --- a/beast/threads/Thread.h +++ b/beast/threads/Thread.h @@ -56,7 +56,7 @@ public: Thread (Thread const&) = delete; Thread& operator= (Thread const&) = delete; - + /** Destructor. If the thread has not been stopped first, this will generate a fatal error. diff --git a/beast/unit_test/match.h b/beast/unit_test/match.h index 74e77b973..cc9b2b014 100644 --- a/beast/unit_test/match.h +++ b/beast/unit_test/match.h @@ -136,7 +136,7 @@ selector::operator() (suite_info const& s) The predicate checks the suite, module, and library fields of the suite_info in that order. When it finds a match, it changes modes depending on what was found: - + If a suite is matched first, then only the suite is selected. The suite may be marked manual. diff --git a/beast/unit_test/thread.h b/beast/unit_test/thread.h index 2f025c0f0..b2ac684a7 100644 --- a/beast/unit_test/thread.h +++ b/beast/unit_test/thread.h @@ -62,7 +62,7 @@ public: thread (suite& s, F&& f, Args&&... args) : s_ (&s) { - std::function b = + std::function b = std::bind(std::forward(f), std::forward(args)...); t_ = std::thread (&thread::run, this, diff --git a/beast/utility/Debug.h b/beast/utility/Debug.h index f43b3ae2e..7a9e1896b 100644 --- a/beast/utility/Debug.h +++ b/beast/utility/Debug.h @@ -21,7 +21,7 @@ #define BEAST_UTILITY_DEBUG_H_INCLUDED #include - + namespace beast { // Auxiliary outines for debugging diff --git a/beast/utility/Journal.h b/beast/utility/Journal.h index 0e6a7aeb3..3b4171f36 100644 --- a/beast/utility/Journal.h +++ b/beast/utility/Journal.h @@ -175,7 +175,7 @@ public: /** Returns `true` if sink logs anything at this stream's severity. */ /** @{ */ bool active() const; - + explicit operator bool() const { diff --git a/beast/utility/PropertyStream.h b/beast/utility/PropertyStream.h index d81317310..cdedf01eb 100644 --- a/beast/utility/PropertyStream.h +++ b/beast/utility/PropertyStream.h @@ -214,7 +214,7 @@ public: add (ss.str(), value); } - Proxy operator[] (std::string const& key); + Proxy operator[] (std::string const& key); Proxy operator[] (char const* key) { return Proxy (*this, key); } @@ -364,7 +364,7 @@ public: static bool peel_leading_slash (std::string* path); static bool peel_trailing_slashstar (std::string* path); - static std::string peel_name(std::string* path); + static std::string peel_name(std::string* path); //-------------------------------------------------------------------------- diff --git a/beast/utility/impl/Debug.cpp b/beast/utility/impl/Debug.cpp index e533df760..30b17840c 100644 --- a/beast/utility/impl/Debug.cpp +++ b/beast/utility/impl/Debug.cpp @@ -196,7 +196,7 @@ public: log << "_DEBUG = " << String::fromNumber (envDebug ()); - + log << "BEAST_DEBUG = " << String::fromNumber (beastDebug ()); diff --git a/beast/utility/impl/PropertyStream.cpp b/beast/utility/impl/PropertyStream.cpp index 9f521fc1c..de271a06a 100644 --- a/beast/utility/impl/PropertyStream.cpp +++ b/beast/utility/impl/PropertyStream.cpp @@ -310,12 +310,12 @@ std::string PropertyStream::Source::peel_name (std::string* path) { if (path->empty()) return ""; - + std::string::const_iterator first = (*path).begin(); std::string::const_iterator last = (*path).end(); std::string::const_iterator pos (std::find (first, last, '/')); std::string s (first, pos); - + if (pos != last) *path = std::string (pos+1, last); else @@ -352,7 +352,7 @@ PropertyStream::Source* PropertyStream::Source::find_path (std::string path) break; source = source->find_one(name); } - while (source != nullptr); + while (source != nullptr); return source; } @@ -636,7 +636,7 @@ public: } } - void test_peel_trailing_slashstar (std::string s, + void test_peel_trailing_slashstar (std::string s, std::string const& expected_remainder, bool should_be_found) { try @@ -648,7 +648,7 @@ public: catch (...) { fail ("unhandled exception");; - } + } } void test_find_one (Source& root, Source* expected, std::string const& name) @@ -692,7 +692,7 @@ public: } } - void test_find (Source& root, std::string path, Source* expected, + void test_find (Source& root, std::string path, Source* expected, bool expected_star) { try @@ -759,8 +759,8 @@ public: test_find_one (d, &f, "f"); testcase ("find_path"); - test_find_path (a, "a", nullptr); - test_find_path (a, "e", nullptr); + test_find_path (a, "a", nullptr); + test_find_path (a, "e", nullptr); test_find_path (a, "a/b", nullptr); test_find_path (a, "a/b/e", nullptr); test_find_path (a, "b/e/g", nullptr); @@ -768,7 +768,7 @@ public: test_find_path (a, "b", &b); test_find_path (a, "b/e", &e); test_find_path (a, "b/d/f", &f); - + testcase ("find_one_deep"); test_find_one_deep (a, "z", nullptr); test_find_one_deep (a, "g", &g); diff --git a/beast/utility/meta.h b/beast/utility/meta.h index e7af4e1f4..4098fadc6 100644 --- a/beast/utility/meta.h +++ b/beast/utility/meta.h @@ -71,16 +71,16 @@ struct enable_if_lvalue }; /** Ensure const reference function parameters are valid lvalues. - + Some functions, especially class constructors, accept const references and - store them for later use. If any of those parameters are rvalue objects, - the object will be freed as soon as the function returns. This could + store them for later use. If any of those parameters are rvalue objects, + the object will be freed as soon as the function returns. This could potentially lead to a variety of "use after free" errors. - - If the function is rewritten as a template using this type and the + + If the function is rewritten as a template using this type and the parameters references as rvalue references (eg. TX&&), a compiler error will be generated if an rvalue is provided in the caller. - + @code // Example: struct X diff --git a/beast/utility/static_initializer.h b/beast/utility/static_initializer.h index 237af40b4..99917f19a 100644 --- a/beast/utility/static_initializer.h +++ b/beast/utility/static_initializer.h @@ -145,7 +145,7 @@ static_initializer ::static_initializer (Args&&... args) { try { - ::new(t) T (std::forward(args)...); + ::new(t) T (std::forward(args)...); static destroyer on_exit (t); _InterlockedIncrement(&_.state); } @@ -198,7 +198,7 @@ public: static_initializer (Args&&... args); static_initializer (); - + T& get() noexcept { diff --git a/beast/utility/tests/Journal.test.cpp b/beast/utility/tests/Journal.test.cpp index b08f48b10..3196f7fcf 100644 --- a/beast/utility/tests/Journal.test.cpp +++ b/beast/utility/tests/Journal.test.cpp @@ -62,7 +62,7 @@ public: sink.severity(Journal::kInfo); Journal j(sink); - + j.trace << " "; expect(sink.count() == 0); j.debug << " "; diff --git a/beast/utility/tests/tagged_integer.test.cpp b/beast/utility/tests/tagged_integer.test.cpp index 2e011c025..32f4d58df 100644 --- a/beast/utility/tests/tagged_integer.test.cpp +++ b/beast/utility/tests/tagged_integer.test.cpp @@ -28,7 +28,7 @@ namespace beast { -class tagged_integer_test +class tagged_integer_test : public unit_test::suite { private: @@ -112,7 +112,7 @@ public: expect (zero >= zero, "Should be greater than or equal"); expect (zero == zero, "Should be equal"); - + expect (one > zero, "Should be greater"); expect (one >= zero, "Should be greater than or equal"); expect (one != zero, "Should not be equal"); @@ -140,7 +140,7 @@ public: expect(++tmp == one, "Should be equal"); tmp = zero; - + tmp += 1u; expect(tmp == one, "Should be equal"); diff --git a/beast/utility/tests/weak_fn.test.cpp b/beast/utility/tests/weak_fn.test.cpp index 6d551ab78..27ff3fa4c 100644 --- a/beast/utility/tests/weak_fn.test.cpp +++ b/beast/utility/tests/weak_fn.test.cpp @@ -86,7 +86,7 @@ public: std::bind(weak_fn(&T::fi, p), 1)(); expect(called); } - + { bool called = false; auto p = std::make_shared(called); diff --git a/beast/weak_fn.h b/beast/weak_fn.h index b15982c1b..f3e78cc4f 100644 --- a/beast/weak_fn.h +++ b/beast/weak_fn.h @@ -111,7 +111,7 @@ public: if(auto p = object_.lock()) return ((*p).*member_)(args...); return this->member()(); - } + } }; } // detail @@ -120,11 +120,11 @@ public: When called, it tries to lock weak_ptr to get a shared_ptr. If successful, it calls given member function with given arguments. If not successful, the policy functor is called. Built-in policies are: - + ignore_if_invalid does nothing throw_if_invalid throws `bad_weak_ptr` return_default_if_invalid returns a chosen value - + Example: struct Foo { @@ -138,12 +138,12 @@ public: std::cout << "outdated reference" << std::endl; } }; - + int main() { std::shared_ptr sp(new Foo()); std::weak_ptr wp(sp); - + std::bind(weak_fn(&Foo::bar, wp), _1)(1); sp.reset(); std::bind(weak_fn(&Foo::bar, wp), 1)();