Cleanup filter_out_stream implementation

This commit is contained in:
topjohnwu
2023-05-20 01:28:10 -07:00
parent 655f778171
commit f5aaff2b1e
6 changed files with 13 additions and 50 deletions

View File

@@ -20,14 +20,14 @@ uint64_t dyn_img_hdr::j64 = 0;
static void decompress(format_t type, int fd, const void *in, size_t size) {
auto ptr = get_decoder(type, make_unique<fd_channel>(fd));
ptr->write(in, size, true);
ptr->write(in, size);
}
static off_t compress(format_t type, int fd, const void *in, size_t size) {
auto prev = lseek(fd, 0, SEEK_CUR);
{
auto strm = get_encoder(type, make_unique<fd_channel>(fd));
strm->write(in, size, true);
strm->write(in, size);
}
auto now = lseek(fd, 0, SEEK_CUR);
return now - prev;