mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 10:12:28 +02:00
refactor: Use uint64_t over size_t for serialized-size values
The values are small enough to fit in size_t, but to avoid having to think about it, just use uint64_t consistently for all architectures. On 64-bit systems, this refactor is a no-op. On 32-bit systems, it could avoid bugs in the theoretical and unexpected case where a 32-bit size_t is too small and overflows.
This commit is contained in:
@@ -202,9 +202,9 @@ size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter&
|
||||
{
|
||||
assert(filter.GetFilterType() == GetFilterType());
|
||||
|
||||
size_t data_size =
|
||||
uint64_t data_size{
|
||||
GetSerializeSize(filter.GetBlockHash()) +
|
||||
GetSerializeSize(filter.GetEncodedFilter());
|
||||
GetSerializeSize(filter.GetEncodedFilter())};
|
||||
|
||||
// If writing the filter would overflow the file, flush and move to the next one.
|
||||
if (pos.nPos + data_size > MAX_FLTR_FILE_SIZE) {
|
||||
|
||||
Reference in New Issue
Block a user