From 70d9d88cdab895e8e0a7577b3894426fc617437e Mon Sep 17 00:00:00 2001 From: Joe Loser Date: Fri, 13 Jul 2018 21:08:20 -0400 Subject: [PATCH] Remove using namespace beast in base_uint.h --- src/ripple/app/ledger/Ledger.cpp | 2 +- src/ripple/app/ledger/impl/LedgerCleaner.cpp | 2 +- src/ripple/app/ledger/impl/LedgerMaster.cpp | 2 +- .../app/ledger/impl/TransactionMaster.cpp | 2 +- src/ripple/app/misc/CanonicalTXSet.cpp | 4 +-- src/ripple/app/misc/NetworkOPs.cpp | 2 +- src/ripple/app/paths/AccountCurrencies.cpp | 2 +- src/ripple/app/paths/NodeDirectory.h | 4 +-- src/ripple/app/paths/PathRequest.cpp | 6 ++-- src/ripple/app/paths/PathState.cpp | 8 ++--- src/ripple/app/paths/Pathfinder.cpp | 8 ++--- src/ripple/app/paths/RippleCalc.cpp | 2 +- src/ripple/app/paths/cursor/AdvanceNode.cpp | 8 ++--- .../app/paths/cursor/DeliverNodeForward.cpp | 10 +++---- .../app/paths/cursor/DeliverNodeReverse.cpp | 8 ++--- .../app/paths/cursor/ForwardLiquidity.cpp | 2 +- .../cursor/ForwardLiquidityForAccount.cpp | 6 ++-- .../cursor/ReverseLiquidityForAccount.cpp | 10 +++---- .../app/paths/cursor/RippleLiquidity.cpp | 10 +++---- src/ripple/app/paths/impl/DirectStep.cpp | 4 +-- src/ripple/app/paths/impl/StrandFlow.h | 2 +- src/ripple/app/tx/impl/Change.cpp | 4 +-- src/ripple/app/tx/impl/CreateOffer.cpp | 20 ++++++++----- src/ripple/app/tx/impl/Offer.h | 4 +-- src/ripple/app/tx/impl/OfferStream.cpp | 2 +- src/ripple/app/tx/impl/Payment.cpp | 10 +++---- src/ripple/app/tx/impl/SetTrust.cpp | 10 +++---- src/ripple/app/tx/impl/Taker.cpp | 30 +++++++++---------- src/ripple/app/tx/impl/Taker.h | 2 ++ src/ripple/app/tx/impl/Transactor.cpp | 16 +++++----- src/ripple/app/tx/impl/applySteps.cpp | 2 +- src/ripple/basics/base_uint.h | 5 +--- src/ripple/ledger/ReadView.h | 10 +++---- src/ripple/ledger/impl/BookDirs.cpp | 14 +++++---- src/ripple/ledger/impl/CashDiff.cpp | 6 ++-- src/ripple/ledger/impl/Directory.cpp | 10 +++---- src/ripple/ledger/impl/View.cpp | 12 ++++---- src/ripple/overlay/impl/PeerImp.cpp | 8 ++--- src/ripple/overlay/impl/TMHello.cpp | 2 +- src/ripple/protocol/AccountID.h | 2 +- src/ripple/protocol/IOUAmount.h | 4 +-- src/ripple/protocol/Quality.h | 2 +- src/ripple/protocol/STAmount.h | 4 +-- src/ripple/protocol/STBitString.h | 3 +- src/ripple/protocol/UintTypes.h | 3 +- src/ripple/protocol/XRPAmount.h | 2 -- src/ripple/protocol/impl/IOUAmount.cpp | 12 ++++---- src/ripple/protocol/impl/Quality.cpp | 4 +-- src/ripple/protocol/impl/STAmount.cpp | 28 ++++++++--------- src/ripple/protocol/impl/UintTypes.cpp | 6 ++-- src/ripple/rpc/handlers/BookOffers.cpp | 2 +- src/ripple/rpc/handlers/GatewayBalances.cpp | 2 +- src/ripple/rpc/handlers/LedgerEntry.cpp | 2 +- src/ripple/rpc/handlers/LedgerRequest.cpp | 2 +- src/ripple/shamap/impl/SHAMapMissingNode.cpp | 3 +- src/test/app/Taker_test.cpp | 2 +- src/test/jtx/PathSet.h | 4 +-- src/test/protocol/IOUAmount_test.cpp | 10 ++++--- src/test/protocol/Quality_test.cpp | 2 +- src/test/protocol/STAmount_test.cpp | 22 +++++++------- src/test/protocol/XRPAmount_test.cpp | 6 ++-- src/test/shamap/SHAMap_test.cpp | 4 +-- 62 files changed, 206 insertions(+), 196 deletions(-) diff --git a/src/ripple/app/ledger/Ledger.cpp b/src/ripple/app/ledger/Ledger.cpp index 47f579e94..c1cbaf660 100644 --- a/src/ripple/app/ledger/Ledger.cpp +++ b/src/ripple/app/ledger/Ledger.cpp @@ -427,7 +427,7 @@ Ledger::succ (uint256 const& key, std::shared_ptr Ledger::read (Keylet const& k) const { - if (k.key == zero) + if (k.key == beast::zero) { assert(false); return nullptr; diff --git a/src/ripple/app/ledger/impl/LedgerCleaner.cpp b/src/ripple/app/ledger/impl/LedgerCleaner.cpp index f730f400d..f4d402cc2 100644 --- a/src/ripple/app/ledger/impl/LedgerCleaner.cpp +++ b/src/ripple/app/ledger/impl/LedgerCleaner.cpp @@ -285,7 +285,7 @@ private: ledger->info().hash, ledger->info().seq, InboundLedger::Reason::GENERIC); } - return hash ? *hash : zero; // kludge + return hash ? *hash : beast::zero; // kludge } /** Process a single ledger diff --git a/src/ripple/app/ledger/impl/LedgerMaster.cpp b/src/ripple/app/ledger/impl/LedgerMaster.cpp index cc7c5ec30..e0e0154fc 100644 --- a/src/ripple/app/ledger/impl/LedgerMaster.cpp +++ b/src/ripple/app/ledger/impl/LedgerMaster.cpp @@ -1027,7 +1027,7 @@ LedgerMaster::findNewLedgersToPublish () // VFALCO TODO Restructure this code so that zero is not // used. if (! hash) - hash = zero; // kludge + hash = beast::zero; // kludge if (seq == valSeq) { // We need to publish the ledger we just fully validated diff --git a/src/ripple/app/ledger/impl/TransactionMaster.cpp b/src/ripple/app/ledger/impl/TransactionMaster.cpp index 402da2e57..1eaf69ec7 100644 --- a/src/ripple/app/ledger/impl/TransactionMaster.cpp +++ b/src/ripple/app/ledger/impl/TransactionMaster.cpp @@ -99,7 +99,7 @@ void TransactionMaster::canonicalize(std::shared_ptr* pTransaction) { uint256 const tid = (*pTransaction)->getID(); - if (tid != zero) + if (tid != beast::zero) { auto txn = *pTransaction; // VFALCO NOTE canonicalize can change the value of txn! diff --git a/src/ripple/app/misc/CanonicalTXSet.cpp b/src/ripple/app/misc/CanonicalTXSet.cpp index 1582f85d7..984fb3123 100644 --- a/src/ripple/app/misc/CanonicalTXSet.cpp +++ b/src/ripple/app/misc/CanonicalTXSet.cpp @@ -102,8 +102,8 @@ CanonicalTXSet::prune(AccountID const& account, { auto effectiveAccount = accountKey (account); - Key keyLow(effectiveAccount, seq, zero); - Key keyHigh(effectiveAccount, seq+1, zero); + Key keyLow(effectiveAccount, seq, beast::zero); + Key keyHigh(effectiveAccount, seq+1, beast::zero); auto range = boost::make_iterator_range( mMap.lower_bound(keyLow), diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index d2f3107b7..75ab856fb 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -3076,7 +3076,7 @@ void NetworkOPsImp::getBookPage ( uOfferOwnerID, book.out.currency, book.out.account, fhZERO_IF_FROZEN, viewJ); - if (saOwnerFunds < zero) + if (saOwnerFunds < beast::zero) { // Treat negative funds as zero. diff --git a/src/ripple/app/paths/AccountCurrencies.cpp b/src/ripple/app/paths/AccountCurrencies.cpp index a537d5810..7104889b9 100644 --- a/src/ripple/app/paths/AccountCurrencies.cpp +++ b/src/ripple/app/paths/AccountCurrencies.cpp @@ -45,7 +45,7 @@ hash_set accountSourceCurrencies ( auto& saBalance = rspEntry->getBalance (); // Filter out non - if (saBalance > zero + if (saBalance > beast::zero // Have IOUs to send. || (rspEntry->getLimitPeer () // Peer extends credit. diff --git a/src/ripple/app/paths/NodeDirectory.h b/src/ripple/app/paths/NodeDirectory.h index e32d3b46c..fc3b69c54 100644 --- a/src/ripple/app/paths/NodeDirectory.h +++ b/src/ripple/app/paths/NodeDirectory.h @@ -58,7 +58,7 @@ public: bool initialize (Book const& book, ApplyView& view) { - if (current != zero) + if (current != beast::zero) return false; current.copyFrom (getBookBase (book)); @@ -105,7 +105,7 @@ public: advanceNeeded = false; restartNeeded = false; - if (current == zero) + if (current == beast::zero) return END_ADVANCE; ledgerEntry = view.peek (keylet::page(current)); diff --git a/src/ripple/app/paths/PathRequest.cpp b/src/ripple/app/paths/PathRequest.cpp index acd8aaca4..75046c3fc 100644 --- a/src/ripple/app/paths/PathRequest.cpp +++ b/src/ripple/app/paths/PathRequest.cpp @@ -168,7 +168,7 @@ bool PathRequest::isValid (std::shared_ptr const& crCache) if (! raSrcAccount || ! raDstAccount) return false; - if (! convert_all_ && (saSendMax || saDstAmount <= zero)) + if (! convert_all_ && (saSendMax || saDstAmount <= beast::zero)) { // If send max specified, dst amt must be -1. jvStatus = rpcError(rpcDST_AMT_MALFORMED); @@ -316,7 +316,7 @@ int PathRequest::parseJson (Json::Value const& jvParams) if ((saDstAmount.getCurrency ().isZero () && saDstAmount.getIssuer ().isNonZero ()) || (saDstAmount.getCurrency () == badCurrency ()) || - (! convert_all_ && saDstAmount <= zero)) + (! convert_all_ && saDstAmount <= beast::zero)) { jvStatus = rpcError (rpcDST_AMT_MALFORMED); return PFR_PJ_INVALID; @@ -337,7 +337,7 @@ int PathRequest::parseJson (Json::Value const& jvParams) (saSendMax->getCurrency().isZero() && saSendMax->getIssuer().isNonZero()) || (saSendMax->getCurrency() == badCurrency()) || - (*saSendMax <= zero && + (*saSendMax <= beast::zero && *saSendMax != STAmount(saSendMax->issue(), 1u, 0, true))) { jvStatus = rpcError(rpcSENDMAX_MALFORMED); diff --git a/src/ripple/app/paths/PathState.cpp b/src/ripple/app/paths/PathState.cpp index 1a5fbc5b5..ef4192e27 100644 --- a/src/ripple/app/paths/PathState.cpp +++ b/src/ripple/app/paths/PathState.cpp @@ -52,7 +52,7 @@ void PathState::reset(STAmount const& in, STAmount const& out) saInAct = in; saOutAct = out; - if (inReq() > zero && inAct() >= inReq()) + if (inReq() > beast::zero && inAct() >= inReq()) { JLOG (j_.warn()) << "rippleCalc: DONE:" @@ -60,7 +60,7 @@ void PathState::reset(STAmount const& in, STAmount const& out) << " inReq()=" << inReq(); } - assert (inReq() < zero || inAct() < inReq()); + assert (inReq() < beast::zero || inAct() < inReq()); // Error if done. if (outAct() >= outReq()) @@ -310,7 +310,7 @@ TER PathState::pushNode ( else if ((sleBck->getFieldU32 (sfFlags) & lsfRequireAuth) && !(sleRippleState->getFieldU32 (sfFlags) & (bHigh ? lsfHighAuth : lsfLowAuth)) && - sleRippleState->getFieldAmount(sfBalance) == zero) + sleRippleState->getFieldAmount(sfBalance) == beast::zero) { JLOG (j_.warn()) << "pushNode: delay: can't receive IOUs from " @@ -326,7 +326,7 @@ TER PathState::pushNode ( node.issue_.currency); STAmount saLimit; - if (saOwed <= zero) + if (saOwed <= beast::zero) { saLimit = creditLimit (view(), node.account_, diff --git a/src/ripple/app/paths/Pathfinder.cpp b/src/ripple/app/paths/Pathfinder.cpp index 9bd81aace..82e107cd5 100644 --- a/src/ripple/app/paths/Pathfinder.cpp +++ b/src/ripple/app/paths/Pathfinder.cpp @@ -172,7 +172,7 @@ Pathfinder::Pathfinder ( bool Pathfinder::findPaths (int searchLevel) { - if (mDstAmount == zero) + if (mDstAmount == beast::zero) { // No need to send zero money. JLOG (j_.debug()) << "Destination amount was zero."; @@ -665,7 +665,7 @@ Pathfinder::getBestPaths ( } } - if (remaining > zero) + if (remaining > beast::zero) { assert (fullLiquidityPath.empty ()); JLOG (j_.info()) << @@ -726,7 +726,7 @@ int Pathfinder::getPathsOut ( if (currency != rspEntry->getLimit ().getCurrency ()) { } - else if (rspEntry->getBalance () <= zero && + else if (rspEntry->getBalance () <= beast::zero && (!rspEntry->getLimitPeer () || -rspEntry->getBalance () >= rspEntry->getLimitPeer () || (bAuthRequired && !rspEntry->getAuth ()))) @@ -969,7 +969,7 @@ void Pathfinder::addLink ( !currentPath.hasSeen (acct, uEndCurrency, acct)) { // path is for correct currency and has not been seen - if (rs->getBalance () <= zero + if (rs->getBalance () <= beast::zero && (!rs->getLimitPeer () || -rs->getBalance () >= rs->getLimitPeer () || (bRequireAuth && !rs->getAuth ()))) diff --git a/src/ripple/app/paths/RippleCalc.cpp b/src/ripple/app/paths/RippleCalc.cpp index 4e81e7df1..2d6191401 100644 --- a/src/ripple/app/paths/RippleCalc.cpp +++ b/src/ripple/app/paths/RippleCalc.cpp @@ -381,7 +381,7 @@ TER RippleCalc::rippleCalculate (detail::FlowDebugInfo* flowDebugInfo) ++iDry; } - else if (pathState->outPass() == zero) + else if (pathState->outPass() == beast::zero) { // Path is not dry, but moved no funds // This should never happen. Consider the path dry diff --git a/src/ripple/app/paths/cursor/AdvanceNode.cpp b/src/ripple/app/paths/cursor/AdvanceNode.cpp index 6eeb3a3c7..9cd05a814 100644 --- a/src/ripple/app/paths/cursor/AdvanceNode.cpp +++ b/src/ripple/app/paths/cursor/AdvanceNode.cpp @@ -27,8 +27,8 @@ namespace path { TER PathCursor::advanceNode (STAmount const& amount, bool reverse, bool callerHasLiquidity) const { bool const multi = fix1141 (view ().info ().parentCloseTime) - ? (multiQuality_ || (!callerHasLiquidity && amount == zero)) - : (multiQuality_ || amount == zero); + ? (multiQuality_ || (!callerHasLiquidity && amount == beast::zero)) + : (multiQuality_ || amount == beast::zero); // If the multiQuality_ is unchanged, use the PathCursor we're using now. if (multi == multiQuality_) @@ -224,7 +224,7 @@ TER PathCursor::advanceNode (bool const bReverse) const continue; } - if (node().saTakerPays <= zero || node().saTakerGets <= zero) + if (node().saTakerPays <= beast::zero || node().saTakerGets <= beast::zero) { // Offer has bad amounts. Offers should never have a bad // amounts. @@ -336,7 +336,7 @@ TER PathCursor::advanceNode (bool const bReverse) const fhZERO_IF_FROZEN, viewJ); // Funds held. - if (node().saOfferFunds <= zero) + if (node().saOfferFunds <= beast::zero) { // Offer is unfunded. JLOG (j_.trace()) diff --git a/src/ripple/app/paths/cursor/DeliverNodeForward.cpp b/src/ripple/app/paths/cursor/DeliverNodeForward.cpp index 3fe36fa08..bafff6b54 100644 --- a/src/ripple/app/paths/cursor/DeliverNodeForward.cpp +++ b/src/ripple/app/paths/cursor/DeliverNodeForward.cpp @@ -112,7 +112,7 @@ TER PathCursor::deliverNodeForward ( saInFunded, xferRate, true); auto saInRemaining = saInReq - saInAct - saInFees; - if (saInRemaining < zero) + if (saInRemaining < beast::zero) saInRemaining.clear(); // In limited by remaining. @@ -153,7 +153,7 @@ TER PathCursor::deliverNodeForward ( << " saOutPassMax=" << saOutPassMax; // FIXME: We remove an offer if WE didn't want anything out of it? - if (!node().saTakerPays || saInSum <= zero) + if (!node().saTakerPays || saInSum <= beast::zero) { JLOG (j_.debug()) << "deliverNodeForward: Microscopic offer unfunded."; @@ -223,7 +223,7 @@ TER PathCursor::deliverNodeForward ( saOutPassMax, // --> Amount available. saOutPassAct, // <-- Amount delivered. saOutPassFees, // <-- Fees charged. - saInAct > zero); + saInAct > beast::zero); if (resultCode != tesSUCCESS) break; @@ -307,7 +307,7 @@ TER PathCursor::deliverNodeForward ( STAmount saTakerGetsNew = node().saTakerGets - saOutPassAct; STAmount saTakerPaysNew = node().saTakerPays - saInPassAct; - if (saTakerPaysNew < zero || saTakerGetsNew < zero) + if (saTakerPaysNew < beast::zero || saTakerGetsNew < beast::zero) { JLOG (j_.warn()) << "deliverNodeForward: NEGATIVE:" @@ -323,7 +323,7 @@ TER PathCursor::deliverNodeForward ( view().update (node().sleOffer); - if (saOutPassAct == saOutFunded || saTakerGetsNew == zero) + if (saOutPassAct == saOutFunded || saTakerGetsNew == beast::zero) { // Offer became unfunded. diff --git a/src/ripple/app/paths/cursor/DeliverNodeReverse.cpp b/src/ripple/app/paths/cursor/DeliverNodeReverse.cpp index 5488af5d9..25bcea163 100644 --- a/src/ripple/app/paths/cursor/DeliverNodeReverse.cpp +++ b/src/ripple/app/paths/cursor/DeliverNodeReverse.cpp @@ -57,7 +57,7 @@ TER PathCursor::deliverNodeReverseImpl ( << " saOutReq=" << saOutReq << " saPrvDlvReq=" << previousNode().saRevDeliver; - assert (saOutReq != zero); + assert (saOutReq != beast::zero); int loopCount = 0; auto viewJ = rippleCalc_.logs_.journal ("View"); @@ -244,13 +244,13 @@ TER PathCursor::deliverNodeReverseImpl ( node().offerOwnerAccount_, saInPassReq, saInPassAct, - saOutAct > zero); + saOutAct > beast::zero); if (fix1141(view().info().parentCloseTime)) { // The recursive call is dry this time, but we have liquidity // from previous calls - if (resultCode == tecPATH_DRY && saOutAct > zero) + if (resultCode == tecPATH_DRY && saOutAct > beast::zero) { resultCode = tesSUCCESS; break; @@ -305,7 +305,7 @@ TER PathCursor::deliverNodeReverseImpl ( STAmount saTakerGetsNew = node().saTakerGets - saOutPassAct; STAmount saTakerPaysNew = node().saTakerPays - saInPassAct; - if (saTakerPaysNew < zero || saTakerGetsNew < zero) + if (saTakerPaysNew < beast::zero || saTakerGetsNew < beast::zero) { JLOG (j_.warn()) << "deliverNodeReverse: NEGATIVE:" diff --git a/src/ripple/app/paths/cursor/ForwardLiquidity.cpp b/src/ripple/app/paths/cursor/ForwardLiquidity.cpp index 73f05ca0c..46450a18d 100644 --- a/src/ripple/app/paths/cursor/ForwardLiquidity.cpp +++ b/src/ripple/app/paths/cursor/ForwardLiquidity.cpp @@ -30,7 +30,7 @@ TER PathCursor::forwardLiquidity () const return forwardLiquidityForAccount (); // Otherwise, node is an offer. - if (previousNode().account_ == zero) + if (previousNode().account_ == beast::zero) return tesSUCCESS; // Previous is an account node, resolve its deliver. diff --git a/src/ripple/app/paths/cursor/ForwardLiquidityForAccount.cpp b/src/ripple/app/paths/cursor/ForwardLiquidityForAccount.cpp index d2a03a7ee..4e3518702 100644 --- a/src/ripple/app/paths/cursor/ForwardLiquidityForAccount.cpp +++ b/src/ripple/app/paths/cursor/ForwardLiquidityForAccount.cpp @@ -104,7 +104,7 @@ TER PathCursor::forwardLiquidityForAccount () const // available. node().saFwdRedeem = node().saRevRedeem; - if (pathState_.inReq() >= zero) + if (pathState_.inReq() >= beast::zero) { // Limit by send max. node().saFwdRedeem = std::min ( @@ -117,7 +117,7 @@ TER PathCursor::forwardLiquidityForAccount () const // Fully redeemed. ? node().saRevIssue : STAmount (node().saRevIssue); - if (node().saFwdIssue && pathState_.inReq() >= zero) + if (node().saFwdIssue && pathState_.inReq() >= beast::zero) { // Limit by send max. node().saFwdIssue = std::min ( @@ -343,7 +343,7 @@ TER PathCursor::forwardLiquidityForAccount () const node().saFwdDeliver = node().saRevDeliver; // If limited, then limit by send max and available. - if (pathState_.inReq() >= zero) + if (pathState_.inReq() >= beast::zero) { // Limit by send max. node().saFwdDeliver = std::min ( diff --git a/src/ripple/app/paths/cursor/ReverseLiquidityForAccount.cpp b/src/ripple/app/paths/cursor/ReverseLiquidityForAccount.cpp index 86be96a72..e58a41e63 100644 --- a/src/ripple/app/paths/cursor/ReverseLiquidityForAccount.cpp +++ b/src/ripple/app/paths/cursor/ReverseLiquidityForAccount.cpp @@ -118,13 +118,13 @@ TER PathCursor::reverseLiquidityForAccount () const // Requests are computed to be the maximum flow possible. // Previous can redeem the owed IOUs it holds. - const STAmount saPrvRedeemReq = (saPrvOwed > zero) + const STAmount saPrvRedeemReq = (saPrvOwed > beast::zero) ? saPrvOwed : STAmount (saPrvOwed.issue ()); // Previous can issue up to limit minus whatever portion of limit already // used (not including redeemable amount) - another "maximum flow". - const STAmount saPrvIssueReq = (saPrvOwed < zero) + const STAmount saPrvIssueReq = (saPrvOwed < beast::zero) ? saPrvLimit + saPrvOwed : saPrvLimit; // Precompute these values in case we have an order book. @@ -158,7 +158,7 @@ TER PathCursor::reverseLiquidityForAccount () const // Current redeem req can't be more than IOUs on hand. assert (!node().saRevRedeem || -saNxtOwed >= node().saRevRedeem); assert (!node().saRevIssue // If not issuing, fine. - || saNxtOwed >= zero + || saNxtOwed >= beast::zero // saNxtOwed >= 0: Sender not holding next IOUs, saNxtOwed < 0: // Sender holding next IOUs. || -saNxtOwed == node().saRevRedeem); @@ -395,7 +395,7 @@ TER PathCursor::reverseLiquidityForAccount () const // // TODO(tom): Make sure deliver was cleared, or check actual is zero. // redeem -> deliver/issue. - if (saPrvOwed > zero // Previous has IOUs to redeem. + if (saPrvOwed > beast::zero // Previous has IOUs to redeem. && node().saRevDeliver) // Need some issued. { // Rate : 1.0 : transfer_rate @@ -459,7 +459,7 @@ TER PathCursor::reverseLiquidityForAccount () const << " saOutAct:" << pathState_.outAct() << " saOutReq:" << pathState_.outReq(); - if (saCurWantedReq <= zero) + if (saCurWantedReq <= beast::zero) { assert(false); JLOG (j_.fatal()) << "CurWantReq was not positive"; diff --git a/src/ripple/app/paths/cursor/RippleLiquidity.cpp b/src/ripple/app/paths/cursor/RippleLiquidity.cpp index c774346d4..dfa719768 100644 --- a/src/ripple/app/paths/cursor/RippleLiquidity.cpp +++ b/src/ripple/app/paths/cursor/RippleLiquidity.cpp @@ -65,15 +65,15 @@ void rippleLiquidity ( << " saPrvAct=" << saPrvAct << " saCurAct=" << saCurAct; - // saCurAct was once zero in a production server. - assert (saCurReq != zero); - assert (saCurReq > zero); + // saCurAct was once beast::zero in a production server. + assert (saCurReq != beast::zero); + assert (saCurReq > beast::zero); assert (saPrvReq.getCurrency () == saCurReq.getCurrency ()); assert (saPrvReq.getCurrency () == saPrvAct.getCurrency ()); assert (saPrvReq.getIssuer () == saPrvAct.getIssuer ()); - const bool bPrvUnlimited = (saPrvReq < zero); // -1 means unlimited. + const bool bPrvUnlimited = (saPrvReq < beast::zero); // -1 means unlimited. // Unlimited stays unlimited - don't do calculations. @@ -90,7 +90,7 @@ void rippleLiquidity ( << " saCur=" << saCur; // If nothing can flow, we might as well not do any work. - if (saPrv == zero || saCur == zero) + if (saPrv == beast::zero || saCur == beast::zero) return; if (qualityIn >= qualityOut) diff --git a/src/ripple/app/paths/impl/DirectStep.cpp b/src/ripple/app/paths/impl/DirectStep.cpp index 8e0389c6f..1dfbf10d9 100644 --- a/src/ripple/app/paths/impl/DirectStep.cpp +++ b/src/ripple/app/paths/impl/DirectStep.cpp @@ -413,7 +413,7 @@ DirectIPaymentStep::check ( if (((*sleSrc)[sfFlags] & lsfRequireAuth) && !((*sleLine)[sfFlags] & authField) && - (*sleLine)[sfBalance] == zero) + (*sleLine)[sfBalance] == beast::zero) { JLOG (j_.warn()) << "DirectStepI: can't receive IOUs from issuer without auth." @@ -437,7 +437,7 @@ DirectIPaymentStep::check ( { auto const owed = creditBalance (ctx.view, dst_, src_, currency_); - if (owed <= zero) + if (owed <= beast::zero) { auto const limit = creditLimit (ctx.view, dst_, src_, currency_); if (-owed >= limit) diff --git a/src/ripple/app/paths/impl/StrandFlow.h b/src/ripple/app/paths/impl/StrandFlow.h index 7301646d1..205dcfe41 100644 --- a/src/ripple/app/paths/impl/StrandFlow.h +++ b/src/ripple/app/paths/impl/StrandFlow.h @@ -635,7 +635,7 @@ flow (PaymentSandbox const& baseView, // we're handling a FillOrKill offer. In this case remainingIn must // be zero (all funds must be consumed) or else we kill the offer. assert (remainingIn); - if (remainingIn && *remainingIn != zero) + if (remainingIn && *remainingIn != beast::zero) return {tecPATH_PARTIAL, actualIn, actualOut, std::move(ofrsToRmOnFail)}; } diff --git a/src/ripple/app/tx/impl/Change.cpp b/src/ripple/app/tx/impl/Change.cpp index cb216e9af..7653aaaa8 100644 --- a/src/ripple/app/tx/impl/Change.cpp +++ b/src/ripple/app/tx/impl/Change.cpp @@ -35,7 +35,7 @@ Change::preflight (PreflightContext const& ctx) return ret; auto account = ctx.tx.getAccountID(sfAccount); - if (account != zero) + if (account != beast::zero) { JLOG(ctx.j.warn()) << "Change: Bad source id"; return temBAD_SRC_ACCOUNT; @@ -99,7 +99,7 @@ void Change::preCompute() { account_ = ctx_.tx.getAccountID(sfAccount); - assert(account_ == zero); + assert(account_ == beast::zero); } TER diff --git a/src/ripple/app/tx/impl/CreateOffer.cpp b/src/ripple/app/tx/impl/CreateOffer.cpp index 602be87a6..baeacb24d 100644 --- a/src/ripple/app/tx/impl/CreateOffer.cpp +++ b/src/ripple/app/tx/impl/CreateOffer.cpp @@ -97,7 +97,7 @@ CreateOffer::preflight (PreflightContext const& ctx) "Malformed offer: redundant (XRP for XRP)"; return temBAD_OFFER; } - if (saTakerPays <= zero || saTakerGets <= zero) + if (saTakerPays <= beast::zero || saTakerGets <= beast::zero) { JLOG(j.debug()) << "Malformed offer: bad amount"; @@ -165,7 +165,7 @@ CreateOffer::preclaim(PreclaimContext const& ctx) return tecFROZEN; } else if (accountFunds(ctx.view, id, saTakerGets, - fhZERO_IF_FROZEN, viewJ) <= zero) + fhZERO_IF_FROZEN, viewJ) <= beast::zero) { JLOG(ctx.j.debug()) << "delay: Offers must be at least partially funded."; @@ -285,7 +285,7 @@ CreateOffer::dry_offer (ApplyView& view, Offer const& offer) return true; auto const amount = accountFunds(view, offer.owner(), offer.amount().out, fhZERO_IF_FROZEN, ctx_.app.journal ("View")); - return (amount <= zero); + return (amount <= beast::zero); } std::pair @@ -653,7 +653,7 @@ CreateOffer::flowCross ( // below the reserve) so we check this case again. STAmount const inStartBalance = accountFunds ( psb, account_, takerAmount.in, fhZERO_IF_FROZEN, j_); - if (inStartBalance <= zero) + if (inStartBalance <= beast::zero) { // The account balance can't cover even part of the offer. JLOG (j_.debug()) << @@ -745,7 +745,7 @@ CreateOffer::flowCross ( STAmount const takerInBalance = accountFunds ( psb, account_, takerAmount.in, fhZERO_IF_FROZEN, j_); - if (takerInBalance <= zero) + if (takerInBalance <= beast::zero) { // If offer crossing exhausted the account's funds don't // create the offer. @@ -776,7 +776,7 @@ CreateOffer::flowCross ( // It's possible that the divRound will cause our subtract // to go slightly negative. So limit afterCross.in to zero. - if (afterCross.in < zero) + if (afterCross.in < beast::zero) // We should verify that the difference *is* small, but // what is a good threshold to check? afterCross.in.clear(); @@ -790,8 +790,8 @@ CreateOffer::flowCross ( // remaining output. This too preserves the offer // Quality. afterCross.out -= result.actualAmountOut; - assert (afterCross.out >= zero); - if (afterCross.out < zero) + assert (afterCross.out >= beast::zero); + if (afterCross.out < beast::zero) afterCross.out.clear(); afterCross.in = mulRound (afterCross.out, rate, takerAmount.in.issue(), true); @@ -913,6 +913,8 @@ CreateOffer::cross ( Sandbox& sbCancel, Amounts const& takerAmount) { + using beast::zero; + // There are features for Flow offer crossing and for comparing results // between Taker and Flow offer crossing. Turn those into bools. bool const useFlowCross { sb.rules().enabled (featureFlowCross) }; @@ -1067,6 +1069,8 @@ CreateOffer::preCompute() std::pair CreateOffer::applyGuts (Sandbox& sb, Sandbox& sbCancel) { + using beast::zero; + std::uint32_t const uTxFlags = ctx_.tx.getFlags (); bool const bPassive (uTxFlags & tfPassive); diff --git a/src/ripple/app/tx/impl/Offer.h b/src/ripple/app/tx/impl/Offer.h index 022da0fe9..f61c06e47 100644 --- a/src/ripple/app/tx/impl/Offer.h +++ b/src/ripple/app/tx/impl/Offer.h @@ -97,9 +97,9 @@ public: bool fully_consumed () const { - if (m_amounts.in <= zero) + if (m_amounts.in <= beast::zero) return true; - if (m_amounts.out <= zero) + if (m_amounts.out <= beast::zero) return true; return false; } diff --git a/src/ripple/app/tx/impl/OfferStream.cpp b/src/ripple/app/tx/impl/OfferStream.cpp index dcdeb1dae..d4989337c 100644 --- a/src/ripple/app/tx/impl/OfferStream.cpp +++ b/src/ripple/app/tx/impl/OfferStream.cpp @@ -175,7 +175,7 @@ TOfferStreamBase::step () offer_.issueOut (), fhZERO_IF_FROZEN, j_); // Check for unfunded offer - if (*ownerFunds_ <= zero) + if (*ownerFunds_ <= beast::zero) { // If the owner's balance in the pristine view is the same, // we haven't modified the balance and therefore the diff --git a/src/ripple/app/tx/impl/Payment.cpp b/src/ripple/app/tx/impl/Payment.cpp index a45f29a8e..706044b71 100644 --- a/src/ripple/app/tx/impl/Payment.cpp +++ b/src/ripple/app/tx/impl/Payment.cpp @@ -82,7 +82,7 @@ Payment::preflight (PreflightContext const& ctx) maxSourceAmount = STAmount ( { saDstAmount.getCurrency (), account }, saDstAmount.mantissa(), saDstAmount.exponent (), - saDstAmount < zero); + saDstAmount < beast::zero); auto const& uSrcCurrency = maxSourceAmount.getCurrency (); auto const& uDstCurrency = saDstAmount.getCurrency (); @@ -101,13 +101,13 @@ Payment::preflight (PreflightContext const& ctx) "Payment destination account not specified."; return temDST_NEEDED; } - if (bMax && maxSourceAmount <= zero) + if (bMax && maxSourceAmount <= beast::zero) { JLOG(j.trace()) << "Malformed transaction: " << "bad max amount: " << maxSourceAmount.getFullText (); return temBAD_AMOUNT; } - if (saDstAmount <= zero) + if (saDstAmount <= beast::zero) { JLOG(j.trace()) << "Malformed transaction: "<< "bad dst amount: " << saDstAmount.getFullText (); @@ -175,7 +175,7 @@ Payment::preflight (PreflightContext const& ctx) } auto const dMin = *deliverMin; - if (!isLegalNet(dMin) || dMin <= zero) + if (!isLegalNet(dMin) || dMin <= beast::zero) { JLOG(j.trace()) << "Malformed transaction: Invalid " << jss::DeliverMin.c_str() << " amount. " << @@ -320,7 +320,7 @@ Payment::doApply () maxSourceAmount = STAmount ( {saDstAmount.getCurrency (), account_}, saDstAmount.mantissa(), saDstAmount.exponent (), - saDstAmount < zero); + saDstAmount < beast::zero); JLOG(j_.trace()) << "maxSourceAmount=" << maxSourceAmount.getFullText () << diff --git a/src/ripple/app/tx/impl/SetTrust.cpp b/src/ripple/app/tx/impl/SetTrust.cpp index a34922a5d..8a5365d15 100644 --- a/src/ripple/app/tx/impl/SetTrust.cpp +++ b/src/ripple/app/tx/impl/SetTrust.cpp @@ -66,7 +66,7 @@ SetTrust::preflight (PreflightContext const& ctx) return temBAD_CURRENCY; } - if (saLimitAmount < zero) + if (saLimitAmount < beast::zero) { JLOG(j.trace()) << "Malformed transaction: Negative credit limit."; @@ -168,7 +168,7 @@ SetTrust::doApply () // could use the extra XRP for their own purposes. XRPAmount const reserveCreate ((uOwnerCount < 2) - ? XRPAmount (zero) + ? XRPAmount (beast::zero) : view().fees().accountReserve(uOwnerCount + 1)); std::uint32_t uQualityIn (bQualityIn ? ctx_.tx.getFieldU32 (sfQualityIn) : 0); @@ -317,7 +317,7 @@ SetTrust::doApply () std::uint32_t const uFlagsIn (sleRippleState->getFieldU32 (sfFlags)); std::uint32_t uFlagsOut (uFlagsIn); - if (bSetNoRipple && !bClearNoRipple && (bHigh ? saHighBalance : saLowBalance) >= zero) + if (bSetNoRipple && !bClearNoRipple && (bHigh ? saHighBalance : saLowBalance) >= beast::zero) { uFlagsOut |= (bHigh ? lsfHighNoRipple : lsfLowNoRipple); } @@ -345,13 +345,13 @@ SetTrust::doApply () bool const bLowReserveSet = uLowQualityIn || uLowQualityOut || ((uFlagsOut & lsfLowNoRipple) == 0) != bLowDefRipple || (uFlagsOut & lsfLowFreeze) || - saLowLimit || saLowBalance > zero; + saLowLimit || saLowBalance > beast::zero; bool const bLowReserveClear = !bLowReserveSet; bool const bHighReserveSet = uHighQualityIn || uHighQualityOut || ((uFlagsOut & lsfHighNoRipple) == 0) != bHighDefRipple || (uFlagsOut & lsfHighFreeze) || - saHighLimit || saHighBalance > zero; + saHighLimit || saHighBalance > beast::zero; bool const bHighReserveClear = !bHighReserveSet; bool const bDefault = bLowReserveClear && bHighReserveClear; diff --git a/src/ripple/app/tx/impl/Taker.cpp b/src/ripple/app/tx/impl/Taker.cpp index 322e82828..1d9fb9ab6 100644 --- a/src/ripple/app/tx/impl/Taker.cpp +++ b/src/ripple/app/tx/impl/Taker.cpp @@ -50,8 +50,8 @@ BasicTaker::BasicTaker ( , cross_type_ (cross_type) , journal_ (journal) { - assert (remaining_.in > zero); - assert (remaining_.out > zero); + assert (remaining_.in > beast::zero); + assert (remaining_.out > beast::zero); assert (m_rate_in.value != 0); assert (m_rate_out.value != 0); @@ -95,7 +95,7 @@ BasicTaker::effective_rate ( bool BasicTaker::unfunded () const { - if (get_funds (account(), remaining_.in) > zero) + if (get_funds (account(), remaining_.in) > beast::zero) return false; JLOG(journal_.debug()) << "Unfunded: taker is out of funds."; @@ -106,7 +106,7 @@ bool BasicTaker::done () const { // We are done if we have consumed all the input currency - if (remaining_.in <= zero) + if (remaining_.in <= beast::zero) { JLOG(journal_.debug()) << "Done: all the input currency has been consumed."; return true; @@ -114,7 +114,7 @@ BasicTaker::done () const // We are done if using buy semantics and we received the // desired amount of output currency - if (!sell_ && (remaining_.out <= zero)) + if (!sell_ && (remaining_.out <= beast::zero)) { JLOG(journal_.debug()) << "Done: the desired amount has been received."; return true; @@ -143,14 +143,14 @@ BasicTaker::remaining_offer () const if (sell_) { - assert (remaining_.in > zero); + assert (remaining_.in > beast::zero); // We scale the output based on the remaining input: return Amounts (remaining_.in, divRound ( remaining_.in, quality_.rate (), issue_out_, true)); } - assert (remaining_.out > zero); + assert (remaining_.out > beast::zero); // We scale the input based on the remaining output: return Amounts (mulRound ( @@ -398,7 +398,7 @@ BasicTaker::do_cross (Amounts offer, Quality quality, AccountID const& owner) remaining_.out -= result.order.out; remaining_.in -= result.order.in; - assert (remaining_.in >= zero); + assert (remaining_.in >= beast::zero); return result; } @@ -545,10 +545,10 @@ Taker::Taker (CrossType cross_type, ApplyView& view, void Taker::consume_offer (Offer& offer, Amounts const& order) { - if (order.in < zero) + if (order.in < beast::zero) Throw ("flow with negative input."); - if (order.out < zero) + if (order.out < beast::zero) Throw ("flow with negative output."); JLOG(journal_.debug()) << "Consuming from offer " << offer; @@ -582,7 +582,7 @@ TER Taker::transferXRP ( return tesSUCCESS; // Transferring zero is equivalent to not doing a transfer - if (amount == zero) + if (amount == beast::zero) return tesSUCCESS; return ripple::transferXRP (view_, from, to, amount, journal_); @@ -600,17 +600,17 @@ TER Taker::redeemIOU ( return tesSUCCESS; // Transferring zero is equivalent to not doing a transfer - if (amount == zero) + if (amount == beast::zero) return tesSUCCESS; // If we are trying to redeem some amount, then the account // must have a credit balance. - if (get_funds (account, amount) <= zero) + if (get_funds (account, amount) <= beast::zero) Throw ("redeemIOU has no funds to redeem"); auto ret = ripple::redeemIOU (view_, account, amount, issue, journal_); - if (get_funds (account, amount) < zero) + if (get_funds (account, amount) < beast::zero) Throw ("redeemIOU redeemed more funds than available"); return ret; @@ -628,7 +628,7 @@ TER Taker::issueIOU ( return tesSUCCESS; // Transferring zero is equivalent to not doing a transfer - if (amount == zero) + if (amount == beast::zero) return tesSUCCESS; return ripple::issueIOU (view_, account, amount, issue, journal_); diff --git a/src/ripple/app/tx/impl/Taker.h b/src/ripple/app/tx/impl/Taker.h index ca9f7caff..57737b7a8 100644 --- a/src/ripple/app/tx/impl/Taker.h +++ b/src/ripple/app/tx/impl/Taker.h @@ -80,6 +80,8 @@ protected: bool sanity_check () const { + using beast::zero; + if (isXRP (order.in) && isXRP (order.out)) return false; diff --git a/src/ripple/app/tx/impl/Transactor.cpp b/src/ripple/app/tx/impl/Transactor.cpp index 708fe3648..9fcd0e074 100644 --- a/src/ripple/app/tx/impl/Transactor.cpp +++ b/src/ripple/app/tx/impl/Transactor.cpp @@ -59,7 +59,7 @@ preflight1 (PreflightContext const& ctx) return ret; auto const id = ctx.tx.getAccountID(sfAccount); - if (id == zero) + if (id == beast::zero) { JLOG(ctx.j.warn()) << "preflight1: bad account id"; return temBAD_SRC_ACCOUNT; @@ -180,7 +180,7 @@ Transactor::checkFee (PreclaimContext const& ctx, return telINSUF_FEE_P; } - if (feePaid == zero) + if (feePaid == beast::zero) return tesSUCCESS; auto const id = ctx.tx.getAccountID(sfAccount); @@ -194,7 +194,7 @@ Transactor::checkFee (PreclaimContext const& ctx, " balance=" << to_string(balance) << " paid=" << to_string(feePaid); - if ((balance > zero) && !ctx.view.open()) + if ((balance > beast::zero) && !ctx.view.open()) { // Closed ledger, non-zero balance, less than fee return tecINSUFF_FEE; @@ -290,7 +290,7 @@ Transactor::setSeq () void Transactor::preCompute () { account_ = ctx_.tx.getAccountID(sfAccount); - assert(account_ != zero); + assert(account_ != beast::zero); } TER Transactor::apply () @@ -303,7 +303,7 @@ TER Transactor::apply () // sle must exist except for transactions // that allow zero account. - assert(sle != nullptr || account_ == zero); + assert(sle != nullptr || account_ == beast::zero); if (sle) { @@ -576,7 +576,7 @@ Transactor::reset(XRPAmount fee) auto const balance = txnAcct->getFieldAmount (sfBalance).xrp (); // balance should have already been checked in checkFee / preFlight. - assert(balance != zero && (!view().open() || balance >= fee)); + assert(balance != beast::zero && (!view().open() || balance >= fee)); // We retry/reject the transaction if the account balance is zero or we're // applying against an open ledger and the balance is less than the fee @@ -705,14 +705,14 @@ Transactor::operator()() // The transactor and invariant checkers guarantee that this will // *never* trigger but if it, somehow, happens, don't allow a tx // that charges a negative fee. - if (fee < zero) + if (fee < beast::zero) Throw ("fee charged is negative!"); // Charge whatever fee they specified. The fee has already been // deducted from the balance of the account that issued the // transaction. We just need to account for it in the ledger // header. - if (!view().open() && fee != zero) + if (!view().open() && fee != beast::zero) ctx_.destroyXRP (fee); // Once we call apply, we will no longer be able to look at view() diff --git a/src/ripple/app/tx/impl/applySteps.cpp b/src/ripple/app/tx/impl/applySteps.cpp index bedc3a48d..814f9e421 100644 --- a/src/ripple/app/tx/impl/applySteps.cpp +++ b/src/ripple/app/tx/impl/applySteps.cpp @@ -84,7 +84,7 @@ invoke_preclaim(PreclaimContext const& ctx) // list one, preflight will have already a flagged a failure. auto const id = ctx.tx.getAccountID(sfAccount); - if (id != zero) + if (id != beast::zero) { TER result = T::checkSeq(ctx); diff --git a/src/ripple/basics/base_uint.h b/src/ripple/basics/base_uint.h index 9cc93e91b..d1da0b5e7 100644 --- a/src/ripple/basics/base_uint.h +++ b/src/ripple/basics/base_uint.h @@ -35,9 +35,6 @@ #include #include -using beast::zero; -using beast::Zero; - namespace ripple { // This class stores its values internally in big-endian form @@ -392,7 +389,7 @@ public: return bytes; } - base_uint& operator=(Zero) + base_uint& operator=(beast::Zero) { pn.fill(0); return *this; diff --git a/src/ripple/ledger/ReadView.h b/src/ripple/ledger/ReadView.h index 0a1ac517b..2548870d8 100644 --- a/src/ripple/ledger/ReadView.h +++ b/src/ripple/ledger/ReadView.h @@ -85,12 +85,12 @@ struct LedgerInfo // // Closed means "tx set already determined" - uint256 hash = zero; - uint256 txHash = zero; - uint256 accountHash = zero; - uint256 parentHash = zero; + uint256 hash = beast::zero; + uint256 txHash = beast::zero; + uint256 accountHash = beast::zero; + uint256 parentHash = beast::zero; - XRPAmount drops = zero; + XRPAmount drops = beast::zero; // If validated is false, it means "not yet validated." // Once validated is true, it will never be set false at a later time. diff --git a/src/ripple/ledger/impl/BookDirs.cpp b/src/ripple/ledger/impl/BookDirs.cpp index 6d212af9d..cdb8d74ef 100644 --- a/src/ripple/ledger/impl/BookDirs.cpp +++ b/src/ripple/ledger/impl/BookDirs.cpp @@ -27,10 +27,10 @@ BookDirs::BookDirs(ReadView const& view, Book const& book) : view_(&view) , root_(keylet::page(getBookBase(book)).key) , next_quality_(getQualityNext(root_)) - , key_(view_->succ(root_, next_quality_).value_or(zero)) + , key_(view_->succ(root_, next_quality_).value_or(beast::zero)) { - assert(root_ != zero); - if (key_ != zero) + assert(root_ != beast::zero); + if (key_ != beast::zero) { if (! cdirFirst(*view_, key_, sle_, entry_, index_, beast::Journal())) @@ -45,7 +45,7 @@ BookDirs::begin() const -> BookDirs::const_iterator { auto it = BookDirs::const_iterator(*view_, root_, key_); - if (key_ != zero) + if (key_ != beast::zero) { it.next_quality_ = next_quality_; it.sle_ = sle_; @@ -81,7 +81,7 @@ BookDirs::const_iterator::operator== BookDirs::const_iterator::reference BookDirs::const_iterator::operator*() const { - assert(index_ != zero); + assert(index_ != beast::zero); if (! cache_) cache_ = view_->read(keylet::offer(index_)); return *cache_; @@ -90,6 +90,8 @@ BookDirs::const_iterator::operator*() const BookDirs::const_iterator& BookDirs::const_iterator::operator++() { + using beast::zero; + assert(index_ != zero); if (! cdirNext(*view_, cur_key_, sle_, entry_, index_, j_)) { @@ -115,7 +117,7 @@ BookDirs::const_iterator::operator++() BookDirs::const_iterator BookDirs::const_iterator::operator++(int) { - assert(index_ != zero); + assert(index_ != beast::zero); const_iterator tmp(*this); ++(*this); return tmp; diff --git a/src/ripple/ledger/impl/CashDiff.cpp b/src/ripple/ledger/impl/CashDiff.cpp index e222663a3..dc045f0f5 100644 --- a/src/ripple/ledger/impl/CashDiff.cpp +++ b/src/ripple/ledger/impl/CashDiff.cpp @@ -109,6 +109,8 @@ static bool treatZeroOfferAsDeletion (CashSummary& result, bool isDelete, std::shared_ptr const& before, std::shared_ptr const& after) { + using beast::zero; + if (!before) return false; @@ -695,7 +697,7 @@ bool diffIsDust (STAmount const& v1, STAmount const& v2, std::uint8_t e10) { // If one value is positive and the other negative then there's something // odd afoot. - if (v1 != zero && v2 != zero && (v1.negative() != v2.negative())) + if (v1 != beast::zero && v2 != beast::zero && (v1.negative() != v2.negative())) return false; // v1 and v2 must be the same Issue for their difference to make sense. @@ -766,7 +768,7 @@ bool diffIsDust (STAmount const& v1, STAmount const& v2, std::uint8_t e10) // values are different, but their difference results in an STAmount // with an exponent less than -96. STAmount const diff = large - small; - if (diff == zero) + if (diff == beast::zero) return true; STAmount const ratio = divide (small, diff, v1.issue()); diff --git a/src/ripple/ledger/impl/Directory.cpp b/src/ripple/ledger/impl/Directory.cpp index 48d4593bc..2d770e3ec 100644 --- a/src/ripple/ledger/impl/Directory.cpp +++ b/src/ripple/ledger/impl/Directory.cpp @@ -72,7 +72,7 @@ const_iterator::operator==(const_iterator const& other) const const_iterator::reference const_iterator::operator*() const { - assert(index_ != zero); + assert(index_ != beast::zero); if (! cache_) cache_ = view_->read(keylet::child(index_)); return *cache_; @@ -81,7 +81,7 @@ const_iterator::operator*() const const_iterator& const_iterator::operator++() { - assert(index_ != zero); + assert(index_ != beast::zero); if (++it_ != std::end(*indexes_)) { index_ = *it_; @@ -93,7 +93,7 @@ const_iterator::operator++() if (next == 0) { page_.key = root_.key; - index_ = zero; + index_ = beast::zero; } else { @@ -103,7 +103,7 @@ const_iterator::operator++() indexes_ = &sle_->getFieldV256(sfIndexes); if (indexes_->empty()) { - index_ = zero; + index_ = beast::zero; } else { @@ -120,7 +120,7 @@ const_iterator::operator++() const_iterator const_iterator::operator++(int) { - assert(index_ != zero); + assert(index_ != beast::zero); const_iterator tmp(*this); ++(*this); return tmp; diff --git a/src/ripple/ledger/impl/View.cpp b/src/ripple/ledger/impl/View.cpp index ee7ce57a6..4828b7d0e 100644 --- a/src/ripple/ledger/impl/View.cpp +++ b/src/ripple/ledger/impl/View.cpp @@ -282,7 +282,7 @@ xrpLiquid (ReadView const& view, AccountID const& id, { auto const sle = view.read(keylet::account(id)); if (sle == nullptr) - return zero; + return beast::zero; // Return balance minus reserve if (fix1141 (view.info ().parentCloseTime)) @@ -1181,9 +1181,9 @@ rippleCredit (ApplyView& view, bool bDelete = false; // YYY Could skip this if rippling in reverse. - if (saBefore > zero + if (saBefore > beast::zero // Sender balance was positive. - && saBalance <= zero + && saBalance <= beast::zero // Sender is zero or negative. && (uFlags & (!bSenderHigh ? lsfLowReserve : lsfHighReserve)) // Sender reserve is set. @@ -1327,7 +1327,7 @@ accountSend (ApplyView& view, AccountID const& uSenderID, AccountID const& uReceiverID, STAmount const& saAmount, beast::Journal j) { - assert (saAmount >= zero); + assert (saAmount >= beast::zero); /* If we aren't sending anything or if the sender is the same as the * receiver then we don't need to do anything. @@ -1456,9 +1456,9 @@ updateTrustLine ( assert (sle); // YYY Could skip this if rippling in reverse. - if (before > zero + if (before > beast::zero // Sender balance was positive. - && after <= zero + && after <= beast::zero // Sender is zero or negative. && (flags & (!bSenderHigh ? lsfLowReserve : lsfHighReserve)) // Sender reserve is set. diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index 833eec7bd..d1b5e1651 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -303,7 +303,7 @@ PeerImp::json() ret[jss::complete_ledgers] = std::to_string(minSeq) + " - " + std::to_string(maxSeq); - if (closedLedgerHash_ != zero) + if (closedLedgerHash_ != beast::zero) ret[jss::ledger] = to_string (closedLedgerHash_); switch (sanity_.load ()) @@ -2312,7 +2312,7 @@ PeerImp::getLedger (std::shared_ptr const& m) nData.getDataPtr (), nData.getLength ()); auto const& stateMap = ledger->stateMap (); - if (stateMap.getHash() != zero) + if (stateMap.getHash() != beast::zero) { // return account state root node if possible Serializer rootNode (768); @@ -2321,11 +2321,11 @@ PeerImp::getLedger (std::shared_ptr const& m) reply.add_nodes ()->set_nodedata ( rootNode.getDataPtr (), rootNode.getLength ()); - if (ledger->info().txHash != zero) + if (ledger->info().txHash != beast::zero) { auto const& txMap = ledger->txMap (); - if (txMap.getHash() != zero) + if (txMap.getHash() != beast::zero) { rootNode.erase (); diff --git a/src/ripple/overlay/impl/TMHello.cpp b/src/ripple/overlay/impl/TMHello.cpp index e8bf4a85c..98d12f2a2 100644 --- a/src/ripple/overlay/impl/TMHello.cpp +++ b/src/ripple/overlay/impl/TMHello.cpp @@ -82,7 +82,7 @@ makeSharedValue (SSL* ssl, beast::Journal journal) // Both messages hash to the same value and the cookie // is 0. Don't allow this. - if (result == zero) + if (result == beast::zero) { JLOG(journal.error()) << "Cookie generation: identical finished messages"; return boost::none; diff --git a/src/ripple/protocol/AccountID.h b/src/ripple/protocol/AccountID.h index b50166409..b4bc8fcb6 100644 --- a/src/ripple/protocol/AccountID.h +++ b/src/ripple/protocol/AccountID.h @@ -120,7 +120,7 @@ inline bool isXRP(AccountID const& c) { - return c == zero; + return c == beast::zero; } // DEPRECATED diff --git a/src/ripple/protocol/IOUAmount.h b/src/ripple/protocol/IOUAmount.h index 7fa490d90..5ae3e5d14 100644 --- a/src/ripple/protocol/IOUAmount.h +++ b/src/ripple/protocol/IOUAmount.h @@ -26,8 +26,6 @@ #include #include -using beast::zero; - namespace ripple { /** Floating point representation of amounts with high dynamic range @@ -64,7 +62,7 @@ public: IOUAmount (beast::Zero) { - *this = zero; + *this = beast::zero; } IOUAmount (std::int64_t mantissa, int exponent) diff --git a/src/ripple/protocol/Quality.h b/src/ripple/protocol/Quality.h index 3c3690947..e8016e0c3 100644 --- a/src/ripple/protocol/Quality.h +++ b/src/ripple/protocol/Quality.h @@ -60,7 +60,7 @@ struct TAmounts bool empty() const noexcept { - return in <= zero || out <= zero; + return in <= beast::zero || out <= beast::zero; } TAmounts& operator+=(TAmounts const& rhs) diff --git a/src/ripple/protocol/STAmount.h b/src/ripple/protocol/STAmount.h index 19d9412b3..20b3f82be 100644 --- a/src/ripple/protocol/STAmount.h +++ b/src/ripple/protocol/STAmount.h @@ -191,7 +191,7 @@ public: explicit operator bool() const noexcept { - return *this != zero; + return *this != beast::zero; } STAmount& operator+= (STAmount const&); @@ -217,7 +217,7 @@ public: void negate() { - if (*this != zero) + if (*this != beast::zero) mIsNegative = !mIsNegative; } diff --git a/src/ripple/protocol/STBitString.h b/src/ripple/protocol/STBitString.h index 1981b9e6d..cfc308b6b 100644 --- a/src/ripple/protocol/STBitString.h +++ b/src/ripple/protocol/STBitString.h @@ -21,6 +21,7 @@ #define RIPPLE_PROTOCOL_STBITSTRING_H_INCLUDED #include +#include namespace ripple { @@ -118,7 +119,7 @@ public: bool isDefault () const override { - return value_ == zero; + return value_ == beast::zero; } private: diff --git a/src/ripple/protocol/UintTypes.h b/src/ripple/protocol/UintTypes.h index ccbe3f201..ac033418a 100644 --- a/src/ripple/protocol/UintTypes.h +++ b/src/ripple/protocol/UintTypes.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace ripple { namespace detail { @@ -69,7 +70,7 @@ Currency const& badCurrency(); inline bool isXRP(Currency const& c) { - return c == zero; + return c == beast::zero; } /** Returns "", "XRP", or three letter ISO code. */ diff --git a/src/ripple/protocol/XRPAmount.h b/src/ripple/protocol/XRPAmount.h index 2a45ecf78..cd625cd6b 100644 --- a/src/ripple/protocol/XRPAmount.h +++ b/src/ripple/protocol/XRPAmount.h @@ -29,8 +29,6 @@ #include #include -using beast::zero; - namespace ripple { class XRPAmount diff --git a/src/ripple/protocol/impl/IOUAmount.cpp b/src/ripple/protocol/impl/IOUAmount.cpp index d91f52c63..aaa5d8b10 100644 --- a/src/ripple/protocol/impl/IOUAmount.cpp +++ b/src/ripple/protocol/impl/IOUAmount.cpp @@ -39,7 +39,7 @@ IOUAmount::normalize () { if (mantissa_ == 0) { - *this = zero; + *this = beast::zero; return; } @@ -65,7 +65,7 @@ IOUAmount::normalize () if ((exponent_ < minExponent) || (mantissa_ < minMantissa)) { - *this = zero; + *this = beast::zero; return; } @@ -79,10 +79,10 @@ IOUAmount::normalize () IOUAmount& IOUAmount::operator+= (IOUAmount const& other) { - if (other == zero) + if (other == beast::zero) return *this; - if (*this == zero) + if (*this == beast::zero) { *this = other; return *this; @@ -109,7 +109,7 @@ IOUAmount::operator+= (IOUAmount const& other) if (mantissa_ >= -10 && mantissa_ <= 10) { - *this = zero; + *this = beast::zero; return *this; } @@ -152,7 +152,7 @@ std::string to_string (IOUAmount const& amount) { // keep full internal accuracy, but make more human friendly if possible - if (amount == zero) + if (amount == beast::zero) return "0"; int const exponent = amount.exponent (); diff --git a/src/ripple/protocol/impl/Quality.cpp b/src/ripple/protocol/impl/Quality.cpp index f7afb3793..da7441c3f 100644 --- a/src/ripple/protocol/impl/Quality.cpp +++ b/src/ripple/protocol/impl/Quality.cpp @@ -103,10 +103,10 @@ Quality composed_quality (Quality const& lhs, Quality const& rhs) { STAmount const lhs_rate (lhs.rate ()); - assert (lhs_rate != zero); + assert (lhs_rate != beast::zero); STAmount const rhs_rate (rhs.rate ()); - assert (rhs_rate != zero); + assert (rhs_rate != beast::zero); STAmount const rate (mulRound ( lhs_rate, rhs_rate, lhs_rate.issue (), true)); diff --git a/src/ripple/protocol/impl/STAmount.cpp b/src/ripple/protocol/impl/STAmount.cpp index 4eea9ecb8..2d96f1d9c 100644 --- a/src/ripple/protocol/impl/STAmount.cpp +++ b/src/ripple/protocol/impl/STAmount.cpp @@ -261,7 +261,7 @@ STAmount::STAmount (IOUAmount const& amount, Issue const& issue) : mIssue (issue) , mOffset (amount.exponent ()) , mIsNative (false) - , mIsNegative (amount < zero) + , mIsNegative (amount < beast::zero) { if (mIsNegative) mValue = static_cast (-amount.mantissa ()); @@ -274,7 +274,7 @@ STAmount::STAmount (IOUAmount const& amount, Issue const& issue) STAmount::STAmount (XRPAmount const& amount) : mOffset (0) , mIsNative (true) - , mIsNegative (amount < zero) + , mIsNegative (amount < beast::zero) { if (mIsNegative) mValue = static_cast (-amount.drops ()); @@ -345,10 +345,10 @@ STAmount operator+ (STAmount const& v1, STAmount const& v2) if (!areComparable (v1, v2)) Throw ("Can't add amounts that are't comparable!"); - if (v2 == zero) + if (v2 == beast::zero) return v1; - if (v1 == zero) + if (v1 == beast::zero) { // Result must be in terms of v1 currency and issuer. return { v1.getFName (), v1.issue (), @@ -424,12 +424,12 @@ STAmount::setIssue (Issue const& issue) std::uint64_t getRate (STAmount const& offerOut, STAmount const& offerIn) { - if (offerOut == zero) + if (offerOut == beast::zero) return 0; try { STAmount r = divide (offerIn, offerOut, noIssue()); - if (r == zero) // offer is too good + if (r == beast::zero) // offer is too good return 0; assert ((r.exponent() >= -100) && (r.exponent() <= 155)); std::uint64_t ret = r.exponent() + 100; @@ -494,7 +494,7 @@ std::string STAmount::getText () const { // keep full internal accuracy, but make more human friendly if posible - if (*this == zero) + if (*this == beast::zero) return "0"; std::string const raw_value (std::to_string (mValue)); @@ -602,7 +602,7 @@ STAmount::add (Serializer& s) const } else { - if (*this == zero) + if (*this == beast::zero) s.add64 (cNotNative); else if (mIsNegative) // 512 = not native s.add64 (mValue | (static_cast(mOffset + 512 + 97) << (64 - 10))); @@ -1029,10 +1029,10 @@ muldiv_round( STAmount divide (STAmount const& num, STAmount const& den, Issue const& issue) { - if (den == zero) + if (den == beast::zero) Throw ("division by zero"); - if (num == zero) + if (num == beast::zero) return {issue}; std::uint64_t numVal = num.mantissa(); @@ -1073,7 +1073,7 @@ divide (STAmount const& num, STAmount const& den, Issue const& issue) STAmount multiply (STAmount const& v1, STAmount const& v2, Issue const& issue) { - if (v1 == zero || v2 == zero) + if (v1 == beast::zero || v2 == beast::zero) return STAmount (issue); if (v1.native() && v2.native() && isXRP (issue)) @@ -1165,7 +1165,7 @@ STAmount mulRound (STAmount const& v1, STAmount const& v2, Issue const& issue, bool roundUp) { - if (v1 == zero || v2 == zero) + if (v1 == beast::zero || v2 == beast::zero) return {issue}; bool const xrp = isXRP (issue); @@ -1250,10 +1250,10 @@ STAmount divRound (STAmount const& num, STAmount const& den, Issue const& issue, bool roundUp) { - if (den == zero) + if (den == beast::zero) Throw ("division by zero"); - if (num == zero) + if (num == beast::zero) return {issue}; std::uint64_t numVal = num.mantissa(), denVal = den.mantissa(); diff --git a/src/ripple/protocol/impl/UintTypes.cpp b/src/ripple/protocol/impl/UintTypes.cpp index e07120221..5699a785c 100644 --- a/src/ripple/protocol/impl/UintTypes.cpp +++ b/src/ripple/protocol/impl/UintTypes.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace ripple { @@ -34,7 +34,7 @@ std::string to_string(Currency const& currency) "0123456789" "<>(){}[]|?!@#$%^&*"; - if (currency == zero) + if (currency == beast::zero) return systemCurrencyCode(); if (currency == noCurrency()) @@ -68,7 +68,7 @@ bool to_currency(Currency& currency, std::string const& code) { if (code.empty () || !code.compare (systemCurrencyCode())) { - currency = zero; + currency = beast::zero; return true; } diff --git a/src/ripple/rpc/handlers/BookOffers.cpp b/src/ripple/rpc/handlers/BookOffers.cpp index 846d2d8c5..fa96128cb 100644 --- a/src/ripple/rpc/handlers/BookOffers.cpp +++ b/src/ripple/rpc/handlers/BookOffers.cpp @@ -182,7 +182,7 @@ Json::Value doBookOffers (RPC::Context& context) context.netOps.getBookPage ( lpLedger, {{pay_currency, pay_issuer}, {get_currency, get_issuer}}, - takerID ? *takerID : zero, bProof, limit, jvMarker, jvResult); + takerID ? *takerID : beast::zero, bProof, limit, jvMarker, jvResult); context.loadType = Resource::feeMediumBurdenRPC; diff --git a/src/ripple/rpc/handlers/GatewayBalances.cpp b/src/ripple/rpc/handlers/GatewayBalances.cpp index 239f7c554..22e5c1ba5 100644 --- a/src/ripple/rpc/handlers/GatewayBalances.cpp +++ b/src/ripple/rpc/handlers/GatewayBalances.cpp @@ -181,7 +181,7 @@ Json::Value doGatewayBalances (RPC::Context& context) { // normal negative balance, obligation to customer auto& bal = sums[rs->getBalance().getCurrency()]; - if (bal == zero) + if (bal == beast::zero) { // This is needed to set the currency code correctly bal = -rs->getBalance(); diff --git a/src/ripple/rpc/handlers/LedgerEntry.cpp b/src/ripple/rpc/handlers/LedgerEntry.cpp index 60498e6f9..54bd762ec 100644 --- a/src/ripple/rpc/handlers/LedgerEntry.cpp +++ b/src/ripple/rpc/handlers/LedgerEntry.cpp @@ -77,7 +77,7 @@ Json::Value doLedgerEntry (RPC::Context& context) ! uNodeIndex.SetHex ( context.params[jss::deposit_preauth].asString())) { - uNodeIndex = zero; + uNodeIndex = beast::zero; jvResult[jss::error] = "malformedRequest"; } } diff --git a/src/ripple/rpc/handlers/LedgerRequest.cpp b/src/ripple/rpc/handlers/LedgerRequest.cpp index ec6bf50e2..8c9fa0dc8 100644 --- a/src/ripple/rpc/handlers/LedgerRequest.cpp +++ b/src/ripple/rpc/handlers/LedgerRequest.cpp @@ -118,7 +118,7 @@ Json::Value doLedgerRequest (RPC::Context& context) neededHash = hashOfSeq(*ledger, ledgerIndex, j); } assert (neededHash); - ledgerHash = neededHash ? *neededHash : zero; // kludge + ledgerHash = neededHash ? *neededHash : beast::zero; // kludge } // Try to get the desired ledger diff --git a/src/ripple/shamap/impl/SHAMapMissingNode.cpp b/src/ripple/shamap/impl/SHAMapMissingNode.cpp index 20f149743..d87a1eab1 100644 --- a/src/ripple/shamap/impl/SHAMapMissingNode.cpp +++ b/src/ripple/shamap/impl/SHAMapMissingNode.cpp @@ -18,6 +18,7 @@ //============================================================================== #include +#include #include namespace ripple { @@ -41,7 +42,7 @@ operator<< (std::ostream& out, const SHAMapMissingNode& mn) break; }; - if (mn.mNodeHash == zero) + if (mn.mNodeHash == beast::zero) out << "id : " << mn.mNodeID; else out << "hash : " << mn.mNodeHash; diff --git a/src/test/app/Taker_test.cpp b/src/test/app/Taker_test.cpp index f4880ccd7..8e59f572c 100644 --- a/src/test/app/Taker_test.cpp +++ b/src/test/app/Taker_test.cpp @@ -78,7 +78,7 @@ class Taker_test : public beast::unit_test::suite return Amounts (offer.in.zeroed (), offer.out.zeroed ()); // we need to emulate "unfunded offers" behavior - if (get_funds (AccountID (0x4702), offer.out) == zero) + if (get_funds (AccountID (0x4702), offer.out) == beast::zero) return Amounts (offer.in.zeroed (), offer.out.zeroed ()); if (done ()) diff --git a/src/test/jtx/PathSet.h b/src/test/jtx/PathSet.h index d09193185..9ca17eae1 100644 --- a/src/test/jtx/PathSet.h +++ b/src/test/jtx/PathSet.h @@ -83,14 +83,14 @@ inline Path& Path::push_back (STPathElement const& pe) inline Path& Path::push_back (Issue const& iss) { path.emplace_back (STPathElement::typeCurrency | STPathElement::typeIssuer, - zero, iss.currency, iss.account); + beast::zero, iss.currency, iss.account); return *this; } inline Path& Path::push_back (jtx::Account const& account) { - path.emplace_back (account.id (), zero, zero); + path.emplace_back (account.id (), beast::zero, beast::zero); return *this; } diff --git a/src/test/protocol/IOUAmount_test.cpp b/src/test/protocol/IOUAmount_test.cpp index b917238a4..a3ba5c32c 100644 --- a/src/test/protocol/IOUAmount_test.cpp +++ b/src/test/protocol/IOUAmount_test.cpp @@ -35,13 +35,13 @@ public: BEAST_EXPECT(z.exponent () == -100); BEAST_EXPECT(!z); BEAST_EXPECT(z.signum () == 0); - BEAST_EXPECT(z == zero); + BEAST_EXPECT(z == beast::zero); BEAST_EXPECT((z + z) == z); BEAST_EXPECT((z - z) == z); BEAST_EXPECT(z == -z); - IOUAmount const zz (zero); + IOUAmount const zz (beast::zero); BEAST_EXPECT(z == zz); } @@ -63,6 +63,8 @@ public: { testcase ("beast::Zero Comparisons"); + using beast::zero; + { IOUAmount z (zero); BEAST_EXPECT(z == zero); @@ -201,8 +203,8 @@ public: // tiny negative numbers IOUAmount tinyNeg (-minMantissa, minExponent); // Round up should give zero - BEAST_EXPECT(zero == mulRatio (tinyNeg, 1, maxUInt, true)); - BEAST_EXPECT(zero == mulRatio (tinyNeg, maxUInt - 1, maxUInt, true)); + BEAST_EXPECT(beast::zero == mulRatio (tinyNeg, 1, maxUInt, true)); + BEAST_EXPECT(beast::zero == mulRatio (tinyNeg, maxUInt - 1, maxUInt, true)); // rounding down should be tiny BEAST_EXPECT(tinyNeg == mulRatio (tinyNeg, 1, maxUInt, false)); BEAST_EXPECT(tinyNeg == mulRatio (tinyNeg, maxUInt - 1, maxUInt, false)); diff --git a/src/test/protocol/Quality_test.cpp b/src/test/protocol/Quality_test.cpp index 4ab9e24ce..aa37f9ae6 100644 --- a/src/test/protocol/Quality_test.cpp +++ b/src/test/protocol/Quality_test.cpp @@ -233,7 +233,7 @@ public: raw (4131113916555555, -16)); // .4131113916555555 Amounts const result ( q.ceil_out (value, limit)); - BEAST_EXPECT(result.in != zero); + BEAST_EXPECT(result.in != beast::zero); } } diff --git a/src/test/protocol/STAmount_test.cpp b/src/test/protocol/STAmount_test.cpp index 758105325..df23a1a21 100644 --- a/src/test/protocol/STAmount_test.cpp +++ b/src/test/protocol/STAmount_test.cpp @@ -211,9 +211,9 @@ public: unexpected (serializeAndDeserialize (hundred) != hundred, "STAmount fail"); unexpected (!zeroSt.native (), "STAmount fail"); unexpected (!hundred.native (), "STAmount fail"); - unexpected (zeroSt != zero, "STAmount fail"); - unexpected (one == zero, "STAmount fail"); - unexpected (hundred == zero, "STAmount fail"); + unexpected (zeroSt != beast::zero, "STAmount fail"); + unexpected (one == beast::zero, "STAmount fail"); + unexpected (hundred == beast::zero, "STAmount fail"); unexpected ((zeroSt < zeroSt), "STAmount fail"); unexpected (! (zeroSt < one), "STAmount fail"); unexpected (! (zeroSt < hundred), "STAmount fail"); @@ -294,9 +294,9 @@ public: unexpected (serializeAndDeserialize (hundred) != hundred, "STAmount fail"); unexpected (zeroSt.native (), "STAmount fail"); unexpected (hundred.native (), "STAmount fail"); - unexpected (zeroSt != zero, "STAmount fail"); - unexpected (one == zero, "STAmount fail"); - unexpected (hundred == zero, "STAmount fail"); + unexpected (zeroSt != beast::zero, "STAmount fail"); + unexpected (one == beast::zero, "STAmount fail"); + unexpected (hundred == beast::zero, "STAmount fail"); unexpected ((zeroSt < zeroSt), "STAmount fail"); unexpected (! (zeroSt < one), "STAmount fail"); unexpected (! (zeroSt < hundred), "STAmount fail"); @@ -460,21 +460,21 @@ public: STAmount smallXsmall = multiply (smallValue, smallValue, noIssue()); - BEAST_EXPECT(smallXsmall == zero); + BEAST_EXPECT(smallXsmall == beast::zero); STAmount bigDsmall = divide (smallValue, bigValue, noIssue()); - BEAST_EXPECT(bigDsmall == zero); + BEAST_EXPECT(bigDsmall == beast::zero); - BEAST_EXPECT(bigDsmall == zero); + BEAST_EXPECT(bigDsmall == beast::zero); bigDsmall = divide (smallValue, bigValue, xrpIssue ()); - BEAST_EXPECT(bigDsmall == zero); + BEAST_EXPECT(bigDsmall == beast::zero); bigDsmall = divide (smallValue, bigNative, xrpIssue ()); - BEAST_EXPECT(bigDsmall == zero); + BEAST_EXPECT(bigDsmall == beast::zero); // very bad offer std::uint64_t r = getRate (smallValue, bigValue); diff --git a/src/test/protocol/XRPAmount_test.cpp b/src/test/protocol/XRPAmount_test.cpp index b17a57115..c4aac63c3 100644 --- a/src/test/protocol/XRPAmount_test.cpp +++ b/src/test/protocol/XRPAmount_test.cpp @@ -46,6 +46,8 @@ public: { testcase ("beast::Zero Comparisons"); + using beast::zero; + for (auto i : { -1, 0, 1}) { XRPAmount const x (i); @@ -145,8 +147,8 @@ public: // tiny negative numbers XRPAmount tinyNeg (-1); // Round up should give zero - BEAST_EXPECT(zero == mulRatio (tinyNeg, 1, maxUInt32, true)); - BEAST_EXPECT(zero == mulRatio (tinyNeg, maxUInt32 - 1, maxUInt32, true)); + BEAST_EXPECT(beast::zero == mulRatio (tinyNeg, 1, maxUInt32, true)); + BEAST_EXPECT(beast::zero == mulRatio (tinyNeg, maxUInt32 - 1, maxUInt32, true)); // rounding down should be tiny BEAST_EXPECT(tinyNeg == mulRatio (tinyNeg, maxUInt32 - 1, maxUInt32, false)); } diff --git a/src/test/shamap/SHAMap_test.cpp b/src/test/shamap/SHAMap_test.cpp index 66549ed5a..310a1d37e 100644 --- a/src/test/shamap/SHAMap_test.cpp +++ b/src/test/shamap/SHAMap_test.cpp @@ -250,7 +250,7 @@ public: if (! backed) map.setUnbacked (); - BEAST_EXPECT(map.getHash() == zero); + BEAST_EXPECT(map.getHash() == beast::zero); for (int k = 0; k < keys.size(); ++k) { SHAMapItem item (keys[k], IntToVUC (k)); @@ -282,7 +282,7 @@ public: BEAST_EXPECT(map.delItem (keys[k])); map.invariants(); } - BEAST_EXPECT(map.getHash() == zero); + BEAST_EXPECT(map.getHash() == beast::zero); } if (backed)