[gnome-autoar] AutoarCreate: report correct size for non-regular files



commit 9a1e5c3eb558b78e66f7dda2c34695db40e0d4be
Author: Razvan Chitu <razvan ch95 gmail com>
Date:   Sat Aug 13 19:10:50 2016 +0300

    AutoarCreate: report correct size for non-regular files
    
    The size reported for non-regular files was the size in the archive and not the
    size on the disk, which would lead to bad progress information. In order to fix
    this, make sure that the size on the disk is the one reported.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768645

 gnome-autoar/autoar-create.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gnome-autoar/autoar-create.c b/gnome-autoar/autoar-create.c
index b76678b..f60dba2 100644
--- a/gnome-autoar/autoar-create.c
+++ b/gnome-autoar/autoar-create.c
@@ -943,6 +943,15 @@ autoar_create_do_add_to_archive (AutoarCreate *arcreate,
       pathname_in_entry = archive_entry_pathname (entry);
       file_to_read = g_hash_table_lookup (priv->pathname_to_g_file, pathname_in_entry);
       autoar_create_do_write_data (arcreate, entry, file_to_read);
+      /* Entries for non-regular files might have their size attribute
+       * different to their actual size on the disk
+       */
+      if (archive_entry_filetype (entry) != AE_IFREG &&
+          archive_entry_size (entry) != g_file_info_get_size (info)) {
+        priv->completed_size += g_file_info_get_size (info);
+        autoar_create_signal_progress (arcreate);
+      }
+
       g_hash_table_remove (priv->pathname_to_g_file, pathname_in_entry);
       /* We have registered g_object_unref function to free the GFile object,
        * so we do not have to unref it here. */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]