Skip to content

Commit fadd730

Browse files
author
MarcoFalke
committed
refactor: Remove implicit-integer-sign-change suppressions in validation.cpp
1 parent 8c0bd87 commit fadd730

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/validation.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,7 +2183,7 @@ CoinsCacheSizeState CChainState::GetCoinsCacheSizeState(
21832183
const int64_t nMempoolUsage = m_mempool ? m_mempool->DynamicMemoryUsage() : 0;
21842184
int64_t cacheSize = CoinsTip().DynamicMemoryUsage();
21852185
int64_t nTotalSpace =
2186-
max_coins_cache_size_bytes + std::max<int64_t>(max_mempool_size_bytes - nMempoolUsage, 0);
2186+
max_coins_cache_size_bytes + std::max<int64_t>(int64_t(max_mempool_size_bytes) - nMempoolUsage, 0);
21872187

21882188
//! No need to periodic flush if at least this much space still available.
21892189
static constexpr int64_t MAX_BLOCK_COINSDB_USAGE_BYTES = 10 * 1024 * 1024; // 10MB
@@ -3621,7 +3621,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, Block
36213621
// blocks which are too close in height to the tip. Apply this test
36223622
// regardless of whether pruning is enabled; it should generally be safe to
36233623
// not process unrequested blocks.
3624-
bool fTooFarAhead = (pindex->nHeight > int(m_chain.Height() + MIN_BLOCKS_TO_KEEP));
3624+
bool fTooFarAhead{pindex->nHeight > m_chain.Height() + int(MIN_BLOCKS_TO_KEEP)};
36253625

36263626
// TODO: Decouple this function from the block download logic by removing fRequested
36273627
// This requires some new chain data structure to efficiently look up if a
@@ -3843,7 +3843,7 @@ void BlockManager::FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPr
38433843
return;
38443844
}
38453845

3846-
unsigned int nLastBlockWeCanPrune = std::min(prune_height, chain_tip_height - static_cast<int>(MIN_BLOCKS_TO_KEEP));
3846+
unsigned int nLastBlockWeCanPrune{(unsigned)std::min(prune_height, chain_tip_height - static_cast<int>(MIN_BLOCKS_TO_KEEP))};
38473847
uint64_t nCurrentUsage = CalculateCurrentUsage();
38483848
// We don't check to prune until after we've allocated new space for files
38493849
// So we should leave a buffer under our target to account for another allocation
@@ -4443,8 +4443,8 @@ void CChainState::LoadExternalBlockFile(FILE* fileIn, FlatFilePos* dbp)
44434443
try {
44444444
// locate a header
44454445
unsigned char buf[CMessageHeader::MESSAGE_START_SIZE];
4446-
blkdat.FindByte(m_params.MessageStart()[0]);
4447-
nRewind = blkdat.GetPos()+1;
4446+
blkdat.FindByte(char(m_params.MessageStart()[0]));
4447+
nRewind = blkdat.GetPos() + 1;
44484448
blkdat >> buf;
44494449
if (memcmp(buf, m_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE)) {
44504450
continue;

test/sanitizer_suppressions/ubsan

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ implicit-integer-sign-change:test/skiplist_tests.cpp
7676
implicit-integer-sign-change:test/streams_tests.cpp
7777
implicit-integer-sign-change:test/transaction_tests.cpp
7878
implicit-integer-sign-change:txmempool.cpp
79-
implicit-integer-sign-change:validation.cpp
8079
implicit-integer-sign-change:zmq/zmqpublishnotifier.cpp
8180
implicit-signed-integer-truncation,implicit-integer-sign-change:chain.h
8281
implicit-signed-integer-truncation,implicit-integer-sign-change:test/skiplist_tests.cpp

0 commit comments

Comments
 (0)