Fix partitions moved or copied using MiB alignment are 1 MiB larger

Correct problem introduced in version 0.6.3 whereby move or copy
operations using MiB alignment resulted in the destination
partition being 1 MiB larger.

Closes bug #632478
This commit is contained in:
Curtis Gedak 2010-10-18 17:08:23 -06:00
parent b0e36132b0
commit d330f9a518
1 changed files with 2 additions and 1 deletions

View File

@ -173,9 +173,10 @@ Partition Dialog_Base_Partition::Get_New_Partition( Byte_Value sector_size )
case 0 : selected_partition .alignment = ALIGN_CYLINDER; break;
case 1 : selected_partition .alignment = ALIGN_MEBIBYTE;
{
//if free space available, grow partition so sector_end on mebibyte boundary
//if start sector not MiB aligned and free space available then add ~1 MiB to partition so requested size is kept
Sector diff = ( MEBIBYTE / selected_partition .sector_size ) - ( selected_partition .sector_end + 1 ) % ( MEBIBYTE / selected_partition .sector_size ) ;
if ( diff
&& ( selected_partition .sector_start % (MEBIBYTE / selected_partition .sector_size ) ) > 0
&& ( ( selected_partition .sector_end - START +1 + diff ) < total_length )
)
selected_partition .sector_end += diff ;