Again =) Decided to use switch ( blahblah ) instead of if else statements.

* src/Device.cc (Read_Disk_Layout): Again =) Decided to use switch ( blahblah ) instead of if else statements.
This commit is contained in:
Bart Hakvoort 2004-10-11 12:55:33 +00:00
parent 014fb13d0b
commit 3dbaa30dba
2 changed files with 55 additions and 47 deletions

View File

@ -1,3 +1,7 @@
2004-10-11 Bart Hakvoort <gparted@users.sf.net>
* src/Device.cc (Read_Disk_Layout): Again =) Decided to use switch ( blahblah ) instead of if else statements.
2004-10-11 Bart Hakvoort <gparted@users.sf.net>
* src/Device.cc (Read_Disk_Layout): some internal codechanges. Looks a bit cleaner now.

View File

@ -144,9 +144,10 @@ void Device::Read_Disk_Layout( bool deep_scan )
partition_temp .Reset( ) ;
part_path = this ->path + num_to_str( c_partition ->num ) ;
//PRIMARY or LOGICAL
if ( c_partition ->type == 0 || c_partition ->type == 1 )
switch ( c_partition ->type )
{
case PED_PARTITION_NORMAL:
case PED_PARTITION_LOGICAL:
if ( c_partition ->fs_type )
temp = c_partition ->fs_type ->name ;
else
@ -174,11 +175,10 @@ void Device::Read_Disk_Layout( bool deep_scan )
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;//most likely useless, but paranoia me leaves it here.. =)
}
break ;
//EXTENDED
else if ( c_partition ->type == 2 )
{
case PED_PARTITION_EXTENDED:
partition_temp.Set( part_path ,
c_partition ->num ,
GParted::EXTENDED ,
@ -189,12 +189,16 @@ void Device::Read_Disk_Layout( bool deep_scan )
ped_partition_is_busy( c_partition ) );
partition_temp .flags = Get_Flags( c_partition ) ;
}
break ;
//FREESPACE
else if ( (c_partition ->type == 4 || c_partition ->type == 5) && (c_partition ->geom .end - c_partition ->geom .start) > MEGABYTE )
{
case PED_PARTITION_FREESPACE:
partition_temp.Set_Unallocated( c_partition ->geom .start, c_partition ->geom .end, c_partition ->type == 4 ? false : true );
break ;
case PED_PARTITION_METADATA:
break;
}
if ( partition_temp .sector_start != -1 ) //paranoia check for unallocted space < 1 MB..