Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/crypto/ripemd160.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void Transform(uint32_t* s, const unsigned char* chunk)

////// RIPEMD160

CRIPEMD160::CRIPEMD160() : bytes(0)
CRIPEMD160::CRIPEMD160()
{
ripemd160::Initialize(s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/ripemd160.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CRIPEMD160
private:
uint32_t s[5];
unsigned char buf[64];
uint64_t bytes;
uint64_t bytes{0};

public:
static const size_t OUTPUT_SIZE = 20;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void Transform(uint32_t* s, const unsigned char* chunk)

////// SHA1

CSHA1::CSHA1() : bytes(0)
CSHA1::CSHA1()
{
sha1::Initialize(s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha1.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CSHA1
private:
uint32_t s[5];
unsigned char buf[64];
uint64_t bytes;
uint64_t bytes{0};

public:
static const size_t OUTPUT_SIZE = 20;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem

////// SHA-256

CSHA256::CSHA256() : bytes(0)
CSHA256::CSHA256()
{
sha256::Initialize(s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CSHA256
private:
uint32_t s[8];
unsigned char buf[64];
uint64_t bytes;
uint64_t bytes{0};

public:
static const size_t OUTPUT_SIZE = 32;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha512.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void Transform(uint64_t* s, const unsigned char* chunk)

////// SHA-512

CSHA512::CSHA512() : bytes(0)
CSHA512::CSHA512()
{
sha512::Initialize(s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha512.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CSHA512
private:
uint64_t s[8];
unsigned char buf[128];
uint64_t bytes;
uint64_t bytes{0};

public:
static constexpr size_t OUTPUT_SIZE = 64;
Expand Down
11 changes: 5 additions & 6 deletions src/cuckoocache.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class cache
std::vector<Element> 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
* garbage collection to be allowed to occur from const methods */
Expand All @@ -181,7 +181,7 @@ class cache
* decremented on insert and reset to the new number of inserts which would
* 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. When the number of non-erased elements in an epoch
Expand All @@ -191,12 +191,12 @@ class cache
* one "dead" which has been erased, one "dying" which has been marked to be
* 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.
* 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
* static or initialized at call time as it may have internal state (such as
Expand Down Expand Up @@ -320,8 +320,7 @@ class cache
/** You must always construct a cache with some elements via a subsequent
* call to setup or setup_bytes, otherwise operations may segfault.
*/
cache() : table(), size(), collection_flags(0), epoch_flags(),
epoch_heuristic_counter(), epoch_size(), depth_limit(0), hash_function()
cache() : table(), collection_flags(0), epoch_flags(), hash_function()
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/dbwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ class CDBBatch
CDataStream ssKey;
CDataStream ssValue;

size_t size_estimate;
size_t size_estimate{0};

public:
/**
* @param[in] _parent CDBWrapper that this batch is to be submitted to
*/
explicit CDBBatch(const CDBWrapper &_parent) : parent(_parent), ssKey(SER_DISK, CLIENT_VERSION), ssValue(SER_DISK, CLIENT_VERSION), size_estimate(0) { };
explicit CDBBatch(const CDBWrapper &_parent) : parent(_parent), ssKey(SER_DISK, CLIENT_VERSION), ssValue(SER_DISK, CLIENT_VERSION) { };

void Clear()
{
Expand Down
6 changes: 3 additions & 3 deletions src/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class CKey
private:
//! Whether this private key is valid. We check for correctness when modifying the key
//! 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.
bool fCompressed;
bool fCompressed{false};

//! The actual byte data
std::vector<unsigned char, secure_allocator<unsigned char> > keydata;
Expand All @@ -61,7 +61,7 @@ class CKey

public:
//! Construct an invalid private key.
CKey() : fValid(false), fCompressed(false)
CKey()
{
// Important: vch must be 32 bytes in length to not break serialization
keydata.resize(32);
Expand Down
1 change: 0 additions & 1 deletion src/policy/fees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,6 @@ bool CBlockPolicyEstimator::_removeTx(const uint256& hash, bool inBlock)
}

CBlockPolicyEstimator::CBlockPolicyEstimator()
: nBestSeenHeight(0), firstRecordedHeight(0), historicalFirst(0), historicalBest(0), trackedTxs(0), untrackedTxs(0)
{
static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero");
size_t bucketIndex = 0;
Expand Down
18 changes: 9 additions & 9 deletions src/policy/fees.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,16 @@ class CBlockPolicyEstimator
private:
mutable Mutex m_cs_fee_estimator;

unsigned int nBestSeenHeight GUARDED_BY(m_cs_fee_estimator);
unsigned int firstRecordedHeight GUARDED_BY(m_cs_fee_estimator);
unsigned int historicalFirst GUARDED_BY(m_cs_fee_estimator);
unsigned int historicalBest 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){0};
unsigned int historicalFirst GUARDED_BY(m_cs_fee_estimator){0};
unsigned int historicalBest GUARDED_BY(m_cs_fee_estimator){0};

struct TxStatsInfo
{
unsigned int blockHeight;
unsigned int bucketIndex;
TxStatsInfo() : blockHeight(0), bucketIndex(0) {}
unsigned int blockHeight{0};
unsigned int bucketIndex{0};
TxStatsInfo() {}
};

// map of txids to information about that transaction
Expand All @@ -260,8 +260,8 @@ class CBlockPolicyEstimator
std::unique_ptr<TxConfirmStats> shortStats 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 untrackedTxs 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){0};

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
Expand Down
4 changes: 2 additions & 2 deletions src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -1347,11 +1347,11 @@ struct CSerActionUnserialize
class CSizeComputer
{
protected:
size_t nSize;
size_t nSize{0};

const int nVersion;
public:
explicit CSizeComputer(int nVersionIn) : nSize(0), nVersion(nVersionIn) {}
explicit CSizeComputer(int nVersionIn) : nVersion(nVersionIn) {}

void write(Span<const std::byte> src)
{
Expand Down
4 changes: 2 additions & 2 deletions src/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ template<typename C>
class Span
{
C* m_data;
std::size_t m_size;
std::size_t m_size{0};

template <class T>
struct is_Span_int : public std::false_type {};
Expand All @@ -107,7 +107,7 @@ class Span


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.
*
Expand Down
6 changes: 3 additions & 3 deletions src/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,8 @@ class CBufferedFile
const int nVersion;

FILE *src; //!< source file
uint64_t nSrcPos; //!< how many bytes have been read from source
uint64_t m_read_pos; //!< how many bytes have been read from this
uint64_t nSrcPos{0}; //!< how many bytes have been read from source
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 nRewind; //!< how many bytes we guarantee to rewind
std::vector<std::byte> vchBuf; //!< the buffer
Expand Down Expand Up @@ -656,7 +656,7 @@ class CBufferedFile

public:
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)
throw std::ios_base::failure("Rewind limit must be less than buffer size");
Expand Down
4 changes: 2 additions & 2 deletions src/support/lockedpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ size_t PosixLockedPageAllocator::GetLimit()
/*******************************************************************************/
// Implementation: LockedPool

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)
LockedPool::LockedPool(std::unique_ptr<LockedPageAllocator> allocator_in, LockingFailed_Callback lf_cb_in)
: allocator(std::move(allocator_in)), lf_cb(lf_cb_in)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/support/lockedpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class LockedPool

std::list<LockedPageArena> arenas;
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.
*/
mutable std::mutex mutex;
Expand Down
4 changes: 2 additions & 2 deletions src/test/util/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ constexpr auto ALL_NETWORKS = std::array{
class StaticContentsSock : public Sock
{
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.
m_socket = INVALID_SOCKET - 1;
Expand Down Expand Up @@ -224,7 +224,7 @@ class StaticContentsSock : public Sock

private:
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);
Expand Down
9 changes: 3 additions & 6 deletions src/tinyformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,6 @@ class FormatArg
{
public:
FormatArg()
: m_value(nullptr),
m_formatImpl(nullptr),
m_toIntImpl(nullptr)
{ }

template<typename T>
Expand Down Expand Up @@ -549,10 +546,10 @@ class FormatArg
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,
const char* fmtEnd, int ntrunc, const void* value);
int (*m_toIntImpl)(const void* value);
const char* fmtEnd, int ntrunc, const void* value){nullptr};
int (*m_toIntImpl)(const void* value){nullptr};
};


Expand Down
4 changes: 2 additions & 2 deletions src/torcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ static const uint16_t DEFAULT_TOR_SOCKS_PORT = 9050;

/****** Low-level TorControlConnection ********/

TorControlConnection::TorControlConnection(struct event_base *_base):
base(_base), b_conn(nullptr)
TorControlConnection::TorControlConnection(struct event_base* _base)
: base(_base)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/torcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class TorControlConnection
/** Libevent event base */
struct event_base *base;
/** Connection to control socket */
struct bufferevent *b_conn;
struct bufferevent* b_conn{nullptr};
/** Message being received */
TorControlReply message;
/** Response handlers */
Expand Down
12 changes: 6 additions & 6 deletions src/univalue/include/univalue_utffilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
class JSONUTF8StringFilter
{
public:
explicit JSONUTF8StringFilter(std::string &s):
str(s), is_valid(true), codepoint(0), state(0), surpair(0)
explicit JSONUTF8StringFilter(std::string& s)
: str(s)
{
}
// Write single 8-bit char (may be part of UTF-8 sequence)
Expand Down Expand Up @@ -79,10 +79,10 @@ class JSONUTF8StringFilter
}
private:
std::string &str;
bool is_valid;
bool is_valid{true};
// Current UTF-8 decoding state
unsigned int codepoint;
int state; // Top bit to be filled in for next UTF-8 byte, or 0
unsigned int codepoint{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
// RFC4627:
Expand All @@ -94,7 +94,7 @@ class JSONUTF8StringFilter
// "\uD834\uDD1E".
//
// 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_)
{
Expand Down
4 changes: 2 additions & 2 deletions src/util/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ class Sock
* Auxiliary requested/occurred events to wait for in `WaitMany()`.
*/
struct Events {
explicit Events(Event req, Event ocr = 0) : requested{req}, occurred{ocr} {}
explicit Events(Event req, Event ocr = 0) : requested{req} {}
Event requested;
Event occurred;
Event occurred{0};
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/bdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ BerkeleyDatabase::~BerkeleyDatabase()
}
}

BerkeleyBatch::BerkeleyBatch(BerkeleyDatabase& database, const bool read_only, bool fFlushOnCloseIn) : pdb(nullptr), activeTxn(nullptr), m_cursor(nullptr), m_database(database)
BerkeleyBatch::BerkeleyBatch(BerkeleyDatabase& database, const bool read_only, bool fFlushOnCloseIn) : m_cursor(nullptr), m_database(database)
{
database.AddRef();
database.Open();
Expand Down
4 changes: 2 additions & 2 deletions src/wallet/bdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ class BerkeleyBatch : public DatabaseBatch
bool HasKey(CDataStream&& key) override;

protected:
Db* pdb;
Db* pdb{nullptr};
std::string strFile;
DbTxn* activeTxn;
DbTxn* activeTxn{nullptr};
Dbc* m_cursor;
bool fReadOnly;
bool fFlushOnClose;
Expand Down
Loading
Loading