mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 13:43:45 +03:00
AK: Calculate the chunk index correctly in DuplexMemoryStream.
This commit is contained in:
parent
dbd2fa8b8f
commit
049f709d0b
Notes:
sideshowbarker
2024-07-19 02:46:34 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/049f709d0b8 Pull-request: https://github.com/SerenityOS/serenity/pull/3455
@ -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…
Reference in New Issue
Block a user