util/DynamicFifoBuffer: pass std::span to Append()
This commit is contained in:
parent
53acf7ae82
commit
cd241a93c1
@ -85,7 +85,7 @@ private:
|
||||
[[maybe_unused]] unsigned current_frame,
|
||||
void *client_data) noexcept {
|
||||
auto &encoder = *(FlacEncoder *)client_data;
|
||||
encoder.output_buffer.Append((const std::byte *)data, bytes);
|
||||
encoder.output_buffer.Append({(const std::byte *)data, bytes});
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
|
||||
}
|
||||
};
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
/* virtual methods from class Encoder */
|
||||
void Write(const void *data, size_t length) override {
|
||||
buffer.Append((const std::byte *)data, length);
|
||||
buffer.Append({(const std::byte *)data, length});
|
||||
}
|
||||
|
||||
size_t Read(void *dest, size_t length) override {
|
||||
|
@ -156,7 +156,7 @@ ShineEncoder::WriteChunk(bool flush)
|
||||
shine_encode_buffer(shine, stereo, &written);
|
||||
|
||||
if (written > 0)
|
||||
output_buffer.Append(out, written);
|
||||
output_buffer.Append({out, std::size_t(written)});
|
||||
|
||||
input_pos = 0;
|
||||
}
|
||||
@ -199,7 +199,7 @@ ShineEncoder::Flush()
|
||||
const auto data = (const std::byte *)shine_flush(shine, &written);
|
||||
|
||||
if (written > 0)
|
||||
output_buffer.Append(data, written);
|
||||
output_buffer.Append({data, std::size_t(written)});
|
||||
}
|
||||
|
||||
const EncoderPlugin shine_encoder_plugin = {
|
||||
|
@ -109,9 +109,9 @@ public:
|
||||
/**
|
||||
* Append data to the buffer, growing it as needed.
|
||||
*/
|
||||
void Append(const_pointer p, size_type n) noexcept {
|
||||
std::copy_n(p, n, Write(n));
|
||||
Append(n);
|
||||
void Append(std::span<const std::byte> src) noexcept {
|
||||
std::copy(src.begin(), src.end(), Write(src.size()));
|
||||
Append(src.size());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user