Fixed incorrectly recognized partition move/resize operations

svn path=/trunk/; revision=858
This commit is contained in:
Curtis Gedak 2008-06-18 18:30:19 +00:00
parent af8a021e89
commit 468980306a
2 changed files with 26 additions and 10 deletions

View File

@ -1,10 +1,16 @@
2008-06-18 Curtis Gedak <gedakc@gmail.com>
* src/OperationResizeMove.cc: Fixed incorrectly recognized move/resizes
- Re-wrote logic to determine proper partition move / resize operation
- Closes GParted bug #438570
2008-06-15 Curtis Gedak <gedakc@gmail.com>
* src/GParted_Core.cc: Enhanced snap-to-cylinder math
- Improved math for rounding starting sector to cylinder
boundaries for logical partitions, and the first primary
partition for MBR and GPT partition tables.
- Closes GParted bug #432525
- Closes GParted bugs #432525, and #525137
* include/Dialog_Base_Partition.h,
src/Dialog_Base_Partition.cc,

View File

@ -57,17 +57,27 @@ void OperationResizeMove::create_description()
} ;
Action action = NONE ;
if ( partition_new .get_length() > partition_original .get_length() )
if ( partition_new .get_length() > partition_original .get_length() ) {
//Grow partition
action = GROW ;
else if ( partition_new .get_length() < partition_original .get_length() )
if ( partition_new .sector_start > partition_original .sector_start )
action = MOVE_RIGHT_GROW ;
if ( partition_new .sector_start < partition_original .sector_start )
action = MOVE_LEFT_GROW ;
} else if ( partition_new .get_length() < partition_original .get_length() ) {
//Shrink partition
action = SHRINK ;
if ( partition_new .sector_start > partition_original .sector_start &&
partition_new .sector_end > partition_original .sector_end )
action = action == GROW ? MOVE_RIGHT_GROW : action == SHRINK ? MOVE_RIGHT_SHRINK : MOVE_RIGHT ;
else if ( partition_new .sector_start < partition_original .sector_start &&
partition_new .sector_end < partition_original .sector_end )
action = action == GROW ? MOVE_LEFT_GROW : action == SHRINK ? MOVE_LEFT_SHRINK : MOVE_LEFT ;
if ( partition_new .sector_start > partition_original .sector_start )
action = MOVE_RIGHT_SHRINK ;
if ( partition_new .sector_start < partition_original .sector_start )
action = MOVE_LEFT_SHRINK ;
} else {
//No change in partition size
if ( partition_new .sector_start > partition_original .sector_start )
action = MOVE_RIGHT ;
if ( partition_new .sector_start < partition_original .sector_start )
action = MOVE_LEFT ;
}
switch ( action )
{