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

@@ -203,10 +203,10 @@ std::vector<bool> DecodeAsmap(fs::path path)
LogPrintf("Failed to open asmap file from disk\n");
return bits;
}
fseek(filestr, 0, SEEK_END);
int length = ftell(filestr);
file.seek(0, SEEK_END);
int length = file.tell();
LogPrintf("Opened asmap file %s (%d bytes) from disk\n", fs::quoted(fs::PathToString(path)), length);
fseek(filestr, 0, SEEK_SET);
file.seek(0, SEEK_SET);
uint8_t cur_byte;
for (int i = 0; i < length; ++i) {
file >> cur_byte;