streams: cache file position within AutoFile

This commit is contained in:
Pieter Wuille
2024-09-12 10:40:19 -04:00
parent 07c7c96022
commit e624a9bef1
8 changed files with 48 additions and 35 deletions

View File

@@ -390,9 +390,10 @@ class AutoFile
protected:
std::FILE* m_file;
std::vector<std::byte> m_xor;
std::optional<int64_t> m_position;
public:
explicit AutoFile(std::FILE* file, std::vector<std::byte> data_xor={}) : m_file{file}, m_xor{std::move(data_xor)} {}
explicit AutoFile(std::FILE* file, std::vector<std::byte> data_xor={});
~AutoFile() { fclose(); }