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.
This commit is contained in:
parent
c17df56af0
commit
b77a5e229d
|
@ -171,7 +171,16 @@ Partition Dialog_Base_Partition::Get_New_Partition( Byte_Value sector_size )
|
||||||
switch ( optionmenu_alignment .get_history() )
|
switch ( optionmenu_alignment .get_history() )
|
||||||
{
|
{
|
||||||
case 0 : selected_partition .alignment = ALIGN_CYLINDER; break;
|
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;
|
case 2 : selected_partition .alignment = ALIGN_STRICT; break;
|
||||||
|
|
||||||
default : selected_partition .alignment = ALIGN_MEBIBYTE ;
|
default : selected_partition .alignment = ALIGN_MEBIBYTE ;
|
||||||
|
|
Loading…
Reference in New Issue