input/async: use std::byte instead of uint8_t

This commit is contained in:
Max Kellermann 2022-11-17 06:09:10 +01:00
parent 73dc8ff6bd
commit ce13d82657
2 changed files with 6 additions and 5 deletions

View File

@ -181,7 +181,7 @@ AsyncInputStream::Read(std::unique_lock<Mutex> &lock,
CondInputStreamHandler cond_handler;
/* wait for data */
CircularBuffer<uint8_t>::Range r;
CircularBuffer<std::byte>::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);
}

View File

@ -25,6 +25,7 @@
#include "util/HugeAllocator.hxx"
#include "util/CircularBuffer.hxx"
#include <cstddef>
#include <exception>
/**
@ -41,9 +42,9 @@ class AsyncInputStream : public InputStream {
InjectEvent deferred_resume;
InjectEvent deferred_seek;
HugeArray<uint8_t> allocation;
HugeArray<std::byte> allocation;
CircularBuffer<uint8_t> buffer;
CircularBuffer<std::byte> buffer;
const size_t resume_at;
bool open = true;
@ -128,7 +129,7 @@ protected:
return buffer.GetSpace();
}
CircularBuffer<uint8_t>::Range PrepareWriteBuffer() noexcept {
auto PrepareWriteBuffer() noexcept {
return buffer.Write();
}