mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
AK: Make CircularBuffer::read_with_seekback
const
Compared to the other read and write functions, this doesn't modify the internal state of the circular buffer.
This commit is contained in:
parent
42d01b21d8
commit
4a10cf1506
Notes:
sideshowbarker
2024-07-17 03:03:15 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/4a10cf1506 Pull-request: https://github.com/SerenityOS/serenity/pull/19332 Reviewed-by: https://github.com/linusg ✅
@ -186,7 +186,7 @@ Bytes CircularBuffer::read(Bytes bytes)
|
||||
return bytes.trim(bytes.size() - remaining);
|
||||
}
|
||||
|
||||
ErrorOr<Bytes> CircularBuffer::read_with_seekback(Bytes bytes, size_t distance)
|
||||
ErrorOr<Bytes> CircularBuffer::read_with_seekback(Bytes bytes, size_t distance) const
|
||||
{
|
||||
if (distance > m_seekback_limit)
|
||||
return Error::from_string_literal("Tried a seekback read beyond the seekback limit");
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
|
||||
/// Compared to `read()`, this starts reading from an offset that is `distance` bytes
|
||||
/// before the current write pointer and allows for reading already-read data.
|
||||
ErrorOr<Bytes> read_with_seekback(Bytes bytes, size_t distance);
|
||||
ErrorOr<Bytes> read_with_seekback(Bytes bytes, size_t distance) const;
|
||||
|
||||
ErrorOr<size_t> copy_from_seekback(size_t distance, size_t length);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user