]> wimlib.net Git - wimlib/blobdiff - src/extract.c
extract.c: Don't compile unneeded code when WITH_NTFS_3G undefined
[wimlib] / src / extract.c
index a6b8d9ef057e450227cc76a2822e779be74c56e8..65e60dead1291bff6796b26cc4efd7f811313776 100644 (file)
@@ -67,9 +67,8 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#define WIMLIB_EXTRACT_FLAG_MULTI_IMAGE 0x80000000
-#define WIMLIB_EXTRACT_FLAG_FROM_PIPE   0x40000000
-#define WIMLIB_EXTRACT_FLAG_IMAGEMODE   0x20000000
+#define WIMLIB_EXTRACT_FLAG_FROM_PIPE   0x80000000
+#define WIMLIB_EXTRACT_FLAG_IMAGEMODE   0x40000000
 
 /* Keep in sync with wimlib.h  */
 #define WIMLIB_EXTRACT_MASK_PUBLIC                             \
@@ -114,7 +113,6 @@ dentry_is_supported(struct wim_dentry *dentry,
 
 
 #define PWM_ALLOW_WIM_HDR 0x00001
-#define PWM_SILENT_EOF   0x00002
 
 /* Read the header from a stream in a pipable WIM.  */
 static int
@@ -133,7 +131,9 @@ read_pwm_stream_header(WIMStruct *pwm, struct wim_lookup_table_entry *lte,
        if (ret)
                goto read_error;
 
-       if ((flags & PWM_ALLOW_WIM_HDR) && buf.stream_hdr.magic == PWM_MAGIC) {
+       if ((flags & PWM_ALLOW_WIM_HDR) &&
+           le64_to_cpu(buf.stream_hdr.magic) == PWM_MAGIC)
+       {
                BUILD_BUG_ON(sizeof(buf.pwm_hdr) < sizeof(buf.stream_hdr));
                ret = full_read(&pwm->in_fd, &buf.stream_hdr + 1,
                                sizeof(buf.pwm_hdr) - sizeof(buf.stream_hdr));
@@ -164,8 +164,7 @@ read_pwm_stream_header(WIMStruct *pwm, struct wim_lookup_table_entry *lte,
        return 0;
 
 read_error:
-       if (ret != WIMLIB_ERR_UNEXPECTED_END_OF_FILE || !(flags & PWM_SILENT_EOF))
-               ERROR_WITH_ERRNO("Error reading pipable WIM from pipe");
+       ERROR_WITH_ERRNO("Error reading pipable WIM from pipe");
        return ret;
 }
 
@@ -442,7 +441,7 @@ remove_contained_trees(struct wim_dentry **trees, size_t num_trees)
        for (i = 0; i < num_trees; i++) {
                struct wim_dentry *d = trees[i];
                while (!dentry_is_root(d)) {
-                       d = d->parent;
+                       d = d->d_parent;
                        if (d->tmp_flag)
                                goto tree_contained;
                }
@@ -509,7 +508,7 @@ build_dentry_list(struct list_head *dentry_list, struct wim_dentry **trees,
                        place_after = dentry_list;
                        ancestor = dentry;
                        do {
-                               ancestor = ancestor->parent;
+                               ancestor = ancestor->d_parent;
                                if (will_extract_dentry(ancestor)) {
                                        place_after = &ancestor->d_extraction_list_node;
                                        break;
@@ -518,7 +517,7 @@ build_dentry_list(struct list_head *dentry_list, struct wim_dentry **trees,
 
                        ancestor = dentry;
                        do {
-                               ancestor = ancestor->parent;
+                               ancestor = ancestor->d_parent;
                                if (will_extract_dentry(ancestor))
                                        break;
                                list_add(&ancestor->d_extraction_list_node, place_after);
@@ -613,12 +612,14 @@ dentry_calculate_extraction_name(struct wim_dentry *dentry,
        if (dentry_is_root(dentry))
                return 0;
 
+#ifdef WITH_NTFS_3G
        if (ctx->extract_flags & WIMLIB_EXTRACT_FLAG_NTFS) {
                dentry->d_extraction_name = dentry->file_name;
                dentry->d_extraction_name_nchars = dentry->file_name_nbytes /
                                                   sizeof(utf16lechar);
                return 0;
        }
+#endif
 
        if (!ctx->supported_features.case_sensitive_filenames) {
                struct wim_dentry *other;
@@ -1570,8 +1571,6 @@ extract_all_images(WIMStruct *wim, const tchar *target, int extract_flags)
        int image;
        const tchar *image_name;
 
-       extract_flags |= WIMLIB_EXTRACT_FLAG_MULTI_IMAGE;
-
        if (extract_flags & WIMLIB_EXTRACT_FLAG_NTFS) {
                ERROR("Cannot extract multiple images in NTFS extraction mode.");
                return WIMLIB_ERR_INVALID_PARAM;