From 8155d4786d8b6e12a866e2a3333b7892dff6200b Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Tue, 4 May 2010 15:18:43 -0600 Subject: [PATCH] Fix used and unused sector math when pasting a copied partition This change is in preparation for supporting sectors sizes > 512 bytes. --- src/Dialog_Partition_Copy.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc index 34cf2746..be217335 100644 --- a/src/Dialog_Partition_Copy.cc +++ b/src/Dialog_Partition_Copy.cc @@ -143,6 +143,11 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons this ->selected_partition .inside_extended = selected_partition .inside_extended ; this ->selected_partition .type = selected_partition .inside_extended ? GParted::TYPE_LOGICAL : GParted::TYPE_PRIMARY ; + //Handle situation where src sector size is smaller than dst sector size and an additional partial dst sector is required. + this ->selected_partition .set_used( + ( (copied_partition .sectors_used * copied_partition .sector_size) + + (selected_partition .sector_size - 1) + ) / selected_partition .sector_size ) ; this ->show_all_children() ; }