[gparted] Fix paste destination partition smaller than source (#626946)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Fix paste destination partition smaller than source (#626946)
- Date: Thu, 9 Sep 2010 19:18:33 +0000 (UTC)
commit b77a5e229dae407b40fdf6661483a3808797251d
Author: Curtis Gedak <gedakc gmail com>
Date: Thu Sep 9 13:09:55 2010 -0600
Fix paste destination partition smaller than source (#626946)
Prior to this enhancement when copying and pasting a partition
after a cylinder aligned partition, the destination partition
would become smaller than the source partition if align to MiB
was selected.
Closes bug #626946 - Destination partition smaller than source
partition.
src/Dialog_Base_Partition.cc | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc
index c5c283f..8f18c07 100644
--- a/src/Dialog_Base_Partition.cc
+++ b/src/Dialog_Base_Partition.cc
@@ -171,7 +171,16 @@ Partition Dialog_Base_Partition::Get_New_Partition( Byte_Value sector_size )
switch ( optionmenu_alignment .get_history() )
{
case 0 : selected_partition .alignment = ALIGN_CYLINDER; break;
- case 1 : selected_partition .alignment = ALIGN_MEBIBYTE; break;
+ case 1 : selected_partition .alignment = ALIGN_MEBIBYTE;
+ {
+ //if free space available, grow partition so sector_end on mebibyte boundary
+ Sector diff = ( MEBIBYTE / selected_partition .sector_size ) - ( selected_partition .sector_end + 1 ) % ( MEBIBYTE / selected_partition .sector_size ) ;
+ if ( diff
+ && ( ( selected_partition .sector_end - START +1 + diff ) < total_length )
+ )
+ selected_partition .sector_end += diff ;
+ }
+ break;
case 2 : selected_partition .alignment = ALIGN_STRICT; break;
default : selected_partition .alignment = ALIGN_MEBIBYTE ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]