mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Use static_cast instead of C-style casts for non-fundamental types
A C-style cast is equivalent to try casting in the following order: 1. const_cast(...) 2. static_cast(...) 3. const_cast(static_cast(...)) 4. reinterpret_cast(...) 5. const_cast(reinterpret_cast(...)) By using static_cast<T>(...) explicitly we avoid the possibility of an unintentional and dangerous reinterpret_cast. Furthermore static_cast<T>(...) allows for easier grepping of casts.
This commit is contained in:
@@ -145,7 +145,7 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidge
|
||||
if (settings.contains("nCoinControlMode") && !settings.value("nCoinControlMode").toBool())
|
||||
ui->radioTreeMode->click();
|
||||
if (settings.contains("nCoinControlSortColumn") && settings.contains("nCoinControlSortOrder"))
|
||||
sortView(settings.value("nCoinControlSortColumn").toInt(), ((Qt::SortOrder)settings.value("nCoinControlSortOrder").toInt()));
|
||||
sortView(settings.value("nCoinControlSortColumn").toInt(), (static_cast<Qt::SortOrder>(settings.value("nCoinControlSortOrder").toInt())));
|
||||
}
|
||||
|
||||
CoinControlDialog::~CoinControlDialog()
|
||||
@@ -431,7 +431,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
CTxOut txout(amount, (CScript)std::vector<unsigned char>(24, 0));
|
||||
CTxOut txout(amount, static_cast<CScript>(std::vector<unsigned char>(24, 0)));
|
||||
txDummy.vout.push_back(txout);
|
||||
fDust |= IsDust(txout, ::dustRelayFee);
|
||||
}
|
||||
@@ -522,7 +522,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
// Never create dust outputs; if we would, just add the dust to the fee.
|
||||
if (nChange > 0 && nChange < MIN_CHANGE)
|
||||
{
|
||||
CTxOut txout(nChange, (CScript)std::vector<unsigned char>(24, 0));
|
||||
CTxOut txout(nChange, static_cast<CScript>(std::vector<unsigned char>(24, 0)));
|
||||
if (IsDust(txout, ::dustRelayFee))
|
||||
{
|
||||
nPayFee += nChange;
|
||||
|
||||
Reference in New Issue
Block a user