io/Reader: use std::span
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
#include "Reader.hxx"
|
||||
#include "DecoderAPI.hxx"
|
||||
|
||||
size_t
|
||||
DecoderReader::Read(void *data, size_t size)
|
||||
std::size_t
|
||||
DecoderReader::Read(std::span<std::byte> dest)
|
||||
{
|
||||
return decoder_read(client, is, data, size);
|
||||
return decoder_read(client, is, dest.data(), dest.size());
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ public:
|
||||
}
|
||||
|
||||
/* virtual methods from class Reader */
|
||||
size_t Read(void *data, size_t size) override;
|
||||
std::size_t Read(std::span<std::byte> dest) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -60,7 +60,7 @@ static constexpr unsigned rom_size = 8192;
|
||||
static void loadRom(const Path rom_path, uint8_t *dump)
|
||||
{
|
||||
FileReader romDump(rom_path);
|
||||
if (romDump.Read(dump, rom_size) != rom_size)
|
||||
if (romDump.Read(std::as_writable_bytes(std::span{dump, rom_size})) != rom_size)
|
||||
throw FmtRuntimeError("Could not load rom dump '{}'", rom_path);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user