Fix move partition right to left shrinks partition 1 MiB (#695078)

When moving a MiB aligned primary partition from right to left, the
resulting partition was unexpectedly 1 MiB smaller in size.

From further testing, this occurred only if the move boundaries
overlapped the original partition boundaries.

In cases where the move did not overlap the original partition
boundaries, then the size remained the same.

Closes Bug #695078 - Move of MiB aligned partition right to left
                     yields unexpected shrink of 1 MiB
This commit is contained in:
Curtis Gedak 2013-03-03 13:04:02 -07:00 committed by Mike Fleetwood
parent ff1612cce5
commit 34da790ef3
1 changed files with 6 additions and 0 deletions

View File

@ -550,6 +550,12 @@ bool GParted_Core::snap_to_mebibyte( const Device & device, Partition & partitio
if ( ( device .partitions[ t ] .type == TYPE_PRIMARY if ( ( device .partitions[ t ] .type == TYPE_PRIMARY
|| device .partitions[ t ] .type == TYPE_EXTENDED || device .partitions[ t ] .type == TYPE_EXTENDED
) )
&& ( //For a change to an existing partition, (e.g., move or resize)
// skip comparing to original partition and
// only compare to other existing partitions
partition .status == STAT_REAL
&& partition .partition_number != device. partitions[ t ] .partition_number
)
&& ( device .partitions[ t ] .sector_start > partition .sector_start ) && ( device .partitions[ t ] .sector_start > partition .sector_start )
&& ( device .partitions[ t ] .sector_start <= partition .sector_end ) && ( device .partitions[ t ] .sector_start <= partition .sector_end )
) )