mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
AK: Refill a BufferedStream when it has less than the requested size
We currently only fill a buffer when it is empty. So if it has 1 byte and 16 KB was requested, only that 1 byte would be returned. Instead, attempt to refill the buffer when it's size is less than the requested size.
This commit is contained in:
parent
5c38b14045
commit
13573a6c4b
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/13573a6c4b Pull-request: https://github.com/SerenityOS/serenity/pull/18093 Reviewed-by: https://github.com/LucasChollet
1 changed files with 1 additions and 1 deletions
|
@ -67,7 +67,7 @@ public:
|
|||
return buffer;
|
||||
|
||||
// Fill the internal buffer if it has run dry.
|
||||
if (m_buffer.used_space() == 0)
|
||||
if (m_buffer.used_space() < buffer.size())
|
||||
TRY(populate_read_buffer());
|
||||
|
||||
// Let's try to take all we can from the buffer first.
|
||||
|
|
Loading…
Add table
Reference in a new issue