Add extract_full_stream_to_fd()
authorEric Biggers <ebiggers3@gmail.com>
Sun, 29 Dec 2013 00:04:28 +0000 (18:04 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 29 Dec 2013 00:04:28 +0000 (18:04 -0600)
include/wimlib/resource.h
src/extract.c
src/resource.c
src/unix_apply.c
src/write.c

index 9694259..3b863f4 100644 (file)
@@ -281,6 +281,10 @@ 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);
 
 /* Miscellaneous stream functions.  */
index c53515d..9cbcdb2 100644 (file)
@@ -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;
index e71668d..f61ecd5 100644 (file)
@@ -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)
index 152361b..0a2a04f 100644 (file)
@@ -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;
index 7302193..42f8ecd 100644 (file)
@@ -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 &&