diff --git a/src/crypto/aes.cpp b/src/crypto/aes.cpp --- a/src/crypto/aes.cpp +++ b/src/crypto/aes.cpp @@ -101,7 +101,6 @@ template static int CBCDecrypt(const T &dec, const uint8_t iv[AES_BLOCKSIZE], const uint8_t *data, int size, bool pad, uint8_t *out) { - uint8_t padsize = 0; int written = 0; bool fail = false; const uint8_t *prev = iv; @@ -123,7 +122,7 @@ if (pad) { // If used, padding size is the value of the last decrypted byte. For // it to be valid, It must be between 1 and AES_BLOCKSIZE. - padsize = *--out; + uint8_t padsize = *--out; fail = !padsize | (padsize > AES_BLOCKSIZE); // If not well-formed, treat it as though there's no padding. diff --git a/src/qt/coincontroltreewidget.cpp b/src/qt/coincontroltreewidget.cpp --- a/src/qt/coincontroltreewidget.cpp +++ b/src/qt/coincontroltreewidget.cpp @@ -13,13 +13,14 @@ if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox { event->ignore(); - int COLUMN_CHECKBOX = 0; - if (this->currentItem()) + if (this->currentItem()) { + int COLUMN_CHECKBOX = 0; this->currentItem()->setCheckState( COLUMN_CHECKBOX, ((this->currentItem()->checkState( COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked)); + } } else if (event->key() == Qt::Key_Escape) // press esc -> close dialog { event->ignore(); diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -49,9 +49,8 @@ int role) const { if (!index.isValid() || index.row() >= list.length()) return QVariant(); - const RecentRequestEntry *rec = &list[index.row()]; - if (role == Qt::DisplayRole || role == Qt::EditRole) { + const RecentRequestEntry *rec = &list[index.row()]; switch (index.column()) { case Date: return GUIUtil::dateTimeStr(rec->date); diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -38,13 +38,14 @@ } void TrafficGraphWidget::paintPath(QPainterPath &path, QQueue &samples) { - int h = height() - YMARGIN * 2, w = width() - XMARGIN * 2; - int sampleCount = samples.size(), x = XMARGIN + w, y; + int sampleCount = samples.size(); if (sampleCount > 0) { + int h = height() - YMARGIN * 2, w = width() - XMARGIN * 2; + int x = XMARGIN + w; path.moveTo(x, YMARGIN + h); for (int i = 0; i < sampleCount; ++i) { x = XMARGIN + w - w * i / DESIRED_SAMPLES; - y = YMARGIN + h - (int)(h * samples.at(i) / fMax); + int y = YMARGIN + h - (int)(h * samples.at(i) / fMax); path.lineTo(x, y); } path.lineTo(x, YMARGIN + h); diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -116,16 +116,14 @@ std::shared_ptr coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript) { static const int nInnerLoopCount = 0x100000; - int nHeightStart = 0; int nHeightEnd = 0; int nHeight = 0; { // Don't keep cs_main locked. LOCK(cs_main); - nHeightStart = chainActive.Height(); - nHeight = nHeightStart; - nHeightEnd = nHeightStart + nGenerate; + nHeight = chainActive.Height(); + nHeightEnd = nHeight + nGenerate; } unsigned int nExtraNonce = 0; diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1316,7 +1316,6 @@ CTransactionRef tx(MakeTransactionRef(std::move(mtx))); const uint256 &txid = tx->GetId(); - bool fLimitFree = false; Amount nMaxRawTxFee = maxTxFee; if (request.params.size() > 1 && request.params[1].get_bool()) { nMaxRawTxFee = Amount::zero(); @@ -1336,6 +1335,7 @@ // Push to local node and sync with wallets. CValidationState state; bool fMissingInputs; + bool fLimitFree = false; if (!AcceptToMemoryPool(config, g_mempool, state, std::move(tx), fLimitFree, &fMissingInputs, false, nMaxRawTxFee)) { diff --git a/src/script/sign.cpp b/src/script/sign.cpp --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -142,10 +142,9 @@ bool ProduceSignature(const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata) { CScript script = fromPubKey; - bool solved = true; std::vector result; txnouttype whichType; - solved = SignStep(creator, script, result, whichType); + bool solved = SignStep(creator, script, result, whichType); CScript subscript; if (solved && whichType == TX_SCRIPTHASH) { diff --git a/src/test/checkqueue_tests.cpp b/src/test/checkqueue_tests.cpp --- a/src/test/checkqueue_tests.cpp +++ b/src/test/checkqueue_tests.cpp @@ -385,11 +385,11 @@ boost::thread_group tg; std::mutex m; std::condition_variable cv; - bool has_lock{false}; - bool has_tried{false}; - bool done{false}; - bool done_ack{false}; { + bool has_lock{false}; + bool has_tried{false}; + bool done{false}; + bool done_ack{false}; std::unique_lock l(m); tg.create_thread([&] { CCheckQueueControl control(queue.get()); diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -470,7 +470,6 @@ CDB::CDB(CWalletDBWrapper &dbw, const char *pszMode, bool fFlushOnCloseIn) : pdb(nullptr), activeTxn(nullptr) { - int ret; fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w')); fFlushOnClose = fFlushOnCloseIn; env = dbw.env; @@ -495,6 +494,7 @@ pdb = env->mapDb[strFilename]; if (pdb == nullptr) { + int ret; std::unique_ptr pdb_temp = std::make_unique(env->dbenv.get(), 0);