aboutsummaryrefslogtreecommitdiff
path: root/src/streams.h
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2023-11-15 13:07:14 +1000
committerAnthony Towns <aj@erisian.com.au>2023-11-18 00:15:22 +1000
commite63f64307929ad398a23ecfaabc3664270883155 (patch)
tree82e5a0e99e6799f6375c4e5a0c135fd5e122d482 /src/streams.h
parent98b0acda0f00df3f62a61646d323c8367ddebd68 (diff)
downloadbitcoin-e63f64307929ad398a23ecfaabc3664270883155.tar.xz
streams: Base BufferedFile on AutoFile instead of CAutoFile
Diffstat (limited to 'src/streams.h')
-rw-r--r--src/streams.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/streams.h b/src/streams.h
index a3f8028da7..e7779d5bbd 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -529,7 +529,7 @@ public:
}
};
-/** Wrapper around a CAutoFile& that implements a ring buffer to
+/** Wrapper around an AutoFile& that implements a ring buffer to
* deserialize from. It guarantees the ability to rewind a given number of bytes.
*
* Will automatically close the file when it goes out of scope if not null.
@@ -538,7 +538,7 @@ public:
class BufferedFile
{
private:
- CAutoFile& m_src;
+ AutoFile& m_src;
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
@@ -585,15 +585,13 @@ private:
}
public:
- BufferedFile(CAutoFile& file, uint64_t nBufSize, uint64_t nRewindIn)
+ BufferedFile(AutoFile& file, 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)
throw std::ios_base::failure("Rewind limit must be less than buffer size");
}
- int GetVersion() const { return m_src.GetVersion(); }
-
//! check whether we're at the end of the source file
bool eof() const {
return m_read_pos == nSrcPos && m_src.feof();