]> wimlib.net Git - wimlib/blobdiff - src/extract.c
Various fixes and cleanups
[wimlib] / src / extract.c
index 8e809608a864f218d726f27572d544a879079596..55508169a742179abfc964620f495e212ca23d6d 100644 (file)
@@ -415,7 +415,6 @@ static void calculate_bytes_to_extract(struct list_head *stream_list,
                                       union wimlib_progress_info *progress)
 {
        struct lookup_table_entry *lte;
-       struct inode *inode;
        u64 total_bytes = 0;
        u64 num_streams = 0;
 
@@ -549,7 +548,10 @@ static int apply_stream_list(struct list_head *stream_list,
                                ret = ops->apply_dentry(dentry, args);
                                if (ret != 0)
                                        goto out;
-                               if (args->progress.extract.completed_bytes >= next_progress) {
+                               if (progress_func &&
+                                   args->progress.extract.completed_bytes >= next_progress &&
+                                   args->progress.extract.total_bytes != 0)
+                               {
                                        progress_func(WIMLIB_PROGRESS_MSG_EXTRACT_STREAMS,
                                                      &args->progress);
                                        next_progress += bytes_per_progress;
@@ -581,9 +583,12 @@ static int extract_single_image(WIMStruct *w, int image,
        args.progress_func        = progress_func;
 
        if (progress_func) {
-               args.progress.extract.image      = image;
+               args.progress.extract.wimfile_name = w->filename;
+               args.progress.extract.image = image;
+               args.progress.extract.extract_flags = (extract_flags &
+                                                      WIMLIB_EXTRACT_MASK_PUBLIC);
                args.progress.extract.image_name = wimlib_get_image_name(w, image);
-               args.progress.extract.target     = target;
+               args.progress.extract.target = target;
        }
 
 #ifdef WITH_NTFS_3G
@@ -715,7 +720,7 @@ WIMLIBAPI int wimlib_extract_image(WIMStruct *w, int image,
        struct lookup_table *joined_tab, *w_tab_save;
        int ret;
 
-       if (!w || !target)
+       if (!target)
                return WIMLIB_ERR_INVALID_PARAM;
 
        extract_flags &= WIMLIB_EXTRACT_MASK_PUBLIC;