Fixed copy and paste partition too small problem

svn path=/trunk/; revision=953
This commit is contained in:
Curtis Gedak 2008-11-05 17:55:38 +00:00
parent 0f5a759948
commit 17292ad83b
2 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2008-11-05 Curtis Gedak <gedakc@gmail.com>
* src/Dialog_Partition_Copy.cc: Fixed copy and paste partition problem.
- Adjust for situation when an MSDOS partition table is in
use and a primary partition is copied and pasted into
an unallocated space in an extended partition.
- Closes GParted bug #556058
2008-11-04 Curtis Gedak <gedakc@gmail.com> 2008-11-04 Curtis Gedak <gedakc@gmail.com>
* src/Dialog_Progress.cc, * src/Dialog_Progress.cc,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart /* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -43,8 +43,24 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ; TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ; MB_PER_PIXEL = TOTAL_MB / 500.00 ;
long COPIED_LENGTH_MB = Utils::round( Utils::sector_to_unit( copied_partition .get_length(), GParted::UNIT_MIB ) ) ; long COPIED_LENGTH_MB = Utils::round( Utils::sector_to_unit( copied_partition .get_length(), GParted::UNIT_MIB ) ) ;
//Adjust for situation when an MSDOS partition table is in
// use and a primary partition is copied and pasted into
// an unallocated space in an extended partition.
// Since the Extended Boot Record requires an additional track,
// we need to add this to the destination (selected) partition.
// Because GUI selection of partition size is in MB and we round
// to the cylinder size, we will increase the partition by an
// additional 8 MB. 8 MB is typical cylinder size with
// todays larger disks.
// 8 MB = (255 heads) * (63 sectors) * (512 bytes)
//FIXME: Should confirm MSDOS partition table type, and use cylinder size from device
if ( copied_partition .type == TYPE_PRIMARY
&& selected_partition .type == TYPE_UNALLOCATED
&& selected_partition .inside_extended
)
COPIED_LENGTH_MB += 8 ;
//now calculate proportional length of partition //now calculate proportional length of partition
frame_resizer_base ->set_x_start( 0 ) ; frame_resizer_base ->set_x_start( 0 ) ;
int x_end = Utils::round( COPIED_LENGTH_MB / ( TOTAL_MB/500.00 ) ) ; //> 500 px only possible with xfs... int x_end = Utils::round( COPIED_LENGTH_MB / ( TOTAL_MB/500.00 ) ) ; //> 500 px only possible with xfs...