Skip to content

Commit b6a4891

Browse files
author
MarcoFalke
committed
Merge #9964: Add const to methods that do not modify the object for which it is called
6e8c48d Add const to methods that do not modify the object for which it is called (practicalswift) Pull request description: Tree-SHA512: a6888111ba16fb796e320e60806e1a77d36f545989b5405dc7319992291800109eab0b8e8c286b784778f41f1ff5289e7cb6b4afd7aec77f385fbcafc02cffc1
2 parents 7db65c3 + 6e8c48d commit b6a4891

23 files changed

+38
-38
lines changed

src/addrdb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class CBanEntry
6161
banReason = BanReasonUnknown;
6262
}
6363

64-
std::string banReasonToString()
64+
std::string banReasonToString() const
6565
{
6666
switch (banReason) {
6767
case BanReasonNodeMisbehaving:

src/dbwrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ bool CDBWrapper::IsEmpty()
190190
}
191191

192192
CDBIterator::~CDBIterator() { delete piter; }
193-
bool CDBIterator::Valid() { return piter->Valid(); }
193+
bool CDBIterator::Valid() const { return piter->Valid(); }
194194
void CDBIterator::SeekToFirst() { piter->SeekToFirst(); }
195195
void CDBIterator::Next() { piter->Next(); }
196196

src/dbwrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class CDBIterator
130130
parent(_parent), piter(_piter) { };
131131
~CDBIterator();
132132

133-
bool Valid();
133+
bool Valid() const;
134134

135135
void SeekToFirst();
136136

src/merkleblock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class CPartialMerkleTree
6363
bool fBad;
6464

6565
/** helper function to efficiently calculate the number of nodes at given height in the merkle tree */
66-
unsigned int CalcTreeWidth(int height) {
66+
unsigned int CalcTreeWidth(int height) const {
6767
return (nTransactions+(1 << height)-1) >> height;
6868
}
6969

src/miner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ void BlockAssembler::onlyUnconfirmed(CTxMemPool::setEntries& testSet)
224224
}
225225
}
226226

227-
bool BlockAssembler::TestPackage(uint64_t packageSize, int64_t packageSigOpsCost)
227+
bool BlockAssembler::TestPackage(uint64_t packageSize, int64_t packageSigOpsCost) const
228228
{
229229
// TODO: switch to weight-based accounting for packages instead of vsize-based accounting.
230230
if (nBlockWeight + WITNESS_SCALE_FACTOR * packageSize >= nBlockMaxWeight)

src/miner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class BlockAssembler
187187
/** Remove confirmed (inBlock) entries from given set */
188188
void onlyUnconfirmed(CTxMemPool::setEntries& testSet);
189189
/** Test if a new package would "fit" in the block */
190-
bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost);
190+
bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost) const;
191191
/** Perform checks on each transaction in a package:
192192
* locktime, premature-witness, serialized size (if necessary)
193193
* These checks should always succeed, and they're here

src/qt/bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class BitcoinApplication: public QApplication
227227
void requestShutdown();
228228

229229
/// Get process return value
230-
int getReturnValue() { return returnValue; }
230+
int getReturnValue() const { return returnValue; }
231231

232232
/// Get window identifier of QMainWindow (BitcoinGUI)
233233
WId getMainWinId() const;

src/qt/modaloverlay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Q_SLOTS:
3232
// will show or hide the modal layer
3333
void showHide(bool hide = false, bool userRequested = false);
3434
void closeClicked();
35-
bool isLayerVisible() { return layerIsVisible; }
35+
bool isLayerVisible() const { return layerIsVisible; }
3636

3737
protected:
3838
bool eventFilter(QObject * obj, QEvent * ev);

src/qt/optionsmodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void OptionsModel::setRestartRequired(bool fRequired)
441441
return settings.setValue("fRestartRequired", fRequired);
442442
}
443443

444-
bool OptionsModel::isRestartRequired()
444+
bool OptionsModel::isRestartRequired() const
445445
{
446446
QSettings settings;
447447
return settings.value("fRestartRequired", false).toBool();

src/qt/optionsmodel.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ class OptionsModel : public QAbstractListModel
5959
void setDisplayUnit(const QVariant &value);
6060

6161
/* Explicit getters */
62-
bool getHideTrayIcon() { return fHideTrayIcon; }
63-
bool getMinimizeToTray() { return fMinimizeToTray; }
64-
bool getMinimizeOnClose() { return fMinimizeOnClose; }
65-
int getDisplayUnit() { return nDisplayUnit; }
66-
QString getThirdPartyTxUrls() { return strThirdPartyTxUrls; }
62+
bool getHideTrayIcon() const { return fHideTrayIcon; }
63+
bool getMinimizeToTray() const { return fMinimizeToTray; }
64+
bool getMinimizeOnClose() const { return fMinimizeOnClose; }
65+
int getDisplayUnit() const { return nDisplayUnit; }
66+
QString getThirdPartyTxUrls() const { return strThirdPartyTxUrls; }
6767
bool getProxySettings(QNetworkProxy& proxy) const;
68-
bool getCoinControlFeatures() { return fCoinControlFeatures; }
68+
bool getCoinControlFeatures() const { return fCoinControlFeatures; }
6969
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
7070

7171
/* Restart flag helper */
7272
void setRestartRequired(bool fRequired);
73-
bool isRestartRequired();
73+
bool isRestartRequired() const;
7474

7575
private:
7676
/* Qt-only settings */

0 commit comments

Comments
 (0)