refactor: clear up blockstorage/streams in preparation for optimization
Made every OpenBlockFile#fReadOnly value explicit. Replaced hard-coded values in ReadRawBlock with STORAGE_HEADER_BYTES. Changed `STORAGE_HEADER_BYTES` and `UNDO_DATA_DISK_OVERHEAD` to `uint32_t` to avoid casts. Also added `LIFETIMEBOUND` to the `AutoFile` parameter of `BufferedFile`, which stores a reference to the underlying `AutoFile`, allowing Clang to emit warnings if the referenced `AutoFile` might be destroyed while `BufferedFile` still exists. Without this attribute, code with lifetime violations wouldn't trigger compiler warnings. Co-authored-by: maflcko <6399679+maflcko@users.noreply.github.com>
This commit is contained in:
1 parent
67fcc64802
commit
056cb3c0d2
3 files changed
+15
-16
No files matched your search
+1
-1
@@ -523,7 +523,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
BufferedFile(AutoFile& file, uint64_t nBufSize, uint64_t nRewindIn)
|
||||
BufferedFile(AutoFile& file LIFETIMEBOUND, uint64_t nBufSize, uint64_t nRewindIn)
|
||||
: m_src{file}, nReadLimit{std::numeric_limits<uint64_t>::max()}, nRewind{nRewindIn}, vchBuf(nBufSize, std::byte{0})
|
||||
{
|
||||
if (nRewindIn >= nBufSize)
|
||||
|
||||
Reference in new issue
Block a user