encoder/Interface: pass std::span to Write() and Read()

This commit is contained in:
Max Kellermann
2022-07-11 22:14:48 +02:00
parent 28e044a36a
commit 7e14f8f830
18 changed files with 118 additions and 115 deletions

View File

@@ -37,7 +37,6 @@
int main(int argc, char **argv)
try {
const char *encoder_name;
static char buffer[32768];
/* parse command line */
@@ -79,9 +78,10 @@ try {
/* do it */
static std::byte buffer[32768];
ssize_t nbytes;
while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
encoder->Write(buffer, nbytes);
encoder->Write(std::span{buffer}.first(nbytes));
EncoderToOutputStream(os, *encoder);
}