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:
parent
014fb13d0b
commit
3dbaa30dba
|
@ -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>
|
2004-10-11 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
* src/Device.cc (Read_Disk_Layout): some internal codechanges. Looks a bit cleaner now.
|
* src/Device.cc (Read_Disk_Layout): some internal codechanges. Looks a bit cleaner now.
|
||||||
|
|
|
@ -144,9 +144,10 @@ void Device::Read_Disk_Layout( bool deep_scan )
|
||||||
partition_temp .Reset( ) ;
|
partition_temp .Reset( ) ;
|
||||||
part_path = this ->path + num_to_str( c_partition ->num ) ;
|
part_path = this ->path + num_to_str( c_partition ->num ) ;
|
||||||
|
|
||||||
//PRIMARY or LOGICAL
|
switch ( c_partition ->type )
|
||||||
if ( c_partition ->type == 0 || c_partition ->type == 1 )
|
|
||||||
{
|
{
|
||||||
|
case PED_PARTITION_NORMAL:
|
||||||
|
case PED_PARTITION_LOGICAL:
|
||||||
if ( c_partition ->fs_type )
|
if ( c_partition ->fs_type )
|
||||||
temp = c_partition ->fs_type ->name ;
|
temp = c_partition ->fs_type ->name ;
|
||||||
else
|
else
|
||||||
|
@ -174,11 +175,10 @@ void Device::Read_Disk_Layout( bool deep_scan )
|
||||||
|
|
||||||
partition_temp .flags = Get_Flags( c_partition ) ;
|
partition_temp .flags = Get_Flags( c_partition ) ;
|
||||||
partition_temp .error = this ->error ;//most likely useless, but paranoia me leaves it here.. =)
|
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 ,
|
partition_temp.Set( part_path ,
|
||||||
c_partition ->num ,
|
c_partition ->num ,
|
||||||
GParted::EXTENDED ,
|
GParted::EXTENDED ,
|
||||||
|
@ -189,12 +189,16 @@ void Device::Read_Disk_Layout( bool deep_scan )
|
||||||
ped_partition_is_busy( c_partition ) );
|
ped_partition_is_busy( c_partition ) );
|
||||||
|
|
||||||
partition_temp .flags = Get_Flags( 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 );
|
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..
|
if ( partition_temp .sector_start != -1 ) //paranoia check for unallocted space < 1 MB..
|
||||||
|
|
Loading…
Reference in New Issue