diff --git a/include/FileSystem.h b/include/FileSystem.h index 0e65f7d8..f4df2baf 100644 --- a/include/FileSystem.h +++ b/include/FileSystem.h @@ -106,8 +106,8 @@ public: FileSystem() ; virtual ~FileSystem() {} - virtual const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; - static const Glib::ustring get_generic_text( CUSTOM_TEXT ttype, int index = 0 ) ; + virtual const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; + static const Glib::ustring & get_generic_text( CUSTOM_TEXT ttype, int index = 0 ); virtual FS get_filesystem_support() = 0 ; virtual FS_Limits get_filesystem_limits( const Partition & partition ) const { return fs_limits; }; diff --git a/include/fat16.h b/include/fat16.h index 913f5f30..c0ab9e36 100644 --- a/include/fat16.h +++ b/include/fat16.h @@ -32,7 +32,7 @@ class fat16 : public FileSystem Glib::ustring check_cmd ; public: fat16( enum FSType type ) : specific_type( type ), create_cmd( "" ), check_cmd( "" ) {}; - const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; + const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; FS get_filesystem_support() ; void set_used_sectors( Partition & partition ) ; void read_label( Partition & partition ) ; diff --git a/include/linux_swap.h b/include/linux_swap.h index b856495f..bc6407bc 100644 --- a/include/linux_swap.h +++ b/include/linux_swap.h @@ -28,7 +28,7 @@ namespace GParted class linux_swap : public FileSystem { public: - virtual const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; + virtual const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; FS get_filesystem_support() ; void set_used_sectors( Partition & partition ) ; diff --git a/include/luks.h b/include/luks.h index 24c86c79..22116de9 100644 --- a/include/luks.h +++ b/include/luks.h @@ -27,7 +27,7 @@ namespace GParted class luks : public FileSystem { public: - const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; + const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; FS get_filesystem_support(); bool is_busy( const Glib::ustring & path ); void set_used_sectors( Partition & partition ); diff --git a/include/lvm2_pv.h b/include/lvm2_pv.h index 0f471577..eadeaba4 100644 --- a/include/lvm2_pv.h +++ b/include/lvm2_pv.h @@ -27,7 +27,7 @@ namespace GParted class lvm2_pv : public FileSystem { public: - const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; + const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; FS get_filesystem_support() ; bool is_busy( const Glib::ustring & path ) ; void set_used_sectors( Partition & partition ) ; diff --git a/include/ntfs.h b/include/ntfs.h index 1285aa9f..08a7a296 100644 --- a/include/ntfs.h +++ b/include/ntfs.h @@ -28,7 +28,7 @@ namespace GParted class ntfs : public FileSystem { public: - const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; + const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; FS get_filesystem_support() ; void set_used_sectors( Partition & partition ) ; void read_label( Partition & partition ) ; diff --git a/src/FileSystem.cc b/src/FileSystem.cc index 04696411..718f3a98 100644 --- a/src/FileSystem.cc +++ b/src/FileSystem.cc @@ -31,24 +31,25 @@ FileSystem::FileSystem() { } -const Glib::ustring FileSystem::get_custom_text( CUSTOM_TEXT ttype, int index ) const +const Glib::ustring & FileSystem::get_custom_text( CUSTOM_TEXT ttype, int index ) const { return get_generic_text( ttype, index ) ; } -const Glib::ustring FileSystem::get_generic_text( CUSTOM_TEXT ttype, int index ) +const Glib::ustring & FileSystem::get_generic_text( CUSTOM_TEXT ttype, int index ) { /*TO TRANSLATORS: these labels will be used in the partition menu */ static const Glib::ustring activate_text = _( "_Mount" ) ; static const Glib::ustring deactivate_text = _( "_Unmount" ) ; + static const Glib::ustring empty_text; switch ( ttype ) { case CTEXT_ACTIVATE_FILESYSTEM : - return index == 0 ? activate_text : "" ; + return index == 0 ? activate_text : empty_text; case CTEXT_DEACTIVATE_FILESYSTEM : - return index == 0 ? deactivate_text : "" ; + return index == 0 ? deactivate_text : empty_text; default : - return "" ; + return empty_text; } } diff --git a/src/fat16.cc b/src/fat16.cc index 0c27322e..b9146146 100644 --- a/src/fat16.cc +++ b/src/fat16.cc @@ -44,7 +44,7 @@ const Glib::ustring fat16::Change_UUID_Warning [] = , "" } ; -const Glib::ustring fat16::get_custom_text( CUSTOM_TEXT ttype, int index ) const +const Glib::ustring & fat16::get_custom_text( CUSTOM_TEXT ttype, int index ) const { int i ; switch ( ttype ) { diff --git a/src/linux_swap.cc b/src/linux_swap.cc index d276b3ed..84e20303 100644 --- a/src/linux_swap.cc +++ b/src/linux_swap.cc @@ -25,19 +25,20 @@ namespace GParted { -const Glib::ustring linux_swap::get_custom_text( CUSTOM_TEXT ttype, int index ) const +const Glib::ustring & linux_swap::get_custom_text( CUSTOM_TEXT ttype, int index ) const { /*TO TRANSLATORS: these labels will be used in the partition menu */ static const Glib::ustring activate_text = _( "_Swapon" ) ; static const Glib::ustring deactivate_text = _( "_Swapoff" ) ; + static const Glib::ustring empty_text; switch ( ttype ) { case CTEXT_ACTIVATE_FILESYSTEM : - return index == 0 ? activate_text : "" ; + return index == 0 ? activate_text : empty_text; case CTEXT_DEACTIVATE_FILESYSTEM : - return index == 0 ? deactivate_text : "" ; + return index == 0 ? deactivate_text : empty_text; default : - return "" ; + return empty_text; } } diff --git a/src/luks.cc b/src/luks.cc index 9c6ed327..5ea3e867 100644 --- a/src/luks.cc +++ b/src/luks.cc @@ -22,20 +22,21 @@ namespace GParted { -const Glib::ustring luks::get_custom_text( CUSTOM_TEXT ttype, int index ) const +const Glib::ustring & luks::get_custom_text( CUSTOM_TEXT ttype, int index ) const { /* TO TRANSLATORS: these labels will be used in the partition menu */ static const Glib::ustring activate_text = _("Open Encryption"); static const Glib::ustring deactivate_text = _("Close Encryption"); + static const Glib::ustring empty_text; switch ( ttype ) { case CTEXT_ACTIVATE_FILESYSTEM: - return index == 0 ? activate_text : ""; + return index == 0 ? activate_text : empty_text; case CTEXT_DEACTIVATE_FILESYSTEM: - return index == 0 ? deactivate_text : ""; + return index == 0 ? deactivate_text : empty_text; default: - return ""; + return empty_text; } } diff --git a/src/lvm2_pv.cc b/src/lvm2_pv.cc index 15af3eba..ece13cd4 100644 --- a/src/lvm2_pv.cc +++ b/src/lvm2_pv.cc @@ -22,7 +22,7 @@ namespace GParted { -const Glib::ustring lvm2_pv::get_custom_text( CUSTOM_TEXT ttype, int index ) const +const Glib::ustring & lvm2_pv::get_custom_text( CUSTOM_TEXT ttype, int index ) const { /*TO TRANSLATORS: these labels will be used in the partition menu */ static const Glib::ustring activate_text = _( "Ac_tivate" ) ; @@ -31,17 +31,18 @@ const Glib::ustring lvm2_pv::get_custom_text( CUSTOM_TEXT ttype, int index ) con static const Glib::ustring resize_warning = _( "The LVM2 Physical Volume can not currently be resized because it is a member of an exported " "Volume Group." ) ; + static const Glib::ustring empty_text; switch ( ttype ) { case CTEXT_ACTIVATE_FILESYSTEM: - return index == 0 ? activate_text : "" ; + return index == 0 ? activate_text : empty_text; case CTEXT_DEACTIVATE_FILESYSTEM: - return index == 0 ? deactivate_text : "" ; + return index == 0 ? deactivate_text : empty_text; case CTEXT_RESIZE_DISALLOWED_WARNING: - return index == 0 ? resize_warning : "" ; + return index == 0 ? resize_warning : empty_text; default: - return "" ; + return empty_text; } } diff --git a/src/ntfs.cc b/src/ntfs.cc index 4fbf1376..9e954aea 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -45,7 +45,7 @@ const Glib::ustring ntfs::Change_UUID_Warning [] = , "" } ; -const Glib::ustring ntfs::get_custom_text( CUSTOM_TEXT ttype, int index ) const +const Glib::ustring & ntfs::get_custom_text( CUSTOM_TEXT ttype, int index ) const { int i ; switch ( ttype ) {