Simplify logic in MB_Needed_for_Boot_Record() et al
The first two clauses say is the partition object type unallocated inside an extended partition, or a logical partition (which only occur inside an extended partition). As these are the only two partition object types which can occur inside an extended partition, this is equivalent to saying is the partition object inside an extended partition. Simplify.
This commit is contained in:
parent
eaaa5719f7
commit
67b07f86e6
|
@ -499,19 +499,15 @@ void Dialog_Base_Partition::Set_MinMax_Text( Sector min, Sector max )
|
|||
label_minmax .set_text( str_temp ) ;
|
||||
}
|
||||
|
||||
|
||||
int Dialog_Base_Partition::MB_Needed_for_Boot_Record( const Partition & partition )
|
||||
{
|
||||
//Determine if space is needed for the Master Boot Record or
|
||||
// the Extended Boot Record. Generally an an additional track or MEBIBYTE
|
||||
// is required so for our purposes reserve a MEBIBYTE in front of the partition.
|
||||
// NOTE: This logic also contained in Win_GParted::set_valid_operations
|
||||
if ( ( partition .inside_extended
|
||||
&& partition .type == TYPE_UNALLOCATED
|
||||
)
|
||||
|| ( partition .type == TYPE_LOGICAL )
|
||||
/* Beginning of disk device */
|
||||
|| (partition.sector_start < (MEBIBYTE / partition.sector_size))
|
||||
)
|
||||
// Determine if space needs reserving for the partition table or the EBR (Extended
|
||||
// Boot Record). Generally a track or MEBIBYTE is reserved. For our purposes
|
||||
// reserve a MEBIBYTE at the start of the partition.
|
||||
// NOTE: This logic also contained in Win_GParted::set_valid_operations()
|
||||
if (partition.inside_extended ||
|
||||
partition.sector_start < MEBIBYTE / partition.sector_size )
|
||||
return 1 ;
|
||||
else
|
||||
return 0 ;
|
||||
|
|
|
@ -1354,17 +1354,12 @@ void Win_GParted::set_valid_operations()
|
|||
else
|
||||
required_size = copied_filesystem_ptn.get_byte_length();
|
||||
|
||||
//Determine if space is needed for the Master Boot Record or
|
||||
// the Extended Boot Record. Generally an an additional track or MEBIBYTE
|
||||
// is required so for our purposes reserve a MEBIBYTE in front of the partition.
|
||||
// NOTE: This logic also contained in Dialog_Base_Partition::MB_Needed_for_Boot_Record
|
||||
if ( ( selected_partition_ptr->inside_extended
|
||||
&& selected_partition_ptr->type == TYPE_UNALLOCATED
|
||||
)
|
||||
|| ( selected_partition_ptr->type == TYPE_LOGICAL )
|
||||
/* Beginning of disk device */
|
||||
|| (selected_partition_ptr->sector_start < (MEBIBYTE / selected_partition_ptr->sector_size))
|
||||
)
|
||||
// Determine if space needs reserving for the partition table or the EBR (Extended
|
||||
// Boot Record). Generally a track or MEBIBYTE is reserved. For our purposes
|
||||
// reserve a MEBIBYTE at the start of the partition.
|
||||
// NOTE: This logic also contained in Dialog_Base_Partition::MB_Needed_for_Boot_Record()
|
||||
if (selected_partition_ptr->inside_extended ||
|
||||
selected_partition_ptr->sector_start < MEBIBYTE / selected_partition_ptr->sector_size )
|
||||
required_size += MEBIBYTE;
|
||||
|
||||
//Determine if space is needed for the Extended Boot Record for a logical partition
|
||||
|
|
Loading…
Reference in New Issue