mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
clang-tidy: Fix modernize-use-default-member-init
in headers
See https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-default-member-init.html
This commit is contained in:
parent
357d750cab
commit
96ee992ac3
33 changed files with 69 additions and 73 deletions
|
@ -32,7 +32,7 @@ bool CCoinsViewBacked::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock,
|
||||||
std::unique_ptr<CCoinsViewCursor> CCoinsViewBacked::Cursor() const { return base->Cursor(); }
|
std::unique_ptr<CCoinsViewCursor> CCoinsViewBacked::Cursor() const { return base->Cursor(); }
|
||||||
size_t CCoinsViewBacked::EstimateSize() const { return base->EstimateSize(); }
|
size_t CCoinsViewBacked::EstimateSize() const { return base->EstimateSize(); }
|
||||||
|
|
||||||
CCoinsViewCache::CCoinsViewCache(CCoinsView *baseIn) : CCoinsViewBacked(baseIn), cachedCoinsUsage(0) {}
|
CCoinsViewCache::CCoinsViewCache(CCoinsView* baseIn) : CCoinsViewBacked(baseIn) {}
|
||||||
|
|
||||||
size_t CCoinsViewCache::DynamicMemoryUsage() const {
|
size_t CCoinsViewCache::DynamicMemoryUsage() const {
|
||||||
return memusage::DynamicUsage(cacheCoins) + cachedCoinsUsage;
|
return memusage::DynamicUsage(cacheCoins) + cachedCoinsUsage;
|
||||||
|
|
|
@ -220,7 +220,7 @@ protected:
|
||||||
mutable CCoinsMap cacheCoins;
|
mutable CCoinsMap cacheCoins;
|
||||||
|
|
||||||
/* Cached dynamic memory usage for the inner Coin objects. */
|
/* Cached dynamic memory usage for the inner Coin objects. */
|
||||||
mutable size_t cachedCoinsUsage;
|
mutable size_t cachedCoinsUsage{0};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCoinsViewCache(CCoinsView *baseIn);
|
CCoinsViewCache(CCoinsView *baseIn);
|
||||||
|
|
|
@ -239,7 +239,7 @@ void Transform(uint32_t* s, const unsigned char* chunk)
|
||||||
|
|
||||||
////// RIPEMD160
|
////// RIPEMD160
|
||||||
|
|
||||||
CRIPEMD160::CRIPEMD160() : bytes(0)
|
CRIPEMD160::CRIPEMD160()
|
||||||
{
|
{
|
||||||
ripemd160::Initialize(s);
|
ripemd160::Initialize(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class CRIPEMD160
|
||||||
private:
|
private:
|
||||||
uint32_t s[5];
|
uint32_t s[5];
|
||||||
unsigned char buf[64];
|
unsigned char buf[64];
|
||||||
uint64_t bytes;
|
uint64_t bytes{0};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const size_t OUTPUT_SIZE = 20;
|
static const size_t OUTPUT_SIZE = 20;
|
||||||
|
|
|
@ -146,7 +146,7 @@ void Transform(uint32_t* s, const unsigned char* chunk)
|
||||||
|
|
||||||
////// SHA1
|
////// SHA1
|
||||||
|
|
||||||
CSHA1::CSHA1() : bytes(0)
|
CSHA1::CSHA1()
|
||||||
{
|
{
|
||||||
sha1::Initialize(s);
|
sha1::Initialize(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class CSHA1
|
||||||
private:
|
private:
|
||||||
uint32_t s[5];
|
uint32_t s[5];
|
||||||
unsigned char buf[64];
|
unsigned char buf[64];
|
||||||
uint64_t bytes;
|
uint64_t bytes{0};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const size_t OUTPUT_SIZE = 20;
|
static const size_t OUTPUT_SIZE = 20;
|
||||||
|
|
|
@ -673,7 +673,7 @@ std::string SHA256AutoDetect()
|
||||||
|
|
||||||
////// SHA-256
|
////// SHA-256
|
||||||
|
|
||||||
CSHA256::CSHA256() : bytes(0)
|
CSHA256::CSHA256()
|
||||||
{
|
{
|
||||||
sha256::Initialize(s);
|
sha256::Initialize(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class CSHA256
|
||||||
private:
|
private:
|
||||||
uint32_t s[8];
|
uint32_t s[8];
|
||||||
unsigned char buf[64];
|
unsigned char buf[64];
|
||||||
uint64_t bytes;
|
uint64_t bytes{0};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const size_t OUTPUT_SIZE = 32;
|
static const size_t OUTPUT_SIZE = 32;
|
||||||
|
|
|
@ -151,7 +151,7 @@ void Transform(uint64_t* s, const unsigned char* chunk)
|
||||||
|
|
||||||
////// SHA-512
|
////// SHA-512
|
||||||
|
|
||||||
CSHA512::CSHA512() : bytes(0)
|
CSHA512::CSHA512()
|
||||||
{
|
{
|
||||||
sha512::Initialize(s);
|
sha512::Initialize(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class CSHA512
|
||||||
private:
|
private:
|
||||||
uint64_t s[8];
|
uint64_t s[8];
|
||||||
unsigned char buf[128];
|
unsigned char buf[128];
|
||||||
uint64_t bytes;
|
uint64_t bytes{0};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr size_t OUTPUT_SIZE = 64;
|
static constexpr size_t OUTPUT_SIZE = 64;
|
||||||
|
|
|
@ -166,7 +166,7 @@ private:
|
||||||
std::vector<Element> table;
|
std::vector<Element> table;
|
||||||
|
|
||||||
/** size stores the total available slots in the hash table */
|
/** size stores the total available slots in the hash table */
|
||||||
uint32_t size;
|
uint32_t size{0};
|
||||||
|
|
||||||
/** The bit_packed_atomic_flags array is marked mutable because we want
|
/** The bit_packed_atomic_flags array is marked mutable because we want
|
||||||
* garbage collection to be allowed to occur from const methods */
|
* garbage collection to be allowed to occur from const methods */
|
||||||
|
@ -183,7 +183,7 @@ private:
|
||||||
* decremented on insert and reset to the new number of inserts which would
|
* decremented on insert and reset to the new number of inserts which would
|
||||||
* cause the epoch to reach epoch_size when it reaches zero.
|
* cause the epoch to reach epoch_size when it reaches zero.
|
||||||
*/
|
*/
|
||||||
uint32_t epoch_heuristic_counter;
|
uint32_t epoch_heuristic_counter{0};
|
||||||
|
|
||||||
/** epoch_size is set to be the number of elements supposed to be in a
|
/** epoch_size is set to be the number of elements supposed to be in a
|
||||||
* epoch. When the number of non-erased elements in an epoch
|
* epoch. When the number of non-erased elements in an epoch
|
||||||
|
@ -193,12 +193,12 @@ private:
|
||||||
* one "dead" which has been erased, one "dying" which has been marked to be
|
* one "dead" which has been erased, one "dying" which has been marked to be
|
||||||
* erased next, and one "living" which new inserts add to.
|
* erased next, and one "living" which new inserts add to.
|
||||||
*/
|
*/
|
||||||
uint32_t epoch_size;
|
uint32_t epoch_size{0};
|
||||||
|
|
||||||
/** depth_limit determines how many elements insert should try to replace.
|
/** depth_limit determines how many elements insert should try to replace.
|
||||||
* Should be set to log2(n).
|
* Should be set to log2(n).
|
||||||
*/
|
*/
|
||||||
uint8_t depth_limit;
|
uint8_t depth_limit{0};
|
||||||
|
|
||||||
/** hash_function is a const instance of the hash function. It cannot be
|
/** hash_function is a const instance of the hash function. It cannot be
|
||||||
* static or initialized at call time as it may have internal state (such as
|
* static or initialized at call time as it may have internal state (such as
|
||||||
|
@ -322,8 +322,7 @@ public:
|
||||||
/** You must always construct a cache with some elements via a subsequent
|
/** You must always construct a cache with some elements via a subsequent
|
||||||
* call to setup or setup_bytes, otherwise operations may segfault.
|
* call to setup or setup_bytes, otherwise operations may segfault.
|
||||||
*/
|
*/
|
||||||
cache() : table(), size(), collection_flags(0), epoch_flags(),
|
cache() : table(), collection_flags(0), epoch_flags(), hash_function()
|
||||||
epoch_heuristic_counter(), epoch_size(), depth_limit(0), hash_function()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,13 +71,13 @@ private:
|
||||||
DataStream ssKey{};
|
DataStream ssKey{};
|
||||||
CDataStream ssValue;
|
CDataStream ssValue;
|
||||||
|
|
||||||
size_t size_estimate;
|
size_t size_estimate{0};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @param[in] _parent CDBWrapper that this batch is to be submitted to
|
* @param[in] _parent CDBWrapper that this batch is to be submitted to
|
||||||
*/
|
*/
|
||||||
explicit CDBBatch(const CDBWrapper& _parent) : parent(_parent), ssValue(SER_DISK, CLIENT_VERSION), size_estimate(0){};
|
explicit CDBBatch(const CDBWrapper& _parent) : parent(_parent), ssValue(SER_DISK, CLIENT_VERSION){};
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,10 +42,10 @@ public:
|
||||||
private:
|
private:
|
||||||
//! Whether this private key is valid. We check for correctness when modifying the key
|
//! Whether this private key is valid. We check for correctness when modifying the key
|
||||||
//! data, so fValid should always correspond to the actual state.
|
//! data, so fValid should always correspond to the actual state.
|
||||||
bool fValid;
|
bool fValid{false};
|
||||||
|
|
||||||
//! Whether the public key corresponding to this private key is (to be) compressed.
|
//! Whether the public key corresponding to this private key is (to be) compressed.
|
||||||
bool fCompressed;
|
bool fCompressed{false};
|
||||||
|
|
||||||
//! The actual byte data
|
//! The actual byte data
|
||||||
std::vector<unsigned char, secure_allocator<unsigned char> > keydata;
|
std::vector<unsigned char, secure_allocator<unsigned char> > keydata;
|
||||||
|
@ -55,7 +55,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Construct an invalid private key.
|
//! Construct an invalid private key.
|
||||||
CKey() : fValid(false), fCompressed(false)
|
CKey()
|
||||||
{
|
{
|
||||||
// Important: vch must be 32 bytes in length to not break serialization
|
// Important: vch must be 32 bytes in length to not break serialization
|
||||||
keydata.resize(32);
|
keydata.resize(32);
|
||||||
|
|
|
@ -528,7 +528,7 @@ bool CBlockPolicyEstimator::_removeTx(const uint256& hash, bool inBlock)
|
||||||
}
|
}
|
||||||
|
|
||||||
CBlockPolicyEstimator::CBlockPolicyEstimator(const fs::path& estimation_filepath)
|
CBlockPolicyEstimator::CBlockPolicyEstimator(const fs::path& estimation_filepath)
|
||||||
: m_estimation_filepath{estimation_filepath}, nBestSeenHeight{0}, firstRecordedHeight{0}, historicalFirst{0}, historicalBest{0}, trackedTxs{0}, untrackedTxs{0}
|
: m_estimation_filepath{estimation_filepath}
|
||||||
{
|
{
|
||||||
static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero");
|
static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero");
|
||||||
size_t bucketIndex = 0;
|
size_t bucketIndex = 0;
|
||||||
|
|
|
@ -242,16 +242,16 @@ public:
|
||||||
private:
|
private:
|
||||||
mutable Mutex m_cs_fee_estimator;
|
mutable Mutex m_cs_fee_estimator;
|
||||||
|
|
||||||
unsigned int nBestSeenHeight GUARDED_BY(m_cs_fee_estimator);
|
unsigned int nBestSeenHeight GUARDED_BY(m_cs_fee_estimator){0};
|
||||||
unsigned int firstRecordedHeight GUARDED_BY(m_cs_fee_estimator);
|
unsigned int firstRecordedHeight GUARDED_BY(m_cs_fee_estimator){0};
|
||||||
unsigned int historicalFirst GUARDED_BY(m_cs_fee_estimator);
|
unsigned int historicalFirst GUARDED_BY(m_cs_fee_estimator){0};
|
||||||
unsigned int historicalBest GUARDED_BY(m_cs_fee_estimator);
|
unsigned int historicalBest GUARDED_BY(m_cs_fee_estimator){0};
|
||||||
|
|
||||||
struct TxStatsInfo
|
struct TxStatsInfo
|
||||||
{
|
{
|
||||||
unsigned int blockHeight;
|
unsigned int blockHeight{0};
|
||||||
unsigned int bucketIndex;
|
unsigned int bucketIndex{0};
|
||||||
TxStatsInfo() : blockHeight(0), bucketIndex(0) {}
|
TxStatsInfo() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// map of txids to information about that transaction
|
// map of txids to information about that transaction
|
||||||
|
@ -262,8 +262,8 @@ private:
|
||||||
std::unique_ptr<TxConfirmStats> shortStats PT_GUARDED_BY(m_cs_fee_estimator);
|
std::unique_ptr<TxConfirmStats> shortStats PT_GUARDED_BY(m_cs_fee_estimator);
|
||||||
std::unique_ptr<TxConfirmStats> longStats PT_GUARDED_BY(m_cs_fee_estimator);
|
std::unique_ptr<TxConfirmStats> longStats PT_GUARDED_BY(m_cs_fee_estimator);
|
||||||
|
|
||||||
unsigned int trackedTxs GUARDED_BY(m_cs_fee_estimator);
|
unsigned int trackedTxs GUARDED_BY(m_cs_fee_estimator){0};
|
||||||
unsigned int untrackedTxs GUARDED_BY(m_cs_fee_estimator);
|
unsigned int untrackedTxs GUARDED_BY(m_cs_fee_estimator){0};
|
||||||
|
|
||||||
std::vector<double> buckets GUARDED_BY(m_cs_fee_estimator); // The upper-bound of the range for the bucket (inclusive)
|
std::vector<double> buckets GUARDED_BY(m_cs_fee_estimator); // The upper-bound of the range for the bucket (inclusive)
|
||||||
std::map<double, unsigned int> bucketMap GUARDED_BY(m_cs_fee_estimator); // Map of bucket upper-bound to index into all vectors by bucket
|
std::map<double, unsigned int> bucketMap GUARDED_BY(m_cs_fee_estimator); // Map of bucket upper-bound to index into all vectors by bucket
|
||||||
|
|
|
@ -1005,11 +1005,11 @@ struct CSerActionUnserialize
|
||||||
class CSizeComputer
|
class CSizeComputer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
size_t nSize;
|
size_t nSize{0};
|
||||||
|
|
||||||
const int nVersion;
|
const int nVersion;
|
||||||
public:
|
public:
|
||||||
explicit CSizeComputer(int nVersionIn) : nSize(0), nVersion(nVersionIn) {}
|
explicit CSizeComputer(int nVersionIn) : nVersion(nVersionIn) {}
|
||||||
|
|
||||||
void write(Span<const std::byte> src)
|
void write(Span<const std::byte> src)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,7 +96,7 @@ template<typename C>
|
||||||
class Span
|
class Span
|
||||||
{
|
{
|
||||||
C* m_data;
|
C* m_data;
|
||||||
std::size_t m_size;
|
std::size_t m_size{0};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct is_Span_int : public std::false_type {};
|
struct is_Span_int : public std::false_type {};
|
||||||
|
@ -107,7 +107,7 @@ class Span
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr Span() noexcept : m_data(nullptr), m_size(0) {}
|
constexpr Span() noexcept : m_data(nullptr) {}
|
||||||
|
|
||||||
/** Construct a span from a begin pointer and a size.
|
/** Construct a span from a begin pointer and a size.
|
||||||
*
|
*
|
||||||
|
|
|
@ -628,8 +628,8 @@ private:
|
||||||
const int nVersion;
|
const int nVersion;
|
||||||
|
|
||||||
FILE *src; //!< source file
|
FILE *src; //!< source file
|
||||||
uint64_t nSrcPos; //!< how many bytes have been read from source
|
uint64_t nSrcPos{0}; //!< how many bytes have been read from source
|
||||||
uint64_t m_read_pos; //!< how many bytes have been read from this
|
uint64_t m_read_pos{0}; //!< how many bytes have been read from this
|
||||||
uint64_t nReadLimit; //!< up to which position we're allowed to read
|
uint64_t nReadLimit; //!< up to which position we're allowed to read
|
||||||
uint64_t nRewind; //!< how many bytes we guarantee to rewind
|
uint64_t nRewind; //!< how many bytes we guarantee to rewind
|
||||||
std::vector<std::byte> vchBuf; //!< the buffer
|
std::vector<std::byte> vchBuf; //!< the buffer
|
||||||
|
@ -675,7 +675,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CBufferedFile(FILE* fileIn, uint64_t nBufSize, uint64_t nRewindIn, int nTypeIn, int nVersionIn)
|
CBufferedFile(FILE* fileIn, uint64_t nBufSize, uint64_t nRewindIn, int nTypeIn, int nVersionIn)
|
||||||
: nType(nTypeIn), nVersion(nVersionIn), nSrcPos(0), m_read_pos(0), nReadLimit(std::numeric_limits<uint64_t>::max()), nRewind(nRewindIn), vchBuf(nBufSize, std::byte{0})
|
: nType(nTypeIn), nVersion(nVersionIn), nReadLimit(std::numeric_limits<uint64_t>::max()), nRewind(nRewindIn), vchBuf(nBufSize, std::byte{0})
|
||||||
{
|
{
|
||||||
if (nRewindIn >= nBufSize)
|
if (nRewindIn >= nBufSize)
|
||||||
throw std::ios_base::failure("Rewind limit must be less than buffer size");
|
throw std::ios_base::failure("Rewind limit must be less than buffer size");
|
||||||
|
|
|
@ -280,8 +280,8 @@ size_t PosixLockedPageAllocator::GetLimit()
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
// Implementation: LockedPool
|
// Implementation: LockedPool
|
||||||
|
|
||||||
LockedPool::LockedPool(std::unique_ptr<LockedPageAllocator> allocator_in, LockingFailed_Callback lf_cb_in):
|
LockedPool::LockedPool(std::unique_ptr<LockedPageAllocator> allocator_in, LockingFailed_Callback lf_cb_in)
|
||||||
allocator(std::move(allocator_in)), lf_cb(lf_cb_in), cumulative_bytes_locked(0)
|
: allocator(std::move(allocator_in)), lf_cb(lf_cb_in)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ private:
|
||||||
|
|
||||||
std::list<LockedPageArena> arenas;
|
std::list<LockedPageArena> arenas;
|
||||||
LockingFailed_Callback lf_cb;
|
LockingFailed_Callback lf_cb;
|
||||||
size_t cumulative_bytes_locked;
|
size_t cumulative_bytes_locked{0};
|
||||||
/** Mutex protects access to this pool's data structures, including arenas.
|
/** Mutex protects access to this pool's data structures, including arenas.
|
||||||
*/
|
*/
|
||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
|
|
|
@ -103,7 +103,7 @@ constexpr auto ALL_NETWORKS = std::array{
|
||||||
class StaticContentsSock : public Sock
|
class StaticContentsSock : public Sock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit StaticContentsSock(const std::string& contents) : m_contents{contents}, m_consumed{0}
|
explicit StaticContentsSock(const std::string& contents) : m_contents{contents}
|
||||||
{
|
{
|
||||||
// Just a dummy number that is not INVALID_SOCKET.
|
// Just a dummy number that is not INVALID_SOCKET.
|
||||||
m_socket = INVALID_SOCKET - 1;
|
m_socket = INVALID_SOCKET - 1;
|
||||||
|
@ -191,7 +191,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string m_contents;
|
const std::string m_contents;
|
||||||
mutable size_t m_consumed;
|
mutable size_t m_consumed{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(int n_candidates, FastRandomContext& random_context);
|
std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(int n_candidates, FastRandomContext& random_context);
|
||||||
|
|
|
@ -508,9 +508,6 @@ class FormatArg
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FormatArg()
|
FormatArg()
|
||||||
: m_value(nullptr),
|
|
||||||
m_formatImpl(nullptr),
|
|
||||||
m_toIntImpl(nullptr)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -549,10 +546,10 @@ class FormatArg
|
||||||
return convertToInt<T>::invoke(*static_cast<const T*>(value));
|
return convertToInt<T>::invoke(*static_cast<const T*>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
const void* m_value;
|
const void* m_value{nullptr};
|
||||||
void (*m_formatImpl)(std::ostream& out, const char* fmtBegin,
|
void (*m_formatImpl)(std::ostream& out, const char* fmtBegin,
|
||||||
const char* fmtEnd, int ntrunc, const void* value);
|
const char* fmtEnd, int ntrunc, const void* value){nullptr};
|
||||||
int (*m_toIntImpl)(const void* value);
|
int (*m_toIntImpl)(const void* value){nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ static const uint16_t DEFAULT_TOR_SOCKS_PORT = 9050;
|
||||||
|
|
||||||
/****** Low-level TorControlConnection ********/
|
/****** Low-level TorControlConnection ********/
|
||||||
|
|
||||||
TorControlConnection::TorControlConnection(struct event_base *_base):
|
TorControlConnection::TorControlConnection(struct event_base* _base)
|
||||||
base(_base), b_conn(nullptr)
|
: base(_base)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ private:
|
||||||
/** Libevent event base */
|
/** Libevent event base */
|
||||||
struct event_base *base;
|
struct event_base *base;
|
||||||
/** Connection to control socket */
|
/** Connection to control socket */
|
||||||
struct bufferevent *b_conn;
|
struct bufferevent* b_conn{nullptr};
|
||||||
/** Message being received */
|
/** Message being received */
|
||||||
TorControlReply message;
|
TorControlReply message;
|
||||||
/** Response handlers */
|
/** Response handlers */
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
class JSONUTF8StringFilter
|
class JSONUTF8StringFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit JSONUTF8StringFilter(std::string &s):
|
explicit JSONUTF8StringFilter(std::string& s)
|
||||||
str(s), is_valid(true), codepoint(0), state(0), surpair(0)
|
: str(s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// Write single 8-bit char (may be part of UTF-8 sequence)
|
// Write single 8-bit char (may be part of UTF-8 sequence)
|
||||||
|
@ -79,10 +79,10 @@ public:
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
std::string &str;
|
std::string &str;
|
||||||
bool is_valid;
|
bool is_valid{true};
|
||||||
// Current UTF-8 decoding state
|
// Current UTF-8 decoding state
|
||||||
unsigned int codepoint;
|
unsigned int codepoint{0};
|
||||||
int state; // Top bit to be filled in for next UTF-8 byte, or 0
|
int state{0}; // Top bit to be filled in for next UTF-8 byte, or 0
|
||||||
|
|
||||||
// Keep track of the following state to handle the following section of
|
// Keep track of the following state to handle the following section of
|
||||||
// RFC4627:
|
// RFC4627:
|
||||||
|
@ -94,7 +94,7 @@ private:
|
||||||
// "\uD834\uDD1E".
|
// "\uD834\uDD1E".
|
||||||
//
|
//
|
||||||
// Two subsequent \u.... may have to be replaced with one actual codepoint.
|
// Two subsequent \u.... may have to be replaced with one actual codepoint.
|
||||||
unsigned int surpair; // First half of open UTF-16 surrogate pair, or 0
|
unsigned int surpair{0}; // First half of open UTF-16 surrogate pair, or 0
|
||||||
|
|
||||||
void append_codepoint(unsigned int codepoint_)
|
void append_codepoint(unsigned int codepoint_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,9 +181,9 @@ public:
|
||||||
* Auxiliary requested/occurred events to wait for in `WaitMany()`.
|
* Auxiliary requested/occurred events to wait for in `WaitMany()`.
|
||||||
*/
|
*/
|
||||||
struct Events {
|
struct Events {
|
||||||
explicit Events(Event req) : requested{req}, occurred{0} {}
|
explicit Events(Event req) : requested{req} {}
|
||||||
Event requested;
|
Event requested;
|
||||||
Event occurred;
|
Event occurred{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HashSharedPtrSock {
|
struct HashSharedPtrSock {
|
||||||
|
|
|
@ -308,7 +308,7 @@ BerkeleyDatabase::~BerkeleyDatabase()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BerkeleyBatch::BerkeleyBatch(BerkeleyDatabase& database, const bool read_only, bool fFlushOnCloseIn) : pdb(nullptr), activeTxn(nullptr), m_database(database)
|
BerkeleyBatch::BerkeleyBatch(BerkeleyDatabase& database, const bool read_only, bool fFlushOnCloseIn) : m_database(database)
|
||||||
{
|
{
|
||||||
database.AddRef();
|
database.AddRef();
|
||||||
database.Open();
|
database.Open();
|
||||||
|
|
|
@ -207,9 +207,9 @@ private:
|
||||||
bool HasKey(DataStream&& key) override;
|
bool HasKey(DataStream&& key) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Db* pdb;
|
Db* pdb{nullptr};
|
||||||
std::string strFile;
|
std::string strFile;
|
||||||
DbTxn* activeTxn;
|
DbTxn* activeTxn{nullptr};
|
||||||
bool fReadOnly;
|
bool fReadOnly;
|
||||||
bool fFlushOnClose;
|
bool fFlushOnClose;
|
||||||
BerkeleyEnvironment *env;
|
BerkeleyEnvironment *env;
|
||||||
|
|
|
@ -123,7 +123,7 @@ class WalletDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create dummy DB handle */
|
/** Create dummy DB handle */
|
||||||
WalletDatabase() : nUpdateCounter(0), nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0) {}
|
WalletDatabase() : nUpdateCounter(0) {}
|
||||||
virtual ~WalletDatabase() {};
|
virtual ~WalletDatabase() {};
|
||||||
|
|
||||||
/** Open the database if it is not already opened. */
|
/** Open the database if it is not already opened. */
|
||||||
|
@ -165,9 +165,9 @@ public:
|
||||||
virtual std::string Format() = 0;
|
virtual std::string Format() = 0;
|
||||||
|
|
||||||
std::atomic<unsigned int> nUpdateCounter;
|
std::atomic<unsigned int> nUpdateCounter;
|
||||||
unsigned int nLastSeen;
|
unsigned int nLastSeen{0};
|
||||||
unsigned int nLastFlushed;
|
unsigned int nLastFlushed{0};
|
||||||
int64_t nLastWalletUpdate;
|
int64_t nLastWalletUpdate{0};
|
||||||
|
|
||||||
/** Make a DatabaseBatch connected to this database */
|
/** Make a DatabaseBatch connected to this database */
|
||||||
virtual std::unique_ptr<DatabaseBatch> MakeBatch(bool flush_on_close = true) = 0;
|
virtual std::unique_ptr<DatabaseBatch> MakeBatch(bool flush_on_close = true) = 0;
|
||||||
|
|
|
@ -954,10 +954,10 @@ private:
|
||||||
using Clock = std::chrono::steady_clock;
|
using Clock = std::chrono::steady_clock;
|
||||||
using NowFn = std::function<Clock::time_point()>;
|
using NowFn = std::function<Clock::time_point()>;
|
||||||
CWallet& m_wallet;
|
CWallet& m_wallet;
|
||||||
bool m_could_reserve;
|
bool m_could_reserve{false};
|
||||||
NowFn m_now;
|
NowFn m_now;
|
||||||
public:
|
public:
|
||||||
explicit WalletRescanReserver(CWallet& w) : m_wallet(w), m_could_reserve(false) {}
|
explicit WalletRescanReserver(CWallet& w) : m_wallet(w) {}
|
||||||
|
|
||||||
bool reserve()
|
bool reserve()
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ class CZMQAbstractNotifier
|
||||||
public:
|
public:
|
||||||
static const int DEFAULT_ZMQ_SNDHWM {1000};
|
static const int DEFAULT_ZMQ_SNDHWM {1000};
|
||||||
|
|
||||||
CZMQAbstractNotifier() : psocket(nullptr), outbound_message_high_water_mark(DEFAULT_ZMQ_SNDHWM) { }
|
CZMQAbstractNotifier() : outbound_message_high_water_mark(DEFAULT_ZMQ_SNDHWM) {}
|
||||||
virtual ~CZMQAbstractNotifier();
|
virtual ~CZMQAbstractNotifier();
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
virtual bool NotifyTransaction(const CTransaction &transaction);
|
virtual bool NotifyTransaction(const CTransaction &transaction);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void *psocket;
|
void* psocket{nullptr};
|
||||||
std::string type;
|
std::string type;
|
||||||
std::string address;
|
std::string address;
|
||||||
int outbound_message_high_water_mark; // aka SNDHWM
|
int outbound_message_high_water_mark; // aka SNDHWM
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(nullptr)
|
CZMQNotificationInterface::CZMQNotificationInterface()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
CZMQNotificationInterface();
|
CZMQNotificationInterface();
|
||||||
|
|
||||||
void *pcontext;
|
void* pcontext{nullptr};
|
||||||
std::list<std::unique_ptr<CZMQAbstractNotifier>> notifiers;
|
std::list<std::unique_ptr<CZMQAbstractNotifier>> notifiers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue