Remove redundant code trimming labels to length before use (#689318)
No longer need to trim fat16, fat32 and xfs labels as all labels are limited to their maximum lengths during entry. Bug #689318 - filesystem type specific support for partition name maximum length
This commit is contained in:
parent
18941e24d3
commit
d0fec5e26f
|
@ -174,7 +174,6 @@ public:
|
|||
static Glib::ustring regexp_label( const Glib::ustring & text
|
||||
, const Glib::ustring & pattern
|
||||
) ;
|
||||
static Glib::ustring fat_compliant_label( const Glib::ustring & label ) ;
|
||||
static Glib::ustring create_mtoolsrc_file( char file_name[],
|
||||
const char drive_letter, const Glib::ustring & device_path ) ;
|
||||
static Glib::ustring delete_mtoolsrc_file( const char file_name[] ) ;
|
||||
|
|
|
@ -458,15 +458,6 @@ Glib::ustring Utils::regexp_label( const Glib::ustring & text
|
|||
return "" ;
|
||||
}
|
||||
|
||||
Glib::ustring Utils::fat_compliant_label( const Glib::ustring & label )
|
||||
{
|
||||
//Limit volume label to 11 characters
|
||||
Glib::ustring text = label ;
|
||||
if( text .length() > 11 )
|
||||
text .resize( 11 ) ;
|
||||
return text ;
|
||||
}
|
||||
|
||||
Glib::ustring Utils::create_mtoolsrc_file( char file_name[], const char drive_letter,
|
||||
const Glib::ustring & device_path )
|
||||
{
|
||||
|
|
|
@ -190,10 +190,10 @@ bool fat16::write_label( const Partition & partition, OperationDetail & operatio
|
|||
cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -c %2:", fname, dletter ) ;
|
||||
else
|
||||
cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel %2:\"%3\"",
|
||||
fname, dletter, Utils::fat_compliant_label( partition .get_label() ) ) ;
|
||||
|
||||
fname, dletter, partition .get_label() ) ;
|
||||
|
||||
operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
|
||||
|
||||
|
||||
int exit_status = Utils::execute_command( cmd, output, error ) ;
|
||||
|
||||
if ( ! output .empty() )
|
||||
|
@ -268,8 +268,7 @@ bool fat16::write_uuid( const Partition & partition, OperationDetail & operation
|
|||
|
||||
bool fat16::create( const Partition & new_partition, OperationDetail & operationdetail )
|
||||
{
|
||||
return ! execute_command( "mkdosfs -F16 -v -n \"" + Utils::fat_compliant_label( new_partition .get_label() ) +
|
||||
"\" " + new_partition .get_path(), operationdetail ) ;
|
||||
return ! execute_command( "mkdosfs -F16 -v -n \"" + new_partition .get_label() + "\" " + new_partition .get_path(), operationdetail ) ;
|
||||
}
|
||||
|
||||
bool fat16::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
|
||||
|
|
|
@ -178,9 +178,10 @@ bool fat32::write_label( const Partition & partition, OperationDetail & operatio
|
|||
cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -c %2:", fname, dletter ) ;
|
||||
else
|
||||
cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel %2:\"%3\"",
|
||||
fname, dletter, Utils::fat_compliant_label( partition .get_label() ) ) ;
|
||||
fname, dletter, partition .get_label() ) ;
|
||||
|
||||
operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
|
||||
|
||||
|
||||
int exit_status = Utils::execute_command( cmd, output, error ) ;
|
||||
|
||||
if ( ! output .empty() )
|
||||
|
@ -256,8 +257,7 @@ bool fat32::write_uuid( const Partition & partition, OperationDetail & operation
|
|||
|
||||
bool fat32::create( const Partition & new_partition, OperationDetail & operationdetail )
|
||||
{
|
||||
return ! execute_command( "mkdosfs -F32 -v -n \"" + Utils::fat_compliant_label( new_partition .get_label() ) +
|
||||
"\" " + new_partition .get_path(), operationdetail ) ;
|
||||
return ! execute_command( "mkdosfs -F32 -v -n \"" + new_partition .get_label() + "\" " + new_partition .get_path(), operationdetail ) ;
|
||||
}
|
||||
|
||||
bool fat32::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
|
||||
|
|
|
@ -164,11 +164,7 @@ bool xfs::write_uuid( const Partition & partition, OperationDetail & operationde
|
|||
|
||||
bool xfs::create( const Partition & new_partition, OperationDetail & operationdetail )
|
||||
{
|
||||
//mkfs.xfs will not create file system if label is longer than 12 characters, hence truncation.
|
||||
Glib::ustring label = new_partition .get_label() ;
|
||||
if( label .length() > 12 )
|
||||
label = label.substr( 0, 12 ) ;
|
||||
return ! execute_command( "mkfs.xfs -f -L \"" + label + "\" " + new_partition .get_path(), operationdetail ) ;
|
||||
return ! execute_command( "mkfs.xfs -f -L \"" + new_partition .get_label() + "\" " + new_partition .get_path(), operationdetail ) ;
|
||||
}
|
||||
|
||||
bool xfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
|
||||
|
|
Loading…
Reference in New Issue