Skip to content

Commit

Permalink
Merge #979: [Compilation] Pass caught exceptions by reference
Browse files Browse the repository at this point in the history
c826092 [Refactor] Replace tabs with spaces (warrows)
b69f37e [Refactor] Add const qualifier to exception catching (warrows)
bf91dac [Compilation] Pass caught exceptions by reference (warrows)

Pull request description:

  Gets rid of compiler warnings such as "warning: catching polymorphic type 'class std::runtime_error' by value [-Wcatch-value=]"

ACKs for top commit:
  furszy:
    ACK [`c826092`](c826092)
  random-zebra:
    ACK c826092

Tree-SHA512: a2c02fdeab2d0e3cddde7a983456a680776592e9381be90968e0dc04bc86b7d5ea4d9aeb8259d39060fcd04583bb35259170fe5c28b8f0e96cf7aa94a3f21b2c
  • Loading branch information
random-zebra committed Sep 21, 2019
2 parents 469d974 + c826092 commit 8ffc045
Show file tree
Hide file tree
Showing 43 changed files with 569 additions and 568 deletions.
12 changes: 6 additions & 6 deletions src/activemasternode.cpp
Expand Up @@ -275,8 +275,8 @@ bool CActiveMasternode::CreateBroadcast(std::string strService, std::string strK

bool CActiveMasternode::CreateBroadcast(CTxIn vin, CService service, CKey keyCollateralAddress, CPubKey pubKeyCollateralAddress, CKey keyMasternode, CPubKey pubKeyMasternode, std::string& errorMessage, CMasternodeBroadcast &mnb)
{
// wait for reindex and/or import to finish
if (fImporting || fReindex) return false;
// wait for reindex and/or import to finish
if (fImporting || fReindex) return false;

CMasternodePing mnp(vin);
if (!mnp.Sign(keyMasternode, pubKeyMasternode)) {
Expand Down Expand Up @@ -343,8 +343,8 @@ bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secr

bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey, std::string strTxHash, std::string strOutputIndex)
{
// wait for reindex and/or import to finish
if (fImporting || fReindex) return false;
// wait for reindex and/or import to finish
if (fImporting || fReindex) return false;

// Find possible candidates
TRY_LOCK(pwalletMain->cs_wallet, fWallet);
Expand Down Expand Up @@ -395,8 +395,8 @@ bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secr
// Extract Masternode vin information from output
bool CActiveMasternode::GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubkey, CKey& secretKey)
{
// wait for reindex and/or import to finish
if (fImporting || fReindex) return false;
// wait for reindex and/or import to finish
if (fImporting || fReindex) return false;

CScript pubScript;

Expand Down
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Expand Up @@ -224,7 +224,7 @@ class CMainParams : public CChainParams
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 212);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x02)(0x2D)(0x25)(0x33).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x02)(0x21)(0x31)(0x2B).convert_to_container<std::vector<unsigned char> >();
// BIP44 coin type is from https://github.com/satoshilabs/slips/blob/master/slip-0044.md
// BIP44 coin type is from https://github.com/satoshilabs/slips/blob/master/slip-0044.md
base58Prefixes[EXT_COIN_TYPE] = boost::assign::list_of(0x80)(0x00)(0x00)(0x77).convert_to_container<std::vector<unsigned char> >();

convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));
Expand Down
10 changes: 5 additions & 5 deletions src/init.cpp
Expand Up @@ -1123,7 +1123,7 @@ bool AppInit2()
try {
boost::filesystem::copy_file(sourceFile, backupFile);
LogPrintf("Creating backup of %s -> %s\n", sourceFile, backupFile);
} catch (boost::filesystem::filesystem_error& error) {
} catch (const boost::filesystem::filesystem_error& error) {
LogPrintf("Failed to create backup %s\n", error.what());
}
#else
Expand Down Expand Up @@ -1159,7 +1159,7 @@ bool AppInit2()
try {
boost::filesystem::remove(file.second);
LogPrintf("Old backup deleted: %s\n", file.second);
} catch (boost::filesystem::filesystem_error& error) {
} catch (const boost::filesystem::filesystem_error& error) {
LogPrintf("Failed to delete backup %s\n", error.what());
}
}
Expand Down Expand Up @@ -1197,7 +1197,7 @@ bool AppInit2()
boost::filesystem::remove_all(zerocoinDir);
LogPrintf("-resync: folder deleted: %s\n", zerocoinDir.string().c_str());
}
} catch (boost::filesystem::filesystem_error& error) {
} catch (const boost::filesystem::filesystem_error& error) {
LogPrintf("Failed to delete blockchain folders %s\n", error.what());
}
}
Expand All @@ -1212,7 +1212,7 @@ bool AppInit2()
try {
boost::filesystem::rename(pathDatabase, pathDatabaseBak);
LogPrintf("Moved old %s to %s. Retrying.\n", pathDatabase.string(), pathDatabaseBak.string());
} catch (boost::filesystem::filesystem_error& error) {
} catch (const boost::filesystem::filesystem_error& error) {
// failure is ok (well, not really, but it's not worse than what we started with)
}

Expand Down Expand Up @@ -1576,7 +1576,7 @@ bool AppInit2()
break;
}
}
} catch (std::exception& e) {
} catch (const std::exception& e) {
if (fDebug) LogPrintf("%s\n", e.what());
strLoadError = _("Error opening block database");
fVerifyingBlocks = false;
Expand Down

0 comments on commit 8ffc045

Please sign in to comment.