util/CircularBuffer: use std::span internally

This commit is contained in:
Max Kellermann
2024-07-29 22:06:26 +02:00
parent 596d2d93dd
commit dbaa72cb40
6 changed files with 28 additions and 31 deletions

View File

@@ -20,7 +20,6 @@ AsyncInputStream::AsyncInputStream(EventLoop &event_loop, std::string_view _url,
deferred_resume(event_loop, BIND_THIS_METHOD(DeferredResume)),
deferred_seek(event_loop, BIND_THIS_METHOD(DeferredSeek)),
allocation(_buffer_size),
buffer(&allocation.front(), allocation.size()),
resume_at(_resume_at)
{
allocation.SetName("InputStream");

View File

@@ -23,7 +23,7 @@ class AsyncInputStream : public InputStream {
HugeArray<std::byte> allocation;
CircularBuffer<std::byte> buffer;
CircularBuffer<std::byte> buffer{allocation};
const size_t resume_at;
enum class SeekState : uint_least8_t {

View File

@@ -16,8 +16,7 @@ ThreadInputStream::ThreadInputStream(const char *_plugin,
:InputStream(_uri, _mutex),
plugin(_plugin),
thread(BIND_THIS_METHOD(ThreadFunc)),
allocation(_buffer_size),
buffer(&allocation.front(), allocation.size())
allocation(_buffer_size)
{
allocation.SetName("InputStream");
allocation.ForkCow(false);

View File

@@ -43,7 +43,7 @@ class ThreadInputStream : public InputStream {
HugeArray<std::byte> allocation;
CircularBuffer<std::byte> buffer;
CircularBuffer<std::byte> buffer{allocation};
/**
* Shall the stream be closed?