From ce13d826575cdef731a69adbebe7804612b36331 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 17 Nov 2022 06:09:10 +0100 Subject: [PATCH] input/async: use std::byte instead of uint8_t --- src/input/AsyncInputStream.cxx | 4 ++-- src/input/AsyncInputStream.hxx | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/input/AsyncInputStream.cxx b/src/input/AsyncInputStream.cxx index 0f0b5412a..8aefac0eb 100644 --- a/src/input/AsyncInputStream.cxx +++ b/src/input/AsyncInputStream.cxx @@ -181,7 +181,7 @@ AsyncInputStream::Read(std::unique_lock &lock, CondInputStreamHandler cond_handler; /* wait for data */ - CircularBuffer::Range r; + CircularBuffer::Range r; while (true) { Check(); @@ -232,7 +232,7 @@ AsyncInputStream::AppendToBuffer(const void *data, size_t append_size) noexcept assert(!w.empty()); assert(w.size() >= remaining); - memcpy(w.data(), (const uint8_t *)data + nbytes, remaining); + memcpy(w.data(), (const std::byte *)data + nbytes, remaining); buffer.Append(remaining); } diff --git a/src/input/AsyncInputStream.hxx b/src/input/AsyncInputStream.hxx index 95730bb0a..a7160af8a 100644 --- a/src/input/AsyncInputStream.hxx +++ b/src/input/AsyncInputStream.hxx @@ -25,6 +25,7 @@ #include "util/HugeAllocator.hxx" #include "util/CircularBuffer.hxx" +#include #include /** @@ -41,9 +42,9 @@ class AsyncInputStream : public InputStream { InjectEvent deferred_resume; InjectEvent deferred_seek; - HugeArray allocation; + HugeArray allocation; - CircularBuffer buffer; + CircularBuffer buffer; const size_t resume_at; bool open = true; @@ -128,7 +129,7 @@ protected: return buffer.GetSpace(); } - CircularBuffer::Range PrepareWriteBuffer() noexcept { + auto PrepareWriteBuffer() noexcept { return buffer.Write(); }