declared char * buf global, so it can be initialized in copy_blocks().
* include/GParted_Core.h, src/GParted_Core.cc: declared char * buf global, so it can be initialized in copy_blocks(). This is a lot more efficient than initializing it on every copy_block()
This commit is contained in:
parent
c5853ab734
commit
59fe25882a
|
@ -1,3 +1,10 @@
|
|||
2006-09-08 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/GParted_Core.h,
|
||||
src/GParted_Core.cc: declared char * buf global, so it can be
|
||||
initialized in copy_blocks(). This is a lot more efficient than
|
||||
initializing it on every copy_block()
|
||||
|
||||
2006-09-08 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* src/GParted_Core.cc: skip resize/move of partition/filesystem if
|
||||
|
|
|
@ -171,6 +171,8 @@ private:
|
|||
PedDevice *lp_device ;
|
||||
PedDisk *lp_disk ;
|
||||
PedPartition *lp_partition ;
|
||||
|
||||
char * buf ;
|
||||
};
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -668,7 +668,7 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
|
|||
ped_geometry_read( & lp_partition ->geom, buf, 128, 1 ) ;
|
||||
ped_device_close( lp_device );
|
||||
|
||||
if ( static_cast<Glib::ustring>( buf ) == "ReIsEr4" )
|
||||
if ( Glib::ustring( buf ) == "ReIsEr4" )
|
||||
return GParted::FS_REISER4 ;
|
||||
|
||||
//no filesystem found....
|
||||
|
@ -1726,11 +1726,14 @@ bool GParted_Core::copy_blocks( const Glib::ustring & src_device,
|
|||
|
||||
if ( lp_device_src && lp_device_dst && ped_device_open( lp_device_src ) && ped_device_open( lp_device_dst ) )
|
||||
{
|
||||
succes = true ;
|
||||
ped_device_sync( lp_device_dst ) ;
|
||||
|
||||
Glib::ustring error_message ;
|
||||
|
||||
buf = static_cast<char *>( malloc( std::abs( blocksize ) * 512 ) ) ;
|
||||
if ( buf )
|
||||
{
|
||||
succes = true ;
|
||||
if ( done != 0 )
|
||||
succes = copy_block( lp_device_src,
|
||||
lp_device_dst,
|
||||
|
@ -1768,6 +1771,11 @@ bool GParted_Core::copy_blocks( const Glib::ustring & src_device,
|
|||
}
|
||||
}
|
||||
|
||||
free( buf ) ;
|
||||
}
|
||||
else
|
||||
error_message = Glib::strerror( errno ) ;
|
||||
|
||||
//reset fraction to -1 to make room for a new one (or a pulsebar)
|
||||
operationdetail .get_last_child() .get_last_child() .fraction = -1 ;
|
||||
|
||||
|
@ -1812,9 +1820,6 @@ bool GParted_Core::copy_block( PedDevice * lp_device_src,
|
|||
}
|
||||
|
||||
if ( blocksize != 0 )
|
||||
{
|
||||
char * buf = static_cast<char *>( malloc( blocksize * 512 ) ) ;//FIXME: declare buf global and initialize in copy_blocks()
|
||||
if ( buf )
|
||||
{
|
||||
if ( ped_device_read( lp_device_src, buf, offset_src, blocksize ) )
|
||||
{
|
||||
|
@ -1825,11 +1830,6 @@ bool GParted_Core::copy_block( PedDevice * lp_device_src,
|
|||
}
|
||||
else
|
||||
error_message = String::ucompose( _("Error while reading block at sector %1"), offset_src ) ;
|
||||
|
||||
free( buf ) ;
|
||||
}
|
||||
else
|
||||
error_message = Glib::strerror( errno ) ;
|
||||
}
|
||||
|
||||
return succes ;
|
||||
|
|
Loading…
Reference in New Issue