From 75c8d7aa5731eb1d738df82f362e6e3b2e20922d Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Tue, 14 Oct 2014 17:27:16 -0400 Subject: [PATCH] Detab beast --- beast/chrono/impl/RelativeTime.cpp | 94 ++++---- beast/container/cyclic_iterator.h | 230 ++++++++++---------- beast/container/impl/spookyv2.cpp | 8 +- beast/crypto/Sha256.h | 6 +- beast/crypto/impl/UnsignedInteger.cpp | 16 +- beast/http/rfc2616.h | 36 +-- beast/http/tests/urls_large_data.cpp | 4 +- beast/module/core/native/mac_SystemStats.mm | 4 +- beast/threads/ServiceQueue.h | 2 +- 9 files changed, 200 insertions(+), 200 deletions(-) diff --git a/beast/chrono/impl/RelativeTime.cpp b/beast/chrono/impl/RelativeTime.cpp index caf8131bac..a08e3558bd 100644 --- a/beast/chrono/impl/RelativeTime.cpp +++ b/beast/chrono/impl/RelativeTime.cpp @@ -256,7 +256,7 @@ std::string RelativeTime::to_string () const } } - + #if BEAST_WINDOWS #include @@ -266,12 +266,12 @@ namespace detail { static double monotonicCurrentTimeInSeconds() { - return GetTickCount64() / 1000.0; + return GetTickCount64() / 1000.0; } } } - + #elif BEAST_MAC || BEAST_IOS #include @@ -279,39 +279,39 @@ static double monotonicCurrentTimeInSeconds() namespace beast { namespace detail { - + static double monotonicCurrentTimeInSeconds() { - struct StaticInitializer - { - StaticInitializer () - { - double numerator; - double denominator; + struct StaticInitializer + { + StaticInitializer () + { + double numerator; + double denominator; - mach_timebase_info_data_t timebase; - (void) mach_timebase_info (&timebase); - - if (timebase.numer % 1000000 == 0) - { - numerator = timebase.numer / 1000000.0; - denominator = timebase.denom * 1000.0; - } - else - { - numerator = timebase.numer; + mach_timebase_info_data_t timebase; + (void) mach_timebase_info (&timebase); + + if (timebase.numer % 1000000 == 0) + { + numerator = timebase.numer / 1000000.0; + denominator = timebase.denom * 1000.0; + } + else + { + numerator = timebase.numer; // VFALCO NOTE I don't understand this code - //denominator = timebase.denom * (std::uint64_t) 1000000 * 1000.0; + //denominator = timebase.denom * (std::uint64_t) 1000000 * 1000.0; denominator = timebase.denom * 1000000000.0; - } - - ratio = numerator / denominator; - } + } + + ratio = numerator / denominator; + } - double ratio; - }; - - static StaticInitializer const data; + double ratio; + }; + + static StaticInitializer const data; return mach_absolute_time() * data.ratio; } @@ -319,7 +319,7 @@ static double monotonicCurrentTimeInSeconds() } #else - + #include namespace beast { @@ -327,14 +327,14 @@ namespace detail { static double monotonicCurrentTimeInSeconds() { - timespec t; - clock_gettime (CLOCK_MONOTONIC, &t); - return t.tv_sec + t.tv_nsec / 1000000000.0; + timespec t; + clock_gettime (CLOCK_MONOTONIC, &t); + return t.tv_sec + t.tv_nsec / 1000000000.0; } } } - + #endif namespace beast { @@ -343,37 +343,37 @@ namespace detail { // Records and returns the time from process startup static double getStartupTime() { - struct StaticInitializer - { - StaticInitializer () - { + struct StaticInitializer + { + StaticInitializer () + { when = detail::monotonicCurrentTimeInSeconds(); } - + double when; - }; + }; - static StaticInitializer const data; + static StaticInitializer const data; - return data.when; + return data.when; } // Used to call getStartupTime as early as possible struct StartupTimeStaticInitializer { - StartupTimeStaticInitializer () - { + StartupTimeStaticInitializer () + { getStartupTime(); } }; static StartupTimeStaticInitializer startupTimeStaticInitializer; - + } RelativeTime RelativeTime::fromStartup () { - return RelativeTime ( + return RelativeTime ( detail::monotonicCurrentTimeInSeconds() - detail::getStartupTime()); } diff --git a/beast/container/cyclic_iterator.h b/beast/container/cyclic_iterator.h index 27e4417232..2e5c63ca32 100644 --- a/beast/container/cyclic_iterator.h +++ b/beast/container/cyclic_iterator.h @@ -141,154 +141,154 @@ Here is a short example demonstrating its use. \snippet cyclic_iterator.cpp cyclic_iterator */ template< - typename ContainerIterator + typename ContainerIterator > class cyclic_iterator : - public detail::cyclic_iterator_base< - ContainerIterator - >::type + public detail::cyclic_iterator_base< + ContainerIterator + >::type { public: - /** - \brief The base type which is a boost::iterator_facade - */ - typedef typename detail::cyclic_iterator_base< - ContainerIterator - >::type base_type; + /** + \brief The base type which is a boost::iterator_facade + */ + typedef typename detail::cyclic_iterator_base< + ContainerIterator + >::type base_type; - /** - \brief The underlying iterator type - */ - typedef ContainerIterator container_iterator_type; + /** + \brief The underlying iterator type + */ + typedef ContainerIterator container_iterator_type; - /** - \brief The value type adapted from \a ContainerIterator - */ - typedef typename base_type::value_type value_type; + /** + \brief The value type adapted from \a ContainerIterator + */ + typedef typename base_type::value_type value_type; - /** - \brief The reference type adapted from \a ContainerIterator - */ - typedef typename base_type::reference reference; + /** + \brief The reference type adapted from \a ContainerIterator + */ + typedef typename base_type::reference reference; - /** - \brief The pointer type adapted from \a ContainerIterator - */ - typedef typename base_type::pointer pointer; + /** + \brief The pointer type adapted from \a ContainerIterator + */ + typedef typename base_type::pointer pointer; - /** - \brief The difference type adapted from \a ContainerIterator - */ - typedef typename base_type::difference_type difference_type; + /** + \brief The difference type adapted from \a ContainerIterator + */ + typedef typename base_type::difference_type difference_type; - /** - \brief The iterator category, either Forward or Bidirectional - */ - typedef typename base_type::iterator_category iterator_category; + /** + \brief The iterator category, either Forward or Bidirectional + */ + typedef typename base_type::iterator_category iterator_category; - /** - \brief Creates a singular iterator - */ - cyclic_iterator(); + /** + \brief Creates a singular iterator + */ + cyclic_iterator(); - /** - \brief Copy constructs from another cyclic iterator + /** + \brief Copy constructs from another cyclic iterator - Copy constructs from another cyclic iterator \a other. This only works - if the underlying iterators are convertible. + Copy constructs from another cyclic iterator \a other. This only works + if the underlying iterators are convertible. - \param other The iterator to copy construct from - */ - template< - typename OtherIterator - > - explicit - cyclic_iterator( - cyclic_iterator const &other - ); + \param other The iterator to copy construct from + */ + template< + typename OtherIterator + > + explicit + cyclic_iterator( + cyclic_iterator const &other + ); - /** - \brief Constructs a new cyclic iterator + /** + \brief Constructs a new cyclic iterator - Constructs a new cyclic iterator, starting at \a it, inside - a range from \a begin to \a end. + Constructs a new cyclic iterator, starting at \a it, inside + a range from \a begin to \a end. - \param pos The start of the iterator - \param begin The beginning of the range - \param end The end of the range + \param pos The start of the iterator + \param begin The beginning of the range + \param end The end of the range - \warning The behaviour is undefined if \a pos isn't between \a begin - and \a end. Also, the behaviour is undefined, if \a begin and \a end - don't form a valid range. - */ - cyclic_iterator( - container_iterator_type const &pos, - container_iterator_type const &begin, - container_iterator_type const &end - ); + \warning The behaviour is undefined if \a pos isn't between \a begin + and \a end. Also, the behaviour is undefined, if \a begin and \a end + don't form a valid range. + */ + cyclic_iterator( + container_iterator_type const &pos, + container_iterator_type const &begin, + container_iterator_type const &end + ); - /** - \brief Assigns from another cyclic iterator + /** + \brief Assigns from another cyclic iterator - Assigns from another cyclic iterator \a other. This only works if the - underlying iterators are convertible. + Assigns from another cyclic iterator \a other. This only works if the + underlying iterators are convertible. - \param other The iterator to assign from + \param other The iterator to assign from - \return *this - */ - template< - typename OtherIterator - > - cyclic_iterator & - operator=( - cyclic_iterator const &other - ); + \return *this + */ + template< + typename OtherIterator + > + cyclic_iterator & + operator=( + cyclic_iterator const &other + ); - /** - \brief Returns the beginning of the range - */ - container_iterator_type - begin() const; + /** + \brief Returns the beginning of the range + */ + container_iterator_type + begin() const; - /** - \brief Returns the end of the range - */ - container_iterator_type - end() const; + /** + \brief Returns the end of the range + */ + container_iterator_type + end() const; - /** - \brief Returns the underlying iterator - */ - container_iterator_type - get() const; + /** + \brief Returns the underlying iterator + */ + container_iterator_type + get() const; private: - friend class boost::iterator_core_access; + friend class boost::iterator_core_access; - void - increment(); + void + increment(); - void - decrement(); + void + decrement(); - bool - equal( - cyclic_iterator const & - ) const; + bool + equal( + cyclic_iterator const & + ) const; - reference - dereference() const; + reference + dereference() const; - difference_type - distance_to( - cyclic_iterator const & - ) const; + difference_type + distance_to( + cyclic_iterator const & + ) const; private: - container_iterator_type - it_, - begin_, - end_; + container_iterator_type + it_, + begin_, + end_; }; // diff --git a/beast/container/impl/spookyv2.cpp b/beast/container/impl/spookyv2.cpp index 11e8220ea4..8195eb6cc1 100644 --- a/beast/container/impl/spookyv2.cpp +++ b/beast/container/impl/spookyv2.cpp @@ -166,7 +166,7 @@ void SpookyHash::Hash128( while (u.p64 < end) { Mix(u.p64, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11); - u.p64 += sc_numVars; + u.p64 += sc_numVars; } } else @@ -175,7 +175,7 @@ void SpookyHash::Hash128( { memcpy(buf, u.p64, sc_blockSize); Mix(buf, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11); - u.p64 += sc_numVars; + u.p64 += sc_numVars; } } @@ -275,7 +275,7 @@ void SpookyHash::Update(const void *message, size_t length) while (u.p64 < end) { Mix(u.p64, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11); - u.p64 += sc_numVars; + u.p64 += sc_numVars; } } else @@ -284,7 +284,7 @@ void SpookyHash::Update(const void *message, size_t length) { 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; + u.p64 += sc_numVars; } } diff --git a/beast/crypto/Sha256.h b/beast/crypto/Sha256.h index 538a3a0118..a772ccb04e 100644 --- a/beast/crypto/Sha256.h +++ b/beast/crypto/Sha256.h @@ -42,9 +42,9 @@ typedef std::array digest_type; namespace detail { struct Context { - std::uint32_t state[8]; - std::uint64_t bitcount; - std::uint8_t buffer[Sha256::blockLength]; + std::uint32_t state[8]; + std::uint64_t bitcount; + std::uint8_t buffer[Sha256::blockLength]; }; } diff --git a/beast/crypto/impl/UnsignedInteger.cpp b/beast/crypto/impl/UnsignedInteger.cpp index a2b36da343..a9447f2a5b 100644 --- a/beast/crypto/impl/UnsignedInteger.cpp +++ b/beast/crypto/impl/UnsignedInteger.cpp @@ -154,14 +154,14 @@ void subtract_integer(integer left, integer right, integer result) { double_component_t lhs = left.c[i]; double_component_t rhs = (i < right.num_components) ? right.c[i] : 0; if (borrow) { - if (lhs <= rhs) { - /* leave borrow set to 1 */ - lhs += (MAX_COMPONENT + 1) - 1; - } else { - borrow = 0; - lhs--; - } - } + if (lhs <= rhs) { + /* leave borrow set to 1 */ + lhs += (MAX_COMPONENT + 1) - 1; + } else { + borrow = 0; + lhs--; + } + } if (lhs < rhs) { borrow = 1; lhs += MAX_COMPONENT + 1; diff --git a/beast/http/rfc2616.h b/beast/http/rfc2616.h index caa57acabb..0e3819eff9 100644 --- a/beast/http/rfc2616.h +++ b/beast/http/rfc2616.h @@ -55,7 +55,7 @@ is_white (CharT c) case '\r': case '\t': case '\v': return true; }; - return false; + return false; } /** Returns `true` if `c` is a control character. */ @@ -85,24 +85,24 @@ template FwdIter trim_left (FwdIter first, FwdIter last) { - return std::find_if_not (first, last, - &is_white ); + return std::find_if_not (first, last, + &is_white ); } template FwdIter trim_right (FwdIter first, FwdIter last) { - if (first == last) - return last; - do - { - --last; - if (! is_white (*last)) - return ++last; - } - while (last != first); - return first; + if (first == last) + return last; + do + { + --last; + if (! is_white (*last)) + return ++last; + } + while (last != first); + return first; } template @@ -118,9 +118,9 @@ template std::pair trim (FwdIter first, FwdIter last) { - first = trim_left (first, last); - last = trim_right (first, last); - return std::make_pair (first, last); + first = trim_left (first, last); + last = trim_right (first, last); + return std::make_pair (first, last); } template @@ -131,7 +131,7 @@ trim (String const& s) using std::end; auto first (begin(s)); auto last (end(s)); - std::tie (first, last) = trim (first, last); + std::tie (first, last) = trim (first, last); return { first, last }; } @@ -143,7 +143,7 @@ trim_right (String const& s) using std::end; auto first (begin(s)); auto last (end(s)); - last = trim_right (first, last); + last = trim_right (first, last); return { first, last }; } diff --git a/beast/http/tests/urls_large_data.cpp b/beast/http/tests/urls_large_data.cpp index 2a870a3187..fb8440c27e 100644 --- a/beast/http/tests/urls_large_data.cpp +++ b/beast/http/tests/urls_large_data.cpp @@ -28,7 +28,7 @@ namespace http { std::vector const& urls_large_data() { - static std::vector const urls ({ + static std::vector const urls ({ "google.com", "facebook.com", "youtube.com", @@ -10030,7 +10030,7 @@ urls_large_data() "18schoolgirlz.com" }); - return urls; + return urls; } } diff --git a/beast/module/core/native/mac_SystemStats.mm b/beast/module/core/native/mac_SystemStats.mm index ba94883f74..c30a042585 100644 --- a/beast/module/core/native/mac_SystemStats.mm +++ b/beast/module/core/native/mac_SystemStats.mm @@ -247,8 +247,8 @@ private: static HiResCounterHandler& hiResCounterHandler() { - static HiResCounterHandler hiResCounterHandler; - return hiResCounterHandler; + static HiResCounterHandler hiResCounterHandler; + return hiResCounterHandler; } std::uint32_t beast_millisecondsSinceStartup() noexcept { return hiResCounterHandler().millisecondsSinceStartup(); } diff --git a/beast/threads/ServiceQueue.h b/beast/threads/ServiceQueue.h index 3d0e60428c..76a933db6c 100644 --- a/beast/threads/ServiceQueue.h +++ b/beast/threads/ServiceQueue.h @@ -352,7 +352,7 @@ protected: void wait(); virtual void enqueue (Item* item); - bool empty(); + bool empty(); virtual std::size_t dequeue() = 0; virtual Waiter* new_waiter() = 0;