Merge pull request #296 from svost/patch
authorCryptoManiac <CryptoManiac@users.noreply.github.com>
Thu, 31 Mar 2016 16:02:47 +0000 (19:02 +0300)
committerCryptoManiac <CryptoManiac@users.noreply.github.com>
Thu, 31 Mar 2016 16:02:47 +0000 (19:02 +0300)
Minor fix

16 files changed:
src/alert.cpp
src/alert.h
src/checkpoints.h
src/db.h
src/init.cpp
src/main.cpp
src/main.h
src/miner.cpp
src/netbase.cpp
src/netbase.h
src/protocol.cpp
src/protocol.h
src/qt/multisigdialog.cpp
src/txdb-leveldb.h
src/wallet.h
src/walletdb.cpp

index 65927ed..ea2bc57 100644 (file)
@@ -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();
index 3e4dd53..c417842 100644 (file)
@@ -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. */
index 0250618..a2b9731 100644 (file)
@@ -100,11 +100,6 @@ public:
             nVersion,
             hashCheckpoint.ToString().c_str());
     }
-
-    void print() const
-    {
-        printf("%s", ToString().c_str());
-    }
 };
 
 class CSyncCheckpoint : public CUnsignedSyncCheckpoint
index 993b7a7..07bb2b0 100644 (file)
--- 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;
         }
 
index 8b0302c..0801311 100644 (file)
@@ -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;
             }
index 9ef3d64..502aa15 100644 (file)
@@ -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<uint256, CBlockIndex*>::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
index 63884b2..cb7650c 100644 (file)
@@ -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);
         }
 
index 5d01bb2..aae9589 100644 (file)
@@ -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());
-    }
 };
 
 
index 4699abf..b68a43a 100644 (file)
@@ -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;
index 7e995f6..95f93e9 100644 (file)
@@ -71,7 +71,6 @@ class CNetAddr
         bool GetInAddr(struct in_addr* pipv4Addr) const;
         std::vector<unsigned char> 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);
index 8ee8304..c9b0086 100644 (file)
@@ -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
index ece6184..fcc8c9e 100644 (file)
@@ -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:
index 97e49cf..c804c99 100644 (file)
@@ -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();
index c73dda6..07c7088 100644 (file)
@@ -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;
index 4db32e5..34540fd 100644 (file)
@@ -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());
-    }
 };
 
 
index ab85b07..3880a93 100644 (file)
@@ -654,7 +654,7 @@ DBErrors CWalletDB::FindWalletTx(CWallet* pwallet, vector<uint256>& vTxHash)
         }
         pcursor->close();
     }
-    catch (boost::thread_interrupted) {
+    catch (const boost::thread_interrupted&) {
         throw;
     }
     catch (...) {