diff --git a/src/ripple/module/app/ledger/InboundLedger.cpp b/src/ripple/module/app/ledger/InboundLedger.cpp index c9f87367609..b0201de90c6 100644 --- a/src/ripple/module/app/ledger/InboundLedger.cpp +++ b/src/ripple/module/app/ledger/InboundLedger.cpp @@ -69,7 +69,7 @@ InboundLedger::~InboundLedger () { // Save any received AS data not processed. It could be useful // for populating a different ledger - BOOST_FOREACH (PeerDataPairType& entry, mReceivedData) + for (auto& entry : mReceivedData) { if (entry.second->type () == protocol::liAS_NODE) getApp().getInboundLedgers().gotStaleData(entry.second); @@ -164,8 +164,7 @@ bool InboundLedger::tryLocal () if (mLedger->peekTransactionMap ()->fetchRoot ( mLedger->getTransHash (), &filter)) { - std::vector h (mLedger->getNeededTransactionHashes ( - 1, &filter)); + auto h (mLedger->getNeededTransactionHashes (1, &filter)); if (h.empty ()) { @@ -193,8 +192,7 @@ bool InboundLedger::tryLocal () if (mLedger->peekAccountStateMap ()->fetchRoot ( mLedger->getAccountHash (), &filter)) { - std::vector h (mLedger->getNeededAccountStateHashes ( - 1, &filter)); + auto h (mLedger->getNeededAccountStateHashes (1, &filter)); if (h.empty ()) { @@ -459,7 +457,7 @@ void InboundLedger::trigger (Peer::ptr const& peer) if (!isProgress () && !mFailed && mByHash && ( getTimeouts () > ledgerBecomeAggressiveThreshold)) { - std::vector need = getNeededHashes (); + auto need = getNeededHashes (); if (!need.empty ()) { @@ -467,7 +465,7 @@ void InboundLedger::trigger (Peer::ptr const& peer) tmBH.set_query (true); tmBH.set_ledgerhash (mHash.begin (), mHash.size ()); bool typeSet = false; - BOOST_FOREACH (neededHash_t & p, need) + for (auto& p : need) { if (m_journal.warning) m_journal.warning << "Want: " << p.second; @@ -1009,9 +1007,7 @@ std::vector InboundLedger::getNeededHashes () { AccountStateSF filter (mLedger->getLedgerSeq ()); // VFALCO NOTE What's the number 4? - std::vector v = mLedger->getNeededAccountStateHashes ( - 4, &filter); - BOOST_FOREACH (uint256 const & h, v) + for (auto const& h : mLedger->getNeededAccountStateHashes (4, &filter)) { ret.push_back (std::make_pair ( protocol::TMGetObjectByHash::otSTATE_NODE, h)); @@ -1022,9 +1018,7 @@ std::vector InboundLedger::getNeededHashes () { TransactionStateSF filter (mLedger->getLedgerSeq ()); // VFALCO NOTE What's the number 4? - std::vector v = mLedger->getNeededTransactionHashes ( - 4, &filter); - BOOST_FOREACH (uint256 const & h, v) + for (auto const& h : mLedger->getNeededTransactionHashes (4, &filter)) { ret.push_back (std::make_pair ( protocol::TMGetObjectByHash::otTRANSACTION_NODE, h)); @@ -1198,7 +1192,7 @@ void InboundLedger::runData () // Select the peer that gives us the most nodes that are useful, // breaking ties in favor of the peer that responded first. - BOOST_FOREACH (PeerDataPairType& entry, data) + for (auto& entry : data) { Peer::ptr peer = entry.first.lock(); if (peer) @@ -1257,7 +1251,6 @@ Json::Value InboundLedger::getJson (int) // VFALCO Why 16? auto v = mLedger->getNeededAccountStateHashes (16, nullptr); - for (auto const& h : v) { hv.append (to_string (h)); @@ -1270,7 +1263,6 @@ Json::Value InboundLedger::getJson (int) Json::Value hv (Json::arrayValue); // VFALCO Why 16? auto v = mLedger->getNeededTransactionHashes (16, nullptr); - for (auto const& h : v) { hv.append (to_string (h)); diff --git a/src/ripple/module/app/main/IoServicePool.cpp b/src/ripple/module/app/main/IoServicePool.cpp index 599a8d72f83..9e553e28b33 100644 --- a/src/ripple/module/app/main/IoServicePool.cpp +++ b/src/ripple/module/app/main/IoServicePool.cpp @@ -69,6 +69,7 @@ IoServicePool::IoServicePool (Stoppable& parent, std::string const& name, , m_service (numberOfThreads) , m_work (std::ref (m_service)) , m_threadsDesired (numberOfThreads) + , m_threadsRunning (0) { bassert (m_threadsDesired > 0); } @@ -125,7 +126,7 @@ void IoServicePool::onThreadExit() bassert (isStopping()); // must have at least count 1 - bassert (m_threadsRunning.get() > 0); + bassert (m_threadsRunning.load() > 0); if (--m_threadsRunning == 0) { diff --git a/src/ripple/module/app/main/IoServicePool.h b/src/ripple/module/app/main/IoServicePool.h index 9848382a0cd..c8cbf96d4f6 100644 --- a/src/ripple/module/app/main/IoServicePool.h +++ b/src/ripple/module/app/main/IoServicePool.h @@ -24,6 +24,8 @@ #include #include +#include + namespace ripple { /** An io_service with an associated group of threads. */ @@ -50,7 +52,7 @@ class IoServicePool : public beast::Stoppable boost::optional m_work; std::vector > m_threads; int m_threadsDesired; - beast::Atomic m_threadsRunning; + std::atomic m_threadsRunning; }; } // ripple diff --git a/src/ripple/module/app/paths/PathRequests.h b/src/ripple/module/app/paths/PathRequests.h index 92e496c43b7..373496d7944 100644 --- a/src/ripple/module/app/paths/PathRequests.h +++ b/src/ripple/module/app/paths/PathRequests.h @@ -20,6 +20,8 @@ #ifndef RIPPLE_PATHREQUESTS_H #define RIPPLE_PATHREQUESTS_H +#include + namespace ripple { class PathRequests @@ -66,7 +68,7 @@ class PathRequests // Use a RippleLineCache RippleLineCache::pointer mLineCache; - beast::Atomic mLastIdentifier; + std::atomic mLastIdentifier; typedef RippleRecursiveMutex LockType; typedef std::lock_guard ScopedLockType; diff --git a/src/ripple/module/app/shamap/SHAMapSync.cpp b/src/ripple/module/app/shamap/SHAMapSync.cpp index 25a361a75d1..8547b2cafd4 100644 --- a/src/ripple/module/app/shamap/SHAMapSync.cpp +++ b/src/ripple/module/app/shamap/SHAMapSync.cpp @@ -651,15 +651,6 @@ bool SHAMap::hasLeafNode (uint256 const& tag, uint256 const& targetNodeHash) return false; // If this was a matching leaf, we would have caught it already } -#if 0 -static -void addFPtoList (std::list& list, - const uint256& hash, const Blob& blob) -{ - list.push_back (SHAMap::fetchPackEntry_t (hash, blob)); -} -#endif - /** @param have A pointer to the map that the recipient already has (if any). @param includeLeaves True if leaf nodes should be included. diff --git a/src/ripple/module/data/protocol/STInteger.h b/src/ripple/module/data/protocol/STInteger.h index eea54fb3477..54a2851c6d8 100644 --- a/src/ripple/module/data/protocol/STInteger.h +++ b/src/ripple/module/data/protocol/STInteger.h @@ -28,7 +28,7 @@ template class STInteger : public SerializedType { public: - STInteger (Integer v = 0) : value_ (v) + explicit STInteger (Integer v) : value_ (v) { } diff --git a/src/ripple/module/net/rpc/InfoSub.cpp b/src/ripple/module/net/rpc/InfoSub.cpp index 76e1d79a8e6..3d190979d91 100644 --- a/src/ripple/module/net/rpc/InfoSub.cpp +++ b/src/ripple/module/net/rpc/InfoSub.cpp @@ -17,6 +17,8 @@ */ //============================================================================== +#include + namespace ripple { // This is the primary interface into the "client" portion of the program. @@ -43,7 +45,7 @@ InfoSub::InfoSub (Source& source, Consumer consumer) : m_consumer (consumer) , m_source (source) { - static beast::Atomic s_seq_id; + static std::atomic s_seq_id (0); mSeq = ++s_seq_id; } diff --git a/src/ripple/overlay/impl/OverlayImpl.cpp b/src/ripple/overlay/impl/OverlayImpl.cpp index b3e2eb79095..7eed243e0df 100644 --- a/src/ripple/overlay/impl/OverlayImpl.cpp +++ b/src/ripple/overlay/impl/OverlayImpl.cpp @@ -73,6 +73,7 @@ OverlayImpl::OverlayImpl (Stoppable& parent, , m_io_service (io_service) , m_ssl_context (ssl_context) , m_resolver (resolver) + , m_nextShortId (0) { } diff --git a/src/ripple/overlay/impl/OverlayImpl.h b/src/ripple/overlay/impl/OverlayImpl.h index 63c94994b67..a70ab042ea6 100644 --- a/src/ripple/overlay/impl/OverlayImpl.h +++ b/src/ripple/overlay/impl/OverlayImpl.h @@ -33,6 +33,7 @@ #include #include // +#include #include #include #include @@ -92,7 +93,7 @@ class OverlayImpl Resolver& m_resolver; /** Monotically increasing identifiers for peers */ - beast::Atomic m_nextShortId; + std::atomic m_nextShortId; //--------------------------------------------------------------------------