diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/addrman.h | 2 | ||||
-rw-r--r-- | src/core_read.cpp | 6 | ||||
-rw-r--r-- | src/httpserver.cpp | 2 | ||||
-rw-r--r-- | src/net.cpp | 14 | ||||
-rw-r--r-- | src/net_processing.cpp | 2 | ||||
-rw-r--r-- | src/netaddress.cpp | 6 | ||||
-rw-r--r-- | src/netbase.cpp | 2 | ||||
-rw-r--r-- | src/primitives/block.h | 4 | ||||
-rw-r--r-- | src/protocol.h | 4 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 2 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 6 | ||||
-rw-r--r-- | src/qt/coincontroldialog.cpp | 6 | ||||
-rw-r--r-- | src/qt/coincontroltreewidget.cpp | 2 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 2 | ||||
-rw-r--r-- | src/qt/splashscreen.cpp | 2 | ||||
-rw-r--r-- | src/qt/transactionview.cpp | 2 | ||||
-rw-r--r-- | src/qt/walletmodel.cpp | 2 | ||||
-rw-r--r-- | src/qt/winshutdownmonitor.cpp | 2 | ||||
-rw-r--r-- | src/script/script.h | 2 | ||||
-rw-r--r-- | src/test/versionbits_tests.cpp | 4 | ||||
-rw-r--r-- | src/torcontrol.cpp | 6 | ||||
-rw-r--r-- | src/txdb.h | 2 | ||||
-rw-r--r-- | src/validation.cpp | 4 | ||||
-rw-r--r-- | src/wallet/wallet.h | 2 |
24 files changed, 44 insertions, 44 deletions
diff --git a/src/addrman.h b/src/addrman.h index 172cb5f45b..38da754afb 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -59,7 +59,7 @@ public: template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action) { - READWRITE(*(CAddress*)this); + READWRITE(*static_cast<CAddress*>(this)); READWRITE(source); READWRITE(nLastSuccess); READWRITE(nAttempts); diff --git a/src/core_read.cpp b/src/core_read.cpp index 4ccb967087..6a8308f869 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -33,14 +33,14 @@ CScript ParseScript(const std::string& s) if (op < OP_NOP && op != OP_RESERVED) continue; - const char* name = GetOpName((opcodetype)op); + const char* name = GetOpName(static_cast<opcodetype>(op)); if (strcmp(name, "OP_UNKNOWN") == 0) continue; std::string strName(name); - mapOpNames[strName] = (opcodetype)op; + mapOpNames[strName] = static_cast<opcodetype>(op); // Convenience: OP_ADD and just ADD are both recognized: boost::algorithm::replace_first(strName, "OP_", ""); - mapOpNames[strName] = (opcodetype)op; + mapOpNames[strName] = static_cast<opcodetype>(op); } } diff --git a/src/httpserver.cpp b/src/httpserver.cpp index a022d220e0..73dce8d571 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -525,7 +525,7 @@ struct event_base* EventBase() static void httpevent_callback_fn(evutil_socket_t, short, void* data) { // Static handler: simply call inner handler - HTTPEvent *self = ((HTTPEvent*)data); + HTTPEvent *self = static_cast<HTTPEvent*>(data); self->handler(); if (self->deleteWhenTriggered) delete self; diff --git a/src/net.cpp b/src/net.cpp index b5d0b7de95..03ed7e7fc1 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -297,7 +297,7 @@ CNode* CConnman::FindNode(const CNetAddr& ip) { LOCK(cs_vNodes); for (CNode* pnode : vNodes) { - if ((CNetAddr)pnode->addr == ip) { + if (static_cast<CNetAddr>(pnode->addr) == ip) { return pnode; } } @@ -308,7 +308,7 @@ CNode* CConnman::FindNode(const CSubNet& subNet) { LOCK(cs_vNodes); for (CNode* pnode : vNodes) { - if (subNet.Match((CNetAddr)pnode->addr)) { + if (subNet.Match(static_cast<CNetAddr>(pnode->addr))) { return pnode; } } @@ -330,7 +330,7 @@ CNode* CConnman::FindNode(const CService& addr) { LOCK(cs_vNodes); for (CNode* pnode : vNodes) { - if ((CService)pnode->addr == addr) { + if (static_cast<CService>(pnode->addr) == addr) { return pnode; } } @@ -370,7 +370,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo return nullptr; // Look for an existing connection - CNode* pnode = FindNode((CService)addrConnect); + CNode* pnode = FindNode(static_cast<CService>(addrConnect)); if (pnode) { LogPrintf("Failed to open new connection, already connected\n"); @@ -398,7 +398,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo // Also store the name we used to connect in that CNode, so that future FindNode() calls to that // name catch this early. LOCK(cs_vNodes); - CNode* pnode = FindNode((CService)addrConnect); + CNode* pnode = FindNode(static_cast<CService>(addrConnect)); if (pnode) { pnode->MaybeSetAddrName(std::string(pszDest)); @@ -559,7 +559,7 @@ void CConnman::Ban(const CSubNet& subNet, const BanReason &banReason, int64_t ba { LOCK(cs_vNodes); for (CNode* pnode : vNodes) { - if (subNet.Match((CNetAddr)pnode->addr)) + if (subNet.Match(static_cast<CNetAddr>(pnode->addr))) pnode->fDisconnect = true; } } @@ -1965,7 +1965,7 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai } if (!pszDest) { if (IsLocal(addrConnect) || - FindNode((CNetAddr)addrConnect) || IsBanned(addrConnect) || + FindNode(static_cast<CNetAddr>(addrConnect)) || IsBanned(addrConnect) || FindNode(addrConnect.ToStringIPPort())) return; } else if (FindNode(std::string(pszDest))) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index edebccfb31..fc0ba82d8b 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2863,7 +2863,7 @@ static bool SendRejectsAndCheckIfBanned(CNode* pnode, CConnman* connman) CNodeState &state = *State(pnode->GetId()); for (const CBlockReject& reject : state.rejects) { - connman->PushMessage(pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, (std::string)NetMsgType::BLOCK, reject.chRejectCode, reject.strRejectReason, reject.hashBlock)); + connman->PushMessage(pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, std::string(NetMsgType::BLOCK), reject.chRejectCode, reject.strRejectReason, reject.hashBlock)); } state.rejects.clear(); diff --git a/src/netaddress.cpp b/src/netaddress.cpp index 81f72879f4..4f231d73c8 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -522,17 +522,17 @@ unsigned short CService::GetPort() const bool operator==(const CService& a, const CService& b) { - return (CNetAddr)a == (CNetAddr)b && a.port == b.port; + return static_cast<CNetAddr>(a) == static_cast<CNetAddr>(b) && a.port == b.port; } bool operator!=(const CService& a, const CService& b) { - return (CNetAddr)a != (CNetAddr)b || a.port != b.port; + return static_cast<CNetAddr>(a) != static_cast<CNetAddr>(b) || a.port != b.port; } bool operator<(const CService& a, const CService& b) { - return (CNetAddr)a < (CNetAddr)b || ((CNetAddr)a == (CNetAddr)b && a.port < b.port); + return static_cast<CNetAddr>(a) < static_cast<CNetAddr>(b) || (static_cast<CNetAddr>(a) == static_cast<CNetAddr>(b) && a.port < b.port); } bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const diff --git a/src/netbase.cpp b/src/netbase.cpp index d51277c495..5be3fe34f8 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -572,7 +572,7 @@ bool HaveNameProxy() { bool IsProxy(const CNetAddr &addr) { LOCK(cs_proxyInfos); for (int i = 0; i < NET_MAX; i++) { - if (addr == (CNetAddr)proxyInfo[i].proxy) + if (addr == static_cast<CNetAddr>(proxyInfo[i].proxy)) return true; } return false; diff --git a/src/primitives/block.h b/src/primitives/block.h index 612a9fa203..5d6d44ac76 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -86,14 +86,14 @@ public: CBlock(const CBlockHeader &header) { SetNull(); - *((CBlockHeader*)this) = header; + *(static_cast<CBlockHeader*>(this)) = header; } ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action) { - READWRITE(*(CBlockHeader*)this); + READWRITE(*static_cast<CBlockHeader*>(this)); READWRITE(vtx); } diff --git a/src/protocol.h b/src/protocol.h index aaeb90eee2..42eb57e4f0 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -346,8 +346,8 @@ public: READWRITE(nTime); uint64_t nServicesInt = nServices; READWRITE(nServicesInt); - nServices = (ServiceFlags)nServicesInt; - READWRITE(*(CService*)this); + nServices = static_cast<ServiceFlags>(nServicesInt); + READWRITE(*static_cast<CService*>(this)); } // TODO: make private (improves encapsulation) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index b26d99a20a..e567a177f9 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -705,7 +705,7 @@ int main(int argc, char *argv[]) if (BitcoinCore::baseInitialize()) { app.requestInitialize(); #if defined(Q_OS_WIN) && QT_VERSION >= 0x050000 - WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), (HWND)app.getMainWinId()); + WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), static_cast<HWND>(app.getMainWinId())); #endif app.exec(); app.requestShutdown(); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index afd90a3bc6..4e868b7c17 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -599,7 +599,7 @@ void BitcoinGUI::createTrayIconMenu() #else // Note: On Mac, the dock icon is used to provide the tray's functionality. MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance(); - dockIconHandler->setMainWindow((QMainWindow *)this); + dockIconHandler->setMainWindow(static_cast<QMainWindow*>(this)); trayIconMenu = dockIconHandler->dockMenu(); #endif @@ -922,13 +922,13 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned buttons = QMessageBox::Ok; showNormalIfMinimized(); - QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this); + QMessageBox mBox(static_cast<QMessageBox::Icon>(nMBoxIcon), strTitle, message, buttons, this); int r = mBox.exec(); if (ret != nullptr) *ret = r == QMessageBox::Ok; } else - notificator->notify((Notificator::Class)nNotifyIcon, strTitle, message); + notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message); } void BitcoinGUI::changeEvent(QEvent *e) diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index acb3f2346f..8d2e5619e0 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -142,7 +142,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() @@ -428,7 +428,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); } @@ -519,7 +519,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; diff --git a/src/qt/coincontroltreewidget.cpp b/src/qt/coincontroltreewidget.cpp index 82db28d586..e7326d3f7a 100644 --- a/src/qt/coincontroltreewidget.cpp +++ b/src/qt/coincontroltreewidget.cpp @@ -24,7 +24,7 @@ void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event) else if (event->key() == Qt::Key_Escape) // press esc -> close dialog { event->ignore(); - CoinControlDialog *coinControlDialog = (CoinControlDialog*)this->parentWidget(); + CoinControlDialog *coinControlDialog = static_cast<CoinControlDialog*>(this->parentWidget()); coinControlDialog->done(QDialog::Accepted); } else diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 1227e340ce..871822ccb4 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -351,7 +351,7 @@ void SendCoinsDialog::on_sendButton_clicked() SendConfirmationDialog confirmationDialog(tr("Confirm send coins"), questionString.arg(formatted.join("<br />")), SEND_CONFIRM_DELAY, this); confirmationDialog.exec(); - QMessageBox::StandardButton retval = (QMessageBox::StandardButton)confirmationDialog.result(); + QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result()); if(retval != QMessageBox::Yes) { diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index fa3bd18d5a..5df1282f73 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -38,7 +38,7 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) float fontFactor = 1.0; float devicePixelRatio = 1.0; #if QT_VERSION > 0x050100 - devicePixelRatio = ((QGuiApplication*)QCoreApplication::instance())->devicePixelRatio(); + devicePixelRatio = static_cast<QGuiApplication*>(QCoreApplication::instance())->devicePixelRatio(); #endif // define text to place diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index fa43ab750a..88f8f463bc 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -322,7 +322,7 @@ void TransactionView::chooseWatchonly(int idx) if(!transactionProxyModel) return; transactionProxyModel->setWatchOnlyFilter( - (TransactionFilterProxy::WatchOnlyFilter)watchOnlyWidget->itemData(idx).toInt()); + static_cast<TransactionFilterProxy::WatchOnlyFilter>(watchOnlyWidget->itemData(idx).toInt())); } void TransactionView::changedSearch() diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 4d7e977fcb..541114e5fe 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -695,7 +695,7 @@ bool WalletModel::bumpFee(uint256 hash) questionString.append("</td></tr></table>"); SendConfirmationDialog confirmationDialog(tr("Confirm fee bump"), questionString); confirmationDialog.exec(); - QMessageBox::StandardButton retval = (QMessageBox::StandardButton)confirmationDialog.result(); + QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result()); // cancel sign&broadcast if users doesn't want to bump the fee if (retval != QMessageBox::Yes) { diff --git a/src/qt/winshutdownmonitor.cpp b/src/qt/winshutdownmonitor.cpp index 1e7a76efc0..e11a72899d 100644 --- a/src/qt/winshutdownmonitor.cpp +++ b/src/qt/winshutdownmonitor.cpp @@ -56,7 +56,7 @@ bool WinShutdownMonitor::nativeEventFilter(const QByteArray &eventType, void *pM void WinShutdownMonitor::registerShutdownBlockReason(const QString& strReason, const HWND& mainWinId) { typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR); - PSHUTDOWNBRCREATE shutdownBRCreate = (PSHUTDOWNBRCREATE)GetProcAddress(GetModuleHandleA("User32.dll"), "ShutdownBlockReasonCreate"); + PSHUTDOWNBRCREATE shutdownBRCreate = static_cast<PSHUTDOWNBRCREATE>(GetProcAddress(GetModuleHandleA("User32.dll"), "ShutdownBlockReasonCreate")); if (shutdownBRCreate == nullptr) { qWarning() << "registerShutdownBlockReason: GetProcAddress for ShutdownBlockReasonCreate failed"; return; diff --git a/src/script/script.h b/src/script/script.h index bedf5f9be5..591777672e 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -568,7 +568,7 @@ public: pc += nSize; } - opcodeRet = (opcodetype)opcode; + opcodeRet = static_cast<opcodetype>(opcode); return true; } diff --git a/src/test/versionbits_tests.cpp b/src/test/versionbits_tests.cpp index 12f113655a..5d6f781404 100644 --- a/src/test/versionbits_tests.cpp +++ b/src/test/versionbits_tests.cpp @@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE(versionbits_test) const auto chainParams = CreateChainParams(CBaseChainParams::MAIN); const Consensus::Params &mainnetParams = chainParams->GetConsensus(); for (int i=0; i<(int) Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) { - uint32_t bitmask = VersionBitsMask(mainnetParams, (Consensus::DeploymentPos)i); + uint32_t bitmask = VersionBitsMask(mainnetParams, static_cast<Consensus::DeploymentPos>(i)); // Make sure that no deployment tries to set an invalid bit. BOOST_CHECK_EQUAL(bitmask & ~(uint32_t)VERSIONBITS_TOP_MASK, bitmask); @@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE(versionbits_test) // activated soft fork could be later changed to be earlier to avoid // overlap.) for (int j=i+1; j<(int) Consensus::MAX_VERSION_BITS_DEPLOYMENTS; j++) { - if (VersionBitsMask(mainnetParams, (Consensus::DeploymentPos)j) == bitmask) { + if (VersionBitsMask(mainnetParams, static_cast<Consensus::DeploymentPos>(j)) == bitmask) { BOOST_CHECK(mainnetParams.vDeployments[j].nStartTime > mainnetParams.vDeployments[i].nTimeout || mainnetParams.vDeployments[i].nStartTime > mainnetParams.vDeployments[j].nTimeout); } diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index c45b5dac0d..d875008ef2 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -133,7 +133,7 @@ TorControlConnection::~TorControlConnection() void TorControlConnection::readcb(struct bufferevent *bev, void *ctx) { - TorControlConnection *self = (TorControlConnection*)ctx; + TorControlConnection *self = static_cast<TorControlConnection*>(ctx); struct evbuffer *input = bufferevent_get_input(bev); size_t n_read_out = 0; char *line; @@ -178,7 +178,7 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx) void TorControlConnection::eventcb(struct bufferevent *bev, short what, void *ctx) { - TorControlConnection *self = (TorControlConnection*)ctx; + TorControlConnection *self = static_cast<TorControlConnection*>(ctx); if (what & BEV_EVENT_CONNECTED) { LogPrint(BCLog::TOR, "tor: Successfully connected!\n"); self->connected(*self); @@ -725,7 +725,7 @@ fs::path TorController::GetPrivateKeyFile() void TorController::reconnect_cb(evutil_socket_t fd, short what, void *arg) { - TorController *self = (TorController*)arg; + TorController *self = static_cast<TorController*>(arg); self->Reconnect(); } diff --git a/src/txdb.h b/src/txdb.h index 3edeb4648e..2fc69e563b 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -46,7 +46,7 @@ struct CDiskTxPos : public CDiskBlockPos template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action) { - READWRITE(*(CDiskBlockPos*)this); + READWRITE(*static_cast<CDiskBlockPos*>(this)); READWRITE(VARINT(nTxOffset)); } diff --git a/src/validation.cpp b/src/validation.cpp index 698ef9181d..16b656c7f5 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1689,9 +1689,9 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para int32_t nVersion = VERSIONBITS_TOP_BITS; for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) { - ThresholdState state = VersionBitsState(pindexPrev, params, (Consensus::DeploymentPos)i, versionbitscache); + ThresholdState state = VersionBitsState(pindexPrev, params, static_cast<Consensus::DeploymentPos>(i), versionbitscache); if (state == THRESHOLD_LOCKED_IN || state == THRESHOLD_STARTED) { - nVersion |= VersionBitsMask(params, (Consensus::DeploymentPos)i); + nVersion |= VersionBitsMask(params, static_cast<Consensus::DeploymentPos>(i)); } } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a4684c2935..fefe415bb1 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -408,7 +408,7 @@ public: mapValue["timesmart"] = strprintf("%u", nTimeSmart); } - READWRITE(*(CMerkleTx*)this); + READWRITE(*static_cast<CMerkleTx*>(this)); std::vector<CMerkleTx> vUnused; //!< Used to be vtxPrev READWRITE(vUnused); READWRITE(mapValue); |