[gparted] Fix used and unused sector math when pasting a copied partition



commit 8155d4786d8b6e12a866e2a3333b7892dff6200b
Author: Curtis Gedak <gedakc gmail com>
Date:   Tue May 4 15:18:43 2010 -0600

    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 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc
index 34cf274..be21733 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() ;
 }



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