From: Wladimir J. van der Laan Date: Sun, 15 Apr 2012 11:27:00 +0000 (+0200) Subject: fix warnings: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] X-Git-Tag: v0.4.0-unstable~129^2~1^2~18^2~16 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=1bdfa94a0164f73b453633861b91c67bb6bf10d8 fix warnings: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] --- diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index a246677..98702ee 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -802,8 +802,10 @@ Value getbalance(const Array& params, bool fHelp) list > listSent; wtx.GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount); if (wtx.GetDepthInMainChain() >= nMinDepth) + { BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listReceived) nBalance += r.second; + } BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listSent) nBalance -= r.second; nBalance -= allFee; @@ -1236,6 +1238,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe // Received if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth) + { BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, int64)& r, listReceived) { string account; @@ -1253,6 +1256,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe ret.push_back(entry); } } + } } void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Array& ret) diff --git a/src/db.cpp b/src/db.cpp index 2a09e2e..60e04a2 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -647,6 +647,7 @@ bool CTxDB::LoadBlockIndex() // check level 4: check whether spent txouts were spent within the main chain int nOutput = 0; if (nCheckLevel>3) + { BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent) { if (!txpos.IsNull()) @@ -687,9 +688,11 @@ bool CTxDB::LoadBlockIndex() } nOutput++; } + } } // check level 5: check whether all prevouts are marked spent if (nCheckLevel>4) + { BOOST_FOREACH(const CTxIn &txin, tx.vin) { CTxIndex txindex; @@ -700,6 +703,7 @@ bool CTxDB::LoadBlockIndex() pindexFork = pindex->pprev; } } + } } } } diff --git a/src/main.cpp b/src/main.cpp index d795ca1..ecb9a6a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1269,14 +1269,18 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex) // This rule applies to all blocks whose timestamp is after March 15, 2012, 0:00 UTC. // On testnet it is enabled as of februari 20, 2012, 0:00 UTC. if (pindex->nTime > 1331769600 || (fTestNet && pindex->nTime > 1329696000)) + { BOOST_FOREACH(CTransaction& tx, vtx) { CTxIndex txindexOld; if (txdb.ReadTxIndex(tx.GetHash(), txindexOld)) + { BOOST_FOREACH(CDiskTxPos &pos, txindexOld.vSpent) if (pos.IsNull()) return false; + } } + } // BIP16 didn't become active until Apr 1 2012 (Feb 15 on testnet) int64 nBIP16SwitchTime = fTestNet ? 1329264000 : 1333238400; diff --git a/src/main.h b/src/main.h index fc11411..e892586 100644 --- a/src/main.h +++ b/src/main.h @@ -572,9 +572,11 @@ public: // To limit dust spam, require MIN_TX_FEE/MIN_RELAY_TX_FEE if any output is less than 0.01 if (nMinFee < nBaseFee) + { BOOST_FOREACH(const CTxOut& txout, vout) if (txout.nValue < CENT) nMinFee = nBaseFee; + } // Raise the price as the block approaches full if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2) diff --git a/src/wallet.cpp b/src/wallet.cpp index 27ed722..49e1392 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -644,8 +644,10 @@ void CWalletTx::AddSupportingTransactions(CTxDB& txdb) vtxPrev.push_back(tx); if (nDepth < COPY_DEPTH) + { BOOST_FOREACH(const CTxIn& txin, tx.vin) vWorkQueue.push_back(txin.prevout.hash); + } } } } diff --git a/src/wallet.h b/src/wallet.h index e1065cf..308a266 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -551,8 +551,10 @@ public: return false; if (mapPrev.empty()) + { BOOST_FOREACH(const CMerkleTx& tx, vtxPrev) mapPrev[tx.GetHash()] = &tx; + } BOOST_FOREACH(const CTxIn& txin, ptx->vin) {