mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-03 12:25:54 +02:00
streams: cache file position within AutoFile
Github-Pull: bitcoin/bitcoin#30884
Rebased-From: e624a9bef1
This commit is contained in:
@@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file)
|
||||
for (uint8_t j = 0; j < 40; ++j) {
|
||||
file << j;
|
||||
}
|
||||
std::rewind(file.Get());
|
||||
file.seek(0, SEEK_SET);
|
||||
|
||||
// The buffer size (second arg) must be greater than the rewind
|
||||
// amount (third arg).
|
||||
@@ -391,7 +391,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_skip)
|
||||
for (uint8_t j = 0; j < 40; ++j) {
|
||||
file << j;
|
||||
}
|
||||
std::rewind(file.Get());
|
||||
file.seek(0, SEEK_SET);
|
||||
|
||||
// The buffer is 25 bytes, allow rewinding 10 bytes.
|
||||
BufferedFile bf{file, 25, 10};
|
||||
@@ -444,7 +444,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
|
||||
for (uint8_t i = 0; i < fileSize; ++i) {
|
||||
file << i;
|
||||
}
|
||||
std::rewind(file.Get());
|
||||
file.seek(0, SEEK_SET);
|
||||
|
||||
size_t bufSize = InsecureRandRange(300) + 1;
|
||||
size_t rewindSize = InsecureRandRange(bufSize);
|
||||
|
||||
Reference in New Issue
Block a user