Split input and output streams

This commit is contained in:
topjohnwu
2023-05-19 04:19:43 -07:00
parent 582cad1b8d
commit 57bd450798
6 changed files with 104 additions and 124 deletions

View File

@@ -19,14 +19,14 @@ uint64_t dyn_img_hdr::j64 = 0;
#define PADDING 15
static void decompress(format_t type, int fd, const void *in, size_t size) {
auto ptr = get_decoder(type, make_unique<fd_stream>(fd));
auto ptr = get_decoder(type, make_unique<fd_channel>(fd));
ptr->write(in, size, true);
}
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_stream>(fd));
auto strm = get_encoder(type, make_unique<fd_channel>(fd));
strm->write(in, size, true);
}
auto now = lseek(fd, 0, SEEK_CUR);