Skip to content

Commit 53a6590

Browse files
committed
Make float <-> int casts explicit outside of test, qt, CFeeRate
1 parent 0b1b914 commit 53a6590

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/policy/fees.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,5 +1043,5 @@ CAmount FeeFilterRounder::round(CAmount currentMinFee)
10431043
if ((it != feeset.begin() && insecure_rand.rand32() % 3 != 0) || it == feeset.end()) {
10441044
it--;
10451045
}
1046-
return *it;
1046+
return static_cast<CAmount>(*it);
10471047
}

src/rpc/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
146146
obj.push_back(Pair("timeoffset", stats.nTimeOffset));
147147
if (stats.dPingTime > 0.0)
148148
obj.push_back(Pair("pingtime", stats.dPingTime));
149-
if (stats.dMinPing < std::numeric_limits<int64_t>::max()/1e6)
149+
if (stats.dMinPing < static_cast<double>(std::numeric_limits<int64_t>::max())/1e6)
150150
obj.push_back(Pair("minping", stats.dMinPing));
151151
if (stats.dPingWait > 0.0)
152152
obj.push_back(Pair("pingwait", stats.dPingWait));

src/txmempool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ class CTxMemPool
507507
* check does nothing.
508508
*/
509509
void check(const CCoinsViewCache *pcoins) const;
510-
void setSanityCheck(double dFrequency = 1.0) { nCheckFrequency = dFrequency * 4294967295.0; }
510+
void setSanityCheck(double dFrequency = 1.0) { nCheckFrequency = static_cast<uint32_t>(dFrequency * 4294967295.0); }
511511

512512
// addUnchecked must updated state for all ancestors of a given transaction,
513513
// to track size/count of descendant transactions. First version of

src/wallet/wallet.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,11 @@ bool CWallet::ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase,
390390
{
391391
int64_t nStartTime = GetTimeMillis();
392392
crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod);
393-
pMasterKey.second.nDeriveIterations = pMasterKey.second.nDeriveIterations * (100 / ((double)(GetTimeMillis() - nStartTime)));
393+
pMasterKey.second.nDeriveIterations = static_cast<unsigned int>(pMasterKey.second.nDeriveIterations * (100 / ((double)(GetTimeMillis() - nStartTime))));
394394

395395
nStartTime = GetTimeMillis();
396396
crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod);
397-
pMasterKey.second.nDeriveIterations = (pMasterKey.second.nDeriveIterations + pMasterKey.second.nDeriveIterations * 100 / ((double)(GetTimeMillis() - nStartTime))) / 2;
397+
pMasterKey.second.nDeriveIterations = (pMasterKey.second.nDeriveIterations + static_cast<unsigned int>(pMasterKey.second.nDeriveIterations * 100 / ((double)(GetTimeMillis() - nStartTime)))) / 2;
398398

399399
if (pMasterKey.second.nDeriveIterations < 25000)
400400
pMasterKey.second.nDeriveIterations = 25000;
@@ -595,11 +595,11 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
595595
CCrypter crypter;
596596
int64_t nStartTime = GetTimeMillis();
597597
crypter.SetKeyFromPassphrase(strWalletPassphrase, kMasterKey.vchSalt, 25000, kMasterKey.nDerivationMethod);
598-
kMasterKey.nDeriveIterations = 2500000 / ((double)(GetTimeMillis() - nStartTime));
598+
kMasterKey.nDeriveIterations = static_cast<unsigned int>(2500000 / ((double)(GetTimeMillis() - nStartTime)));
599599

600600
nStartTime = GetTimeMillis();
601601
crypter.SetKeyFromPassphrase(strWalletPassphrase, kMasterKey.vchSalt, kMasterKey.nDeriveIterations, kMasterKey.nDerivationMethod);
602-
kMasterKey.nDeriveIterations = (kMasterKey.nDeriveIterations + kMasterKey.nDeriveIterations * 100 / ((double)(GetTimeMillis() - nStartTime))) / 2;
602+
kMasterKey.nDeriveIterations = (kMasterKey.nDeriveIterations + static_cast<unsigned int>(kMasterKey.nDeriveIterations * 100 / ((double)(GetTimeMillis() - nStartTime)))) / 2;
603603

604604
if (kMasterKey.nDeriveIterations < 25000)
605605
kMasterKey.nDeriveIterations = 25000;

0 commit comments

Comments
 (0)