From 468980306a037c6f033135ce8e80440f0ea7938e Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Wed, 18 Jun 2008 18:30:19 +0000 Subject: [PATCH] Fixed incorrectly recognized partition move/resize operations svn path=/trunk/; revision=858 --- ChangeLog | 8 +++++++- src/OperationResizeMove.cc | 28 +++++++++++++++++++--------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e4edc4f..0995123a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,16 @@ +2008-06-18 Curtis Gedak + + * 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 * 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, diff --git a/src/OperationResizeMove.cc b/src/OperationResizeMove.cc index 90c5a898..dbe0857a 100644 --- a/src/OperationResizeMove.cc +++ b/src/OperationResizeMove.cc @@ -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 ) {