util/AllocatedArray: migrate from {Const,Writable}Buffer to std::span

This commit is contained in:
Max Kellermann
2022-05-11 16:19:44 +02:00
committed by Max Kellermann
parent 23dd613ff9
commit 5fb97b81d1
15 changed files with 93 additions and 103 deletions

View File

@@ -51,8 +51,8 @@ mod_loadfile(const Domain *domain, DecoderClient *client, InputStream &is)
auto buffer = AllocatedArray<std::byte>(buffer_size);
std::byte *const end = buffer.end();
std::byte *p = buffer.begin();
std::byte *p = buffer.data();
std::byte *const end = p + buffer.size();
while (true) {
size_t ret = decoder_read(client, is, p, end - p);

View File

@@ -73,7 +73,7 @@ static ModPlugFile *
LoadModPlugFile(DecoderClient *client, InputStream &is)
{
const auto buffer = mod_loadfile(&modplug_domain, client, is);
if (buffer.IsNull()) {
if (buffer == nullptr) {
LogWarning(modplug_domain, "could not load stream");
return nullptr;
}

View File

@@ -73,7 +73,7 @@ mod_decode(DecoderClient &client, InputStream &is)
char audio_buffer[OPENMPT_FRAME_SIZE];
const auto buffer = mod_loadfile(&openmpt_domain, &client, is);
if (buffer.IsNull()) {
if (buffer == nullptr) {
LogWarning(openmpt_domain, "could not load stream");
return;
}
@@ -128,7 +128,7 @@ static bool
openmpt_scan_stream(InputStream &is, TagHandler &handler) noexcept
try {
const auto buffer = mod_loadfile(&openmpt_domain, nullptr, is);
if (buffer.IsNull()) {
if (buffer == nullptr) {
LogWarning(openmpt_domain, "could not load stream");
return false;
}