mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +00:00
AK: Calculate the chunk index correctly in DuplexMemoryStream.
This commit is contained in:
parent
dbd2fa8b8f
commit
049f709d0b
1 changed files with 1 additions and 1 deletions
|
@ -232,7 +232,7 @@ public:
|
|||
{
|
||||
size_t nread = 0;
|
||||
while (bytes.size() - nread > 0 && m_write_offset - m_read_offset - nread > 0) {
|
||||
const auto chunk_index = (m_read_offset - m_base_offset) / chunk_size;
|
||||
const auto chunk_index = (m_read_offset - m_base_offset + nread) / chunk_size;
|
||||
const auto chunk_bytes = m_chunks[chunk_index].bytes().slice(m_read_offset % chunk_size).trim(m_write_offset - m_read_offset - nread);
|
||||
nread += chunk_bytes.copy_trimmed_to(bytes.slice(nread));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue