Browse Source

fix warnings: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]

0.8
Wladimir J. van der Laan 13 years ago
parent
commit
da7bbd9dfd
  1. 4
      src/bitcoinrpc.cpp
  2. 4
      src/db.cpp
  3. 4
      src/main.cpp
  4. 2
      src/main.h
  5. 2
      src/wallet.cpp
  6. 2
      src/wallet.h

4
src/bitcoinrpc.cpp

@ -796,8 +796,10 @@ Value getbalance(const Array& params, bool fHelp)
list<pair<CBitcoinAddress, int64> > listSent; list<pair<CBitcoinAddress, int64> > listSent;
wtx.GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount); wtx.GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount);
if (wtx.GetDepthInMainChain() >= nMinDepth) if (wtx.GetDepthInMainChain() >= nMinDepth)
{
BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listReceived) BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listReceived)
nBalance += r.second; nBalance += r.second;
}
BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listSent) BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listSent)
nBalance -= r.second; nBalance -= r.second;
nBalance -= allFee; nBalance -= allFee;
@ -1228,6 +1230,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
// Received // Received
if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth) if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth)
{
BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, int64)& r, listReceived) BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, int64)& r, listReceived)
{ {
string account; string account;
@ -1245,6 +1248,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
ret.push_back(entry); ret.push_back(entry);
} }
} }
}
} }
void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Array& ret) void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Array& ret)

4
src/db.cpp

@ -642,6 +642,7 @@ bool CTxDB::LoadBlockIndex()
// check level 4: check whether spent txouts were spent within the main chain // check level 4: check whether spent txouts were spent within the main chain
int nOutput = 0; int nOutput = 0;
if (nCheckLevel>3) if (nCheckLevel>3)
{
BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent) BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent)
{ {
if (!txpos.IsNull()) if (!txpos.IsNull())
@ -682,9 +683,11 @@ bool CTxDB::LoadBlockIndex()
} }
nOutput++; nOutput++;
} }
}
} }
// check level 5: check whether all prevouts are marked spent // check level 5: check whether all prevouts are marked spent
if (nCheckLevel>4) if (nCheckLevel>4)
{
BOOST_FOREACH(const CTxIn &txin, tx.vin) BOOST_FOREACH(const CTxIn &txin, tx.vin)
{ {
CTxIndex txindex; CTxIndex txindex;
@ -695,6 +698,7 @@ bool CTxDB::LoadBlockIndex()
pindexFork = pindex->pprev; pindexFork = pindex->pprev;
} }
} }
}
} }
} }
} }

4
src/main.cpp

@ -1261,14 +1261,18 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex)
// This rule applies to all blocks whose timestamp is after March 15, 2012, 0:00 UTC. // 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. // On testnet it is enabled as of februari 20, 2012, 0:00 UTC.
if (pindex->nTime > 1331769600 || (fTestNet && pindex->nTime > 1329696000)) if (pindex->nTime > 1331769600 || (fTestNet && pindex->nTime > 1329696000))
{
BOOST_FOREACH(CTransaction& tx, vtx) BOOST_FOREACH(CTransaction& tx, vtx)
{ {
CTxIndex txindexOld; CTxIndex txindexOld;
if (txdb.ReadTxIndex(tx.GetHash(), txindexOld)) if (txdb.ReadTxIndex(tx.GetHash(), txindexOld))
{
BOOST_FOREACH(CDiskTxPos &pos, txindexOld.vSpent) BOOST_FOREACH(CDiskTxPos &pos, txindexOld.vSpent)
if (pos.IsNull()) if (pos.IsNull())
return false; return false;
}
} }
}
// BIP16 didn't become active until Apr 1 2012 (Feb 15 on testnet) // BIP16 didn't become active until Apr 1 2012 (Feb 15 on testnet)
int64 nBIP16SwitchTime = fTestNet ? 1329264000 : 1333238400; int64 nBIP16SwitchTime = fTestNet ? 1329264000 : 1333238400;

2
src/main.h

@ -573,9 +573,11 @@ public:
// To limit dust spam, require MIN_TX_FEE/MIN_RELAY_TX_FEE if any output is less than 0.01 // To limit dust spam, require MIN_TX_FEE/MIN_RELAY_TX_FEE if any output is less than 0.01
if (nMinFee < nBaseFee) if (nMinFee < nBaseFee)
{
BOOST_FOREACH(const CTxOut& txout, vout) BOOST_FOREACH(const CTxOut& txout, vout)
if (txout.nValue < CENT) if (txout.nValue < CENT)
nMinFee = nBaseFee; nMinFee = nBaseFee;
}
// Raise the price as the block approaches full // Raise the price as the block approaches full
if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2) if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)

2
src/wallet.cpp

@ -648,8 +648,10 @@ void CWalletTx::AddSupportingTransactions(CTxDB& txdb)
vtxPrev.push_back(tx); vtxPrev.push_back(tx);
if (nDepth < COPY_DEPTH) if (nDepth < COPY_DEPTH)
{
BOOST_FOREACH(const CTxIn& txin, tx.vin) BOOST_FOREACH(const CTxIn& txin, tx.vin)
vWorkQueue.push_back(txin.prevout.hash); vWorkQueue.push_back(txin.prevout.hash);
}
} }
} }
} }

2
src/wallet.h

@ -553,8 +553,10 @@ public:
return false; return false;
if (mapPrev.empty()) if (mapPrev.empty())
{
BOOST_FOREACH(const CMerkleTx& tx, vtxPrev) BOOST_FOREACH(const CMerkleTx& tx, vtxPrev)
mapPrev[tx.GetHash()] = &tx; mapPrev[tx.GetHash()] = &tx;
}
BOOST_FOREACH(const CTxIn& txin, ptx->vin) BOOST_FOREACH(const CTxIn& txin, ptx->vin)
{ {

Loading…
Cancel
Save