Skip to content

Commit 6cf3c8f

Browse files
committed
[Trivial] Unitialized scalar fields and variables
1 parent 846ef28 commit 6cf3c8f

File tree

13 files changed

+51
-53
lines changed

13 files changed

+51
-53
lines changed

src/blockassembler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void BlockAssembler::AddToBlock(CTxMemPool::txiter iter)
305305
bool fPrintPriority = gArgs.GetBoolArg("-printpriority", defaultPrintPriority);
306306
if (fPrintPriority) {
307307
double dPriority = iter->GetPriority(nHeight);
308-
CAmount dummy;
308+
CAmount dummy{0};
309309
mempool.ApplyDeltas(iter->GetTx().GetHash(), dPriority, dummy);
310310
LogPrintf("priority %.1f fee %s txid %s\n",
311311
dPriority,
@@ -390,7 +390,7 @@ void BlockAssembler::addPriorityTxs()
390390
for (CTxMemPool::indexed_transaction_set::iterator mi = mempool.mapTx.begin();
391391
mi != mempool.mapTx.end(); ++mi) {
392392
double dPriority = mi->GetPriority(nHeight);
393-
CAmount dummy;
393+
CAmount dummy{0};
394394
mempool.ApplyDeltas(mi->GetSharedTx()->GetHash(), dPriority, dummy);
395395
vecPriority.emplace_back(TxCoinAgePriority(dPriority, mi));
396396
}

src/blockassembler.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ class BlockAssembler
3636
// The constructed block template
3737
std::unique_ptr<CBlockTemplate> pblocktemplate;
3838
// A convenience pointer that always refers to the CBlock in pblocktemplate
39-
CBlock* pblock;
39+
CBlock* pblock{nullptr};
4040

4141
// Configuration parameters for the block size
42-
unsigned int nBlockMaxSize, nBlockMinSize;
42+
unsigned int nBlockMaxSize{0}, nBlockMinSize{0};
4343

4444
// Information on the current status of the block
4545
uint64_t nBlockSize{0};
@@ -57,10 +57,10 @@ class BlockAssembler
5757
bool blockFinished{false};
5858

5959
// Keep track of block space used for shield txes
60-
unsigned int nSizeShielded = 0;
60+
unsigned int nSizeShielded{0};
6161

6262
// Whether should print priority by default or not
63-
const bool defaultPrintPriority;
63+
const bool defaultPrintPriority{false};
6464

6565
public:
6666
BlockAssembler(const CChainParams& chainparams, const bool defaultPrintPriority);

src/httpserver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ struct HTTPPathHandler
169169
prefix(prefix), exactMatch(exactMatch), handler(handler)
170170
{
171171
}
172-
std::string prefix;
173-
bool exactMatch;
174-
HTTPRequestHandler handler;
172+
std::string prefix{};
173+
bool exactMatch{false};
174+
HTTPRequestHandler handler{};
175175
};
176176

177177
/** HTTP module state */

src/libzerocoin/CoinSpend.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ class CoinSpend
148148
}
149149

150150
protected:
151-
CoinDenomination denomination = ZQ_ERROR;
152-
CBigNum coinSerialNumber;
153-
uint8_t version;
151+
CoinDenomination denomination{ZQ_ERROR};
152+
CBigNum coinSerialNumber{};
153+
uint8_t version{0};
154154
//As of version 2
155155
CPubKey pubkey;
156156
std::vector<unsigned char> vchSig;
157-
SpendType spendType;
158-
uint256 ptxHash;
157+
SpendType spendType{SPEND};
158+
uint256 ptxHash{UINT256_ZERO};
159159

160160
private:
161-
uint32_t accChecksum;
161+
uint32_t accChecksum{0};
162162
CBigNum accCommitmentToCoinValue;
163163
CBigNum serialCommitmentToCoinValue;
164164
AccumulatorProofOfKnowledge accumulatorPoK;

src/net.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -329,22 +329,22 @@ class CConnman
329329
// Network usage totals
330330
RecursiveMutex cs_totalBytesRecv;
331331
RecursiveMutex cs_totalBytesSent;
332-
uint64_t nTotalBytesRecv;
333-
uint64_t nTotalBytesSent;
332+
uint64_t nTotalBytesRecv{0};
333+
uint64_t nTotalBytesSent{0};
334334

335335
// Whitelisted ranges. Any node connecting from these is automatically
336336
// whitelisted (as well as those connecting to whitelisted binds).
337337
std::vector<CSubNet> vWhitelistedRange;
338338
RecursiveMutex cs_vWhitelistedRange;
339339

340-
unsigned int nSendBufferMaxSize;
341-
unsigned int nReceiveFloodSize;
340+
unsigned int nSendBufferMaxSize{0};
341+
unsigned int nReceiveFloodSize{0};
342342

343343
std::vector<ListenSocket> vhListenSocket;
344344
banmap_t setBanned;
345345
RecursiveMutex cs_setBanned;
346-
bool setBannedIsDirty;
347-
bool fAddressesInitialized;
346+
bool setBannedIsDirty{false};
347+
bool fAddressesInitialized{false};
348348
CAddrMan addrman;
349349
std::deque<std::string> vOneShots;
350350
RecursiveMutex cs_vOneShots;
@@ -356,23 +356,23 @@ class CConnman
356356
std::atomic<NodeId> nLastNodeId;
357357

358358
/** Services this instance offers */
359-
ServiceFlags nLocalServices;
359+
ServiceFlags nLocalServices{NODE_NONE};
360360

361361
/** Services this instance cares about */
362-
ServiceFlags nRelevantServices;
362+
ServiceFlags nRelevantServices{NODE_NONE};
363363

364-
CSemaphore *semOutbound;
365-
int nMaxConnections;
366-
int nMaxOutbound;
367-
int nMaxFeeler;
364+
CSemaphore *semOutbound{nullptr};
365+
int nMaxConnections{0};
366+
int nMaxOutbound{0};
367+
int nMaxFeeler{0};
368368
std::atomic<int> nBestHeight;
369-
CClientUIInterface* clientInterface;
369+
CClientUIInterface* clientInterface{nullptr};
370370

371371
/** SipHasher seeds for deterministic randomness */
372-
const uint64_t nSeed0, nSeed1;
372+
const uint64_t nSeed0{0}, nSeed1{0};
373373

374374
/** flag for waking the message processor. */
375-
bool fMsgProcWake;
375+
bool fMsgProcWake{false};
376376

377377
std::condition_variable condMsgProc;
378378
std::mutex mutexMsgProc;

src/netaddress.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CNetAddr
3030
{
3131
protected:
3232
unsigned char ip[16]; // in network byte order
33-
uint32_t scopeId; // for scoped/link-local ipv6 addresses
33+
uint32_t scopeId{0}; // for scoped/link-local ipv6 addresses
3434

3535
public:
3636
CNetAddr();

src/policy/fees.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class TxConfirmStats
9696
// Combine the conf counts with tx counts to calculate the confirmation % for each Y,X
9797
// Combine the total value with the tx counts to calculate the avg feerate per bucket
9898

99-
double decay;
99+
double decay{0.0};
100100

101101
// Mempool counts of outstanding transactions
102102
// For each bucket X, track the number of transactions in the mempool

src/qt/pivx/receivedialog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class ReceiveDialog : public FocusedDialog
2727
private Q_SLOTS:
2828
void onCopy();
2929
private:
30-
Ui::ReceiveDialog *ui;
31-
QPixmap *qrImage;
32-
SendCoinsRecipient *info = nullptr;
30+
Ui::ReceiveDialog *ui{nullptr};
31+
QPixmap *qrImage{nullptr};
32+
SendCoinsRecipient *info{nullptr};
3333
};
3434

3535
#endif // RECEIVEDIALOG_H

src/random.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ void GetStrongRandBytes(unsigned char* buf, int num);
4444
*/
4545
class FastRandomContext {
4646
private:
47-
bool requires_seed;
47+
bool requires_seed{false};
4848
ChaCha20 rng;
4949

5050
unsigned char bytebuf[64];
51-
int bytebuf_size;
51+
int bytebuf_size{0};
5252

53-
uint64_t bitbuf;
54-
int bitbuf_size;
53+
uint64_t bitbuf{0};
54+
int bitbuf_size{0};
5555

5656
void RandomSeed();
5757

src/rpc/blockchain.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -679,15 +679,13 @@ UniValue getsupplyinfo(const JSONRPCRequest& request)
679679

680680
struct CCoinsStats
681681
{
682-
int nHeight;
683-
uint256 hashBlock;
684-
uint64_t nTransactions;
685-
uint64_t nTransactionOutputs;
686-
uint256 hashSerialized;
687-
uint64_t nDiskSize;
688-
CAmount nTotalAmount;
689-
690-
CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nTotalAmount(0) {}
682+
int nHeight{0};
683+
uint256 hashBlock{UINT256_ZERO};
684+
uint64_t nTransactions{0};
685+
uint64_t nTransactionOutputs{0};
686+
uint256 hashSerialized{UINT256_ZERO};
687+
uint64_t nDiskSize{0};
688+
CAmount nTotalAmount{0};
691689
};
692690

693691
static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash, const std::map<uint32_t, Coin>& outputs)

0 commit comments

Comments
 (0)