From: CryptoManiac Date: Thu, 31 Mar 2016 16:02:47 +0000 (+0300) Subject: Merge pull request #296 from svost/patch X-Git-Tag: nvc-v0.5.8~15^2 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=c95d66bd55a225326e81dce15d347f04b1d71d67;hp=e78811a329c528498cf7e64e6957a4bcba52c713 Merge pull request #296 from svost/patch Minor fix --- diff --git a/src/alert.cpp b/src/alert.cpp index 65927ed..ea2bc57 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -79,11 +79,6 @@ std::string CUnsignedAlert::ToString() const strStatusBar.c_str()); } -void CUnsignedAlert::print() const -{ - printf("%s", ToString().c_str()); -} - void CAlert::SetNull() { CUnsignedAlert::SetNull(); diff --git a/src/alert.h b/src/alert.h index 3e4dd53..c417842 100644 --- a/src/alert.h +++ b/src/alert.h @@ -61,7 +61,6 @@ public: void SetNull(); std::string ToString() const; - void print() const; }; /** An alert is a combination of a serialized CUnsignedAlert and a signature. */ diff --git a/src/checkpoints.h b/src/checkpoints.h index 0250618..a2b9731 100644 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -100,11 +100,6 @@ public: nVersion, hashCheckpoint.ToString().c_str()); } - - void print() const - { - printf("%s", ToString().c_str()); - } }; class CSyncCheckpoint : public CUnsignedSyncCheckpoint diff --git a/src/db.h b/src/db.h index 993b7a7..07bb2b0 100644 --- a/src/db.h +++ b/src/db.h @@ -137,8 +137,7 @@ protected: CDataStream ssValue((char*)datValue.get_data(), (char*)datValue.get_data() + datValue.get_size(), SER_DISK, CLIENT_VERSION); ssValue >> value; } - catch (std::exception &e) { - (void)e; + catch (const std::exception&) { return false; } diff --git a/src/init.cpp b/src/init.cpp index 8b0302c..0801311 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -778,8 +778,7 @@ bool AppInit2() strLoadError = _("Error loading block database"); break; } - } catch(std::exception &e) { - (void)e; + } catch(const std::exception&) { strLoadError = _("Error opening block database"); break; } diff --git a/src/main.cpp b/src/main.cpp index 9ef3d64..502aa15 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -435,7 +435,6 @@ CTransaction::GetLegacySigOpCount() const return nSigOps; } - int CMerkleTx::SetMerkleBranch(const CBlock* pblock) { if (fClient) @@ -446,16 +445,6 @@ int CMerkleTx::SetMerkleBranch(const CBlock* pblock) else { CBlock blockTmp; - if (pblock == NULL) - { - // Load the block this tx is in - CTxIndex txindex; - if (!CTxDB("r").ReadTxIndex(GetHash(), txindex)) - return 0; - if (!blockTmp.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos)) - return 0; - pblock = &blockTmp; - } // Update the tx's hashBlock hashBlock = pblock->GetHash(); @@ -480,19 +469,13 @@ int CMerkleTx::SetMerkleBranch(const CBlock* pblock) map::iterator mi = mapBlockIndex.find(hashBlock); if (mi == mapBlockIndex.end()) return 0; - CBlockIndex* pindex = (*mi).second; + const CBlockIndex* pindex = (*mi).second; if (!pindex || !pindex->IsInMainChain()) return 0; return pindexBest->nHeight - pindex->nHeight + 1; } - - - - - - bool CTransaction::CheckTransaction() const { // Basic checks that don't depend on any context diff --git a/src/main.h b/src/main.h index 63884b2..cb7650c 100644 --- a/src/main.h +++ b/src/main.h @@ -620,8 +620,7 @@ public: try { filein >> *this; } - catch (std::exception &e) { - (void)e; + catch (const std::exception&) { return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION); } @@ -795,7 +794,7 @@ public: ) - int SetMerkleBranch(const CBlock* pblock=NULL); + int SetMerkleBranch(const CBlock* pblock); int GetDepthInMainChain(CBlockIndex* &pindexRet) const; int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); } bool IsInMainChain() const { return GetDepthInMainChain() > 0; } @@ -1096,8 +1095,7 @@ public: try { filein >> *this; } - catch (std::exception &e) { - (void)e; + catch (const std::exception&) { return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION); } diff --git a/src/miner.cpp b/src/miner.cpp index 5d01bb2..aae9589 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -70,14 +70,6 @@ public: ptx = ptxIn; dPriority = dFeePerKb = 0; } - - void print() const - { - printf("COrphan(hash=%s, dPriority=%.1f, dFeePerKb=%.1f)\n", - ptx->GetHash().ToString().substr(0,10).c_str(), dPriority, dFeePerKb); - BOOST_FOREACH(uint256 hash, setDependsOn) - printf(" setDependsOn %s\n", hash.ToString().substr(0,10).c_str()); - } }; diff --git a/src/netbase.cpp b/src/netbase.cpp index 4699abf..b68a43a 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -923,11 +923,6 @@ uint64_t CNetAddr::GetHash() const return nRet; } -void CNetAddr::print() const -{ - printf("CNetAddr(%s)\n", ToString().c_str()); -} - // private extensions to enum Network, only returned by GetExtNetwork, // and only used in GetReachabilityFrom static const int NET_UNKNOWN = NET_MAX + 0; @@ -1170,11 +1165,6 @@ std::string CService::ToString() const return ToStringIPPort(); } -void CService::print() const -{ - printf("CService(%s)\n", ToString().c_str()); -} - void CService::SetPort(unsigned short portIn) { port = portIn; diff --git a/src/netbase.h b/src/netbase.h index 7e995f6..95f93e9 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -71,7 +71,6 @@ class CNetAddr bool GetInAddr(struct in_addr* pipv4Addr) const; std::vector GetGroup() const; int GetReachabilityFrom(const CNetAddr *paddrPartner = NULL) const; - void print() const; #ifdef USE_IPV6 CNetAddr(const struct in6_addr& pipv6Addr); @@ -115,7 +114,6 @@ class CService : public CNetAddr std::string ToString() const; std::string ToStringPort() const; std::string ToStringIPPort() const; - void print() const; #ifdef USE_IPV6 CService(const struct in6_addr& ipv6Addr, uint16_t port); diff --git a/src/protocol.cpp b/src/protocol.cpp index 8ee8304..c9b0086 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -103,10 +103,4 @@ const char* CInv::GetCommand() const std::string CInv::ToString() const { return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,20).c_str()); -} - -void CInv::print() const -{ - printf("CInv(%s)\n", ToString().c_str()); -} - +} \ No newline at end of file diff --git a/src/protocol.h b/src/protocol.h index ece6184..fcc8c9e 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -93,8 +93,6 @@ class CAddress : public CService READWRITE(*pip); ) - void print() const; - // TODO: make private (improves encapsulation) public: uint64_t nServices; @@ -125,7 +123,6 @@ class CInv bool IsKnownType() const; const char* GetCommand() const; std::string ToString() const; - void print() const; // TODO: make private (improves encapsulation) public: diff --git a/src/qt/multisigdialog.cpp b/src/qt/multisigdialog.cpp index 97e49cf..c804c99 100644 --- a/src/qt/multisigdialog.cpp +++ b/src/qt/multisigdialog.cpp @@ -347,9 +347,8 @@ void MultisigDialog::on_transaction_textChanged() { ss >> tx; } - catch(std::exception &e) + catch(const std::exception&) { - (void)e; return; } @@ -418,9 +417,8 @@ void MultisigDialog::on_signTransactionButton_clicked() { ss >> tx; } - catch(std::exception &e) + catch(const std::exception&) { - (void)e; return; } CTransaction mergedTx(tx); @@ -538,9 +536,8 @@ void MultisigDialog::on_sendTransactionButton_clicked() { ssData >> tx; } - catch(std::exception &e) + catch(const std::exception&) { - (void)e; return; } uint256 txHash = tx.GetHash(); diff --git a/src/txdb-leveldb.h b/src/txdb-leveldb.h index c73dda6..07c7088 100644 --- a/src/txdb-leveldb.h +++ b/src/txdb-leveldb.h @@ -91,8 +91,7 @@ protected: SER_DISK, CLIENT_VERSION); ssValue >> value; } - catch (std::exception &e) { - (void)e; + catch (const std::exception&) { return false; } return true; diff --git a/src/wallet.h b/src/wallet.h index 4db32e5..34540fd 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -891,11 +891,6 @@ public: { return strprintf("COutput(%s, %d, %d, %d) [%s]", tx->GetHash().ToString().substr(0,10).c_str(), i, fSpendable, nDepth, FormatMoney(tx->vout[i].nValue).c_str()); } - - void print() const - { - printf("%s\n", ToString().c_str()); - } }; diff --git a/src/walletdb.cpp b/src/walletdb.cpp index ab85b07..3880a93 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -654,7 +654,7 @@ DBErrors CWalletDB::FindWalletTx(CWallet* pwallet, vector& vTxHash) } pcursor->close(); } - catch (boost::thread_interrupted) { + catch (const boost::thread_interrupted&) { throw; } catch (...) {