Removed a couple of unnecesarry variables. (saves a few bytes in memory =)
* include/GParted_Core.h, src/GParted_Core.cc: Removed a couple of unnecesarry variables. (saves a few bytes in memory =) )
This commit is contained in:
parent
f4f3e371ad
commit
47f357a8c4
|
@ -1,3 +1,8 @@
|
||||||
|
2004-12-13 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
|
* include/GParted_Core.h,
|
||||||
|
src/GParted_Core.cc: Removed a couple of unnecesarry variables. (saves a few bytes in memory =) )
|
||||||
|
|
||||||
2004-12-12 Bart Hakvoort <gparted@users.sf.net>
|
2004-12-12 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
* include/GParted_Core.h,
|
* include/GParted_Core.h,
|
||||||
|
|
|
@ -80,6 +80,7 @@ private:
|
||||||
PedDisk *disk ;
|
PedDisk *disk ;
|
||||||
PedPartition *c_partition ;
|
PedPartition *c_partition ;
|
||||||
Glib::ustring temp ;
|
Glib::ustring temp ;
|
||||||
|
Partition partition_temp ;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -129,8 +129,6 @@ void GParted_Core::get_devices( std::vector<Device> & devices, bool deep_scan )
|
||||||
|
|
||||||
void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
||||||
{
|
{
|
||||||
Partition partition_temp ;
|
|
||||||
Glib::ustring part_path ;
|
|
||||||
int EXT_INDEX = -1 ;
|
int EXT_INDEX = -1 ;
|
||||||
|
|
||||||
//clear partitions
|
//clear partitions
|
||||||
|
@ -140,7 +138,6 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
||||||
while ( c_partition )
|
while ( c_partition )
|
||||||
{
|
{
|
||||||
partition_temp .Reset( ) ;
|
partition_temp .Reset( ) ;
|
||||||
part_path = device .path + num_to_str( c_partition ->num ) ;
|
|
||||||
|
|
||||||
switch ( c_partition ->type )
|
switch ( c_partition ->type )
|
||||||
{
|
{
|
||||||
|
@ -160,7 +157,7 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
||||||
partition_temp .error += _( "There is no filesystem available (unformatted)" ) ;
|
partition_temp .error += _( "There is no filesystem available (unformatted)" ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
partition_temp .Set( part_path,
|
partition_temp .Set( device .path + num_to_str( c_partition ->num ),
|
||||||
c_partition ->num,
|
c_partition ->num,
|
||||||
c_partition ->type == 0 ? GParted::PRIMARY : GParted::LOGICAL ,
|
c_partition ->type == 0 ? GParted::PRIMARY : GParted::LOGICAL ,
|
||||||
temp, c_partition ->geom .start,
|
temp, c_partition ->geom .start,
|
||||||
|
@ -190,7 +187,7 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case PED_PARTITION_EXTENDED:
|
case PED_PARTITION_EXTENDED:
|
||||||
partition_temp.Set( part_path ,
|
partition_temp.Set( device .path + num_to_str( c_partition ->num ),
|
||||||
c_partition ->num ,
|
c_partition ->num ,
|
||||||
GParted::EXTENDED ,
|
GParted::EXTENDED ,
|
||||||
"extended" ,
|
"extended" ,
|
||||||
|
@ -227,16 +224,16 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
||||||
|
|
||||||
void GParted_Core::Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended )
|
void GParted_Core::Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended )
|
||||||
{
|
{
|
||||||
Partition UNALLOCATED ;
|
partition_temp .Reset( ) ;
|
||||||
UNALLOCATED .Set_Unallocated( 0, 0, inside_extended ) ;
|
partition_temp .Set_Unallocated( 0, 0, inside_extended ) ;
|
||||||
|
|
||||||
//if there are no partitions at all..
|
//if there are no partitions at all..
|
||||||
if ( partitions .empty( ) )
|
if ( partitions .empty( ) )
|
||||||
{
|
{
|
||||||
UNALLOCATED .sector_start = start ;
|
partition_temp .sector_start = start ;
|
||||||
UNALLOCATED .sector_end = end ;
|
partition_temp .sector_end = end ;
|
||||||
|
|
||||||
partitions .push_back( UNALLOCATED );
|
partitions .push_back( partition_temp );
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -244,29 +241,29 @@ void GParted_Core::Insert_Unallocated( std::vector<Partition> & partitions, Sect
|
||||||
//start <---> first partition start
|
//start <---> first partition start
|
||||||
if ( (partitions .front( ) .sector_start - start) >= MEGABYTE )
|
if ( (partitions .front( ) .sector_start - start) >= MEGABYTE )
|
||||||
{
|
{
|
||||||
UNALLOCATED .sector_start = start ;
|
partition_temp .sector_start = start ;
|
||||||
UNALLOCATED .sector_end = partitions .front( ) .sector_start -1 ;
|
partition_temp .sector_end = partitions .front( ) .sector_start -1 ;
|
||||||
|
|
||||||
partitions .insert( partitions .begin( ), UNALLOCATED );
|
partitions .insert( partitions .begin( ), partition_temp );
|
||||||
}
|
}
|
||||||
|
|
||||||
//look for gaps in between
|
//look for gaps in between
|
||||||
for ( unsigned int t =0 ; t < partitions .size( ) -1 ; t++ )
|
for ( unsigned int t =0 ; t < partitions .size( ) -1 ; t++ )
|
||||||
if ( ( partitions[ t +1 ] .sector_start - partitions[ t ] .sector_end ) >= MEGABYTE )
|
if ( ( partitions[ t +1 ] .sector_start - partitions[ t ] .sector_end ) >= MEGABYTE )
|
||||||
{
|
{
|
||||||
UNALLOCATED .sector_start = partitions[ t ] .sector_end +1 ;
|
partition_temp .sector_start = partitions[ t ] .sector_end +1 ;
|
||||||
UNALLOCATED .sector_end = partitions[ t +1 ] .sector_start -1 ;
|
partition_temp .sector_end = partitions[ t +1 ] .sector_start -1 ;
|
||||||
|
|
||||||
partitions .insert( partitions .begin( ) + ++t, UNALLOCATED );
|
partitions .insert( partitions .begin( ) + ++t, partition_temp );
|
||||||
}
|
}
|
||||||
|
|
||||||
//last partition end <---> end
|
//last partition end <---> end
|
||||||
if ( (end - partitions .back( ) .sector_end ) >= MEGABYTE )
|
if ( (end - partitions .back( ) .sector_end ) >= MEGABYTE )
|
||||||
{
|
{
|
||||||
UNALLOCATED .sector_start = partitions .back( ) .sector_end +1 ;
|
partition_temp .sector_start = partitions .back( ) .sector_end +1 ;
|
||||||
UNALLOCATED .sector_end = end ;
|
partition_temp .sector_end = end ;
|
||||||
|
|
||||||
partitions .push_back( UNALLOCATED );
|
partitions .push_back( partition_temp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue