From: Eric Biggers Date: Sun, 29 Dec 2013 00:04:28 +0000 (-0600) Subject: Add extract_full_stream_to_fd() X-Git-Tag: v1.6.0~63 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=a267f3e6b9df128bd4bdf5d39b951868dd4528ab Add extract_full_stream_to_fd() --- diff --git a/include/wimlib/resource.h b/include/wimlib/resource.h index 9694259d..3b863f46 100644 --- a/include/wimlib/resource.h +++ b/include/wimlib/resource.h @@ -280,6 +280,10 @@ extern int extract_stream_to_fd(struct wim_lookup_table_entry *lte, struct filedes *fd, u64 size); +extern int +extract_full_stream_to_fd(struct wim_lookup_table_entry *lte, + struct filedes *fd); + extern int extract_chunk_to_fd(const void *chunk, size_t size, void *_fd_p); diff --git a/src/extract.c b/src/extract.c index c53515d6..9cbcdb2e 100644 --- a/src/extract.c +++ b/src/extract.c @@ -1530,8 +1530,8 @@ extract_streams_from_pipe(struct apply_ctx *ctx) if (ret) goto out_free_found_lte; - ret = extract_stream_to_fd(needed_lte, &tmpfile_fd, - needed_lte->size); + ret = extract_full_stream_to_fd(needed_lte, + &tmpfile_fd); if (ret) { filedes_close(&tmpfile_fd); goto delete_tmpfile; @@ -1651,7 +1651,7 @@ extract_dentry_to_stdout(struct wim_dentry *dentry) if (lte) { struct filedes _stdout; filedes_init(&_stdout, STDOUT_FILENO); - ret = extract_stream_to_fd(lte, &_stdout, lte->size); + ret = extract_full_stream_to_fd(lte, &_stdout); } } return ret; diff --git a/src/resource.c b/src/resource.c index e71668d7..f61ecd5a 100644 --- a/src/resource.c +++ b/src/resource.c @@ -1323,6 +1323,15 @@ extract_stream_to_fd(struct wim_lookup_table_entry *lte, return extract_stream(lte, size, extract_chunk_to_fd, fd); } +/* Extract the full uncompressed contents of the specified stream to the + * specified file descriptor. */ +int +extract_full_stream_to_fd(struct wim_lookup_table_entry *lte, + struct filedes *fd) +{ + return extract_stream_to_fd(lte, fd, lte->size); +} + /* Calculate the SHA1 message digest of a stream and store it in @lte->hash. */ int sha1_stream(struct wim_lookup_table_entry *lte) diff --git a/src/unix_apply.c b/src/unix_apply.c index 152361b0..0a2a04f4 100644 --- a/src/unix_apply.c +++ b/src/unix_apply.c @@ -122,7 +122,7 @@ unix_extract_unnamed_stream(file_spec_t file, if (raw_fd < 0) return WIMLIB_ERR_OPEN; filedes_init(&fd, raw_fd); - ret = extract_stream_to_fd(lte, &fd, lte->size); + ret = extract_full_stream_to_fd(lte, &fd); if (filedes_close(&fd) && !ret) ret = WIMLIB_ERR_WRITE; return ret; diff --git a/src/write.c b/src/write.c index 73021930..42f8ecd9 100644 --- a/src/write.c +++ b/src/write.c @@ -723,7 +723,7 @@ write_stream_uncompressed(struct wim_lookup_table_entry *lte, if (filedes_seek(out_fd, begin_offset) == -1) return 0; - ret = extract_stream_to_fd(lte, out_fd, lte->size); + ret = extract_full_stream_to_fd(lte, out_fd); if (ret) { /* Error reading the uncompressed data. */ if (out_fd->offset == begin_offset &&