Being modifying write_1g function to be able to write to a temporary buffer instead of straight to fd_out.

Split out make_magic to be able to write magic wherever we want later.
This commit is contained in:
Con Kolivas 2011-03-12 14:13:28 +11:00
parent 9444441d51
commit c75a50f723
6 changed files with 67 additions and 37 deletions

View file

@ -100,7 +100,7 @@ static i64 unzip_literal(rzip_control *control, void *ss, i64 len, int fd_out, u
if (unlikely(stream_read == -1 ))
fatal("Failed to read_stream in unzip_literal\n");
if (unlikely(write_1g(fd_out, buf, (size_t)stream_read) != (ssize_t)stream_read))
if (unlikely(write_1g(control, fd_out, buf, (size_t)stream_read) != (ssize_t)stream_read))
fatal("Failed to write literal buffer of size %lld\n", stream_read);
if (!HAS_MD5)
@ -142,7 +142,7 @@ static i64 unzip_match(rzip_control *control, void *ss, i64 len, int fd_out, int
if (unlikely(read_1g(fd_hist, off_buf, (size_t)n) != (ssize_t)n))
fatal("Failed to read %d bytes in unzip_match\n", n);
if (unlikely(write_1g(fd_out, off_buf, (size_t)n) != (ssize_t)n))
if (unlikely(write_1g(control, fd_out, off_buf, (size_t)n) != (ssize_t)n))
fatal("Failed to write %d bytes in unzip_match\n", n);
if (!HAS_MD5)