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 9694259d844082bbcf3ebe0acbeb18aa655a3da1..3b863f4654d66d1146c6070e42cd79810ddc1c1b 100644 (file)
@@ -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);
 
index c53515d62e723b1ad4d12a1697248227d0d9be0b..9cbcdb2e054119025cabd22ae0cace0e299bd639 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 e71668d78095a1fcdd8beb30e2470c22775a21d3..f61ecd5ac209c457fbb6d59b1324b62557d15fca 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 152361b01432c01bf5f7fe5865182540bf7e6a5b..0a2a04f46f3b94e20136e5ad3a4729b7992d908a 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 7302193034865cd5acca1a7b716deed0cfa4c2d5..42f8ecd91e8b753b34a651948c678c741c518cb1 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 &&