diff --git a/src/cpp/ripple/Pathfinder.cpp b/src/cpp/ripple/Pathfinder.cpp index f9113952b7..366bf18ad5 100644 --- a/src/cpp/ripple/Pathfinder.cpp +++ b/src/cpp/ripple/Pathfinder.cpp @@ -424,7 +424,7 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax } else if (!rspEntry->getBalance().isPositive() // No IOUs to send. && (!rspEntry->getLimitPeer() // Peer does not extend credit. - || *rspEntry->getBalance().negate() >= rspEntry->getLimitPeer() // No credit left. + || -rspEntry->getBalance() >= rspEntry->getLimitPeer() // No credit left. || (bRequireAuth && !rspEntry->getAuth()))) // Not authorized to hold credit. { // Path has no credit left. Ignore it. @@ -700,7 +700,7 @@ boost::unordered_set usAccountSourceCurrencies(const RippleAddress& raA // Filter out non if (saBalance.isPositive() // Have IOUs to send. || (rspEntry->getLimitPeer() // Peer extends credit. - && *saBalance.negate() < rspEntry->getLimitPeer())) // Credit left. + && -saBalance < rspEntry->getLimitPeer())) // Credit left. { // Path has no credit left. Ignore it. usCurrencies.insert(saBalance.getCurrency()); diff --git a/src/cpp/ripple/RippleCalc.cpp b/src/cpp/ripple/RippleCalc.cpp index 3ec5f8b578..fcbea270ac 100644 --- a/src/cpp/ripple/RippleCalc.cpp +++ b/src/cpp/ripple/RippleCalc.cpp @@ -233,7 +233,7 @@ TER PathState::pushNode( STAmount saOwed = lesEntries.rippleOwed(pnCur.uAccountID, pnBck.uAccountID, pnCur.uCurrencyID); - if (!saOwed.isPositive() && *saOwed.negate() >= lesEntries.rippleLimit(pnCur.uAccountID, pnBck.uAccountID, pnCur.uCurrencyID)) + if (!saOwed.isPositive() && -saOwed >= lesEntries.rippleLimit(pnCur.uAccountID, pnBck.uAccountID, pnCur.uCurrencyID)) { terResult = tecPATH_DRY; } diff --git a/src/cpp/ripple/SerializedTypes.h b/src/cpp/ripple/SerializedTypes.h index 9a75bfde20..b618c952d7 100644 --- a/src/cpp/ripple/SerializedTypes.h +++ b/src/cpp/ripple/SerializedTypes.h @@ -364,14 +364,14 @@ public: bool isGEZero() const { return !mIsNegative; } operator bool() const { return !isZero(); } - STAmount* negate() { if (!isZero()) mIsNegative = !mIsNegative; return this; } - STAmount* zero() { mOffset = mIsNative ? 0 : -100; mValue = 0; mIsNegative = false; return this; } + void negate() { if (!isZero()) mIsNegative = !mIsNegative; } + void zero() { mOffset = mIsNative ? 0 : -100; mValue = 0; mIsNegative = false; } // Zero while copying currency and issuer. - STAmount* zero(const STAmount& saTmpl) - { mCurrency = saTmpl.mCurrency; mIssuer = saTmpl.mIssuer; mIsNative = saTmpl.mIsNative; return zero(); } - STAmount* zero(const uint160& uCurrencyID, const uint160& uIssuerID) - { mCurrency = uCurrencyID; mIssuer = uIssuerID; mIsNative = !uCurrencyID; return zero(); } + void zero(const STAmount& saTmpl) + { mCurrency = saTmpl.mCurrency; mIssuer = saTmpl.mIssuer; mIsNative = saTmpl.mIsNative; zero(); } + void zero(const uint160& uCurrencyID, const uint160& uIssuerID) + { mCurrency = uCurrencyID; mIssuer = uIssuerID; mIsNative = !uCurrencyID; zero(); } int compare(const STAmount&) const;