aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/coins.h10
-rw-r--r--src/net.h6
-rw-r--r--src/streams.h16
-rw-r--r--src/support/lockedpool.h12
-rw-r--r--src/txdb.h8
-rw-r--r--src/wallet/db.h7
-rw-r--r--src/wallet/walletdb.h5
7 files changed, 30 insertions, 34 deletions
diff --git a/src/coins.h b/src/coins.h
index efb5ce869c..181b2fd4b9 100644
--- a/src/coins.h
+++ b/src/coins.h
@@ -214,6 +214,11 @@ protected:
public:
CCoinsViewCache(CCoinsView *baseIn);
+ /**
+ * By deleting the copy constructor, we prevent accidentally using it when one intends to create a cache on top of a base cache.
+ */
+ CCoinsViewCache(const CCoinsViewCache &) = delete;
+
// Standard CCoinsView methods
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override;
bool HaveCoin(const COutPoint &outpoint) const override;
@@ -290,11 +295,6 @@ public:
private:
CCoinsMap::iterator FetchCoin(const COutPoint &outpoint) const;
-
- /**
- * By making the copy constructor private, we prevent accidentally using it when one intends to create a cache on top of a base cache.
- */
- CCoinsViewCache(const CCoinsViewCache &);
};
//! Utility function to add all of a transaction's outputs to a cache.
diff --git a/src/net.h b/src/net.h
index ca2433aa54..cfc383ced5 100644
--- a/src/net.h
+++ b/src/net.h
@@ -702,13 +702,11 @@ public:
CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress &addrBindIn, const std::string &addrNameIn = "", bool fInboundIn = false);
~CNode();
+ CNode(const CNode&) = delete;
+ CNode& operator=(const CNode&) = delete;
private:
- CNode(const CNode&);
- void operator=(const CNode&);
const NodeId id;
-
-
const uint64_t nLocalHostNonce;
// Services offered to this peer
const ServiceFlags nLocalServices;
diff --git a/src/streams.h b/src/streams.h
index 159847279d..9a3badea57 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -455,10 +455,6 @@ public:
class CAutoFile
{
private:
- // Disallow copies
- CAutoFile(const CAutoFile&);
- CAutoFile& operator=(const CAutoFile&);
-
const int nType;
const int nVersion;
@@ -475,6 +471,10 @@ public:
fclose();
}
+ // Disallow copies
+ CAutoFile(const CAutoFile&) = delete;
+ CAutoFile& operator=(const CAutoFile&) = delete;
+
void fclose()
{
if (file) {
@@ -564,10 +564,6 @@ public:
class CBufferedFile
{
private:
- // Disallow copies
- CBufferedFile(const CBufferedFile&);
- CBufferedFile& operator=(const CBufferedFile&);
-
const int nType;
const int nVersion;
@@ -609,6 +605,10 @@ public:
fclose();
}
+ // Disallow copies
+ CBufferedFile(const CBufferedFile&) = delete;
+ CBufferedFile& operator=(const CBufferedFile&) = delete;
+
int GetVersion() const { return nVersion; }
int GetType() const { return nType; }
diff --git a/src/support/lockedpool.h b/src/support/lockedpool.h
index cecbdec1aa..834f0371e2 100644
--- a/src/support/lockedpool.h
+++ b/src/support/lockedpool.h
@@ -50,6 +50,9 @@ public:
Arena(void *base, size_t size, size_t alignment);
virtual ~Arena();
+ Arena(const Arena& other) = delete; // non construction-copyable
+ Arena& operator=(const Arena&) = delete; // non copyable
+
/** Memory statistics. */
struct Stats
{
@@ -85,9 +88,6 @@ public:
*/
bool addressInArena(void *ptr) const { return ptr >= base && ptr < end; }
private:
- Arena(const Arena& other) = delete; // non construction-copyable
- Arena& operator=(const Arena&) = delete; // non copyable
-
/** Map of chunk address to chunk information. This class makes use of the
* sorted order to merge previous and next chunks during deallocation.
*/
@@ -153,6 +153,9 @@ public:
explicit LockedPool(std::unique_ptr<LockedPageAllocator> allocator, LockingFailed_Callback lf_cb_in = nullptr);
~LockedPool();
+ LockedPool(const LockedPool& other) = delete; // non construction-copyable
+ LockedPool& operator=(const LockedPool&) = delete; // non copyable
+
/** Allocate size bytes from this arena.
* Returns pointer on success, or 0 if memory is full or
* the application tried to allocate 0 bytes.
@@ -168,9 +171,6 @@ public:
/** Get pool usage statistics */
Stats stats() const;
private:
- LockedPool(const LockedPool& other) = delete; // non construction-copyable
- LockedPool& operator=(const LockedPool&) = delete; // non copyable
-
std::unique_ptr<LockedPageAllocator> allocator;
/** Create an arena from locked pages */
diff --git a/src/txdb.h b/src/txdb.h
index d1cd5a4250..c254ba91c8 100644
--- a/src/txdb.h
+++ b/src/txdb.h
@@ -110,10 +110,10 @@ class CBlockTreeDB : public CDBWrapper
{
public:
explicit CBlockTreeDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
-private:
- CBlockTreeDB(const CBlockTreeDB&);
- void operator=(const CBlockTreeDB&);
-public:
+
+ CBlockTreeDB(const CBlockTreeDB&) = delete;
+ CBlockTreeDB& operator=(const CBlockTreeDB&) = delete;
+
bool WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo);
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &fileinfo);
bool ReadLastBlockFile(int &nFile);
diff --git a/src/wallet/db.h b/src/wallet/db.h
index 6f3cfe9557..14283ac8f8 100644
--- a/src/wallet/db.h
+++ b/src/wallet/db.h
@@ -156,6 +156,9 @@ public:
explicit CDB(CWalletDBWrapper& dbw, const char* pszMode = "r+", bool fFlushOnCloseIn=true);
~CDB() { Close(); }
+ CDB(const CDB&) = delete;
+ CDB& operator=(const CDB&) = delete;
+
void Flush();
void Close();
static bool Recover(const std::string& filename, void *callbackDataIn, bool (*recoverKVcallback)(void* callbackData, CDataStream ssKey, CDataStream ssValue), std::string& out_backup_filename);
@@ -168,10 +171,6 @@ public:
/* verifies the database file */
static bool VerifyDatabaseFile(const std::string& walletFile, const fs::path& dataDir, std::string& warningStr, std::string& errorStr, CDBEnv::recoverFunc_type recoverFunc);
-private:
- CDB(const CDB&);
- void operator=(const CDB&);
-
public:
template <typename K, typename T>
bool Read(const K& key, T& value)
diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h
index 4f8ea185d5..3a146179af 100644
--- a/src/wallet/walletdb.h
+++ b/src/wallet/walletdb.h
@@ -167,6 +167,8 @@ public:
m_dbw(dbw)
{
}
+ CWalletDB(const CWalletDB&) = delete;
+ CWalletDB& operator=(const CWalletDB&) = delete;
bool WriteName(const std::string& strAddress, const std::string& strName);
bool EraseName(const std::string& strAddress);
@@ -244,9 +246,6 @@ public:
private:
CDB batch;
CWalletDBWrapper& m_dbw;
-
- CWalletDB(const CWalletDB&);
- void operator=(const CWalletDB&);
};
//! Compacts BDB state so that wallet.dat is self-contained (if there are changes)