Rework scope of fat16:: and ntfs::Change_UUID_Warning vectors

The Change_UUID_Warning vectors were fat16 and ntfs class member
variables, but are only ever accessed in the get_custom_text() method.
Make them local variables in get_custom_text() instead.  Static so that
references to them can be returned.
This commit is contained in:
Mike Fleetwood 2018-05-21 12:53:14 +01:00 committed by Curtis Gedak
parent 32df1de163
commit a9e85698f2
4 changed files with 32 additions and 45 deletions

View File

@ -43,7 +43,6 @@ public:
bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ;
private:
static const Glib::ustring Change_UUID_Warning [] ;
const Glib::ustring sanitize_label( const Glib::ustring & label ) const;
};

View File

@ -42,8 +42,6 @@ public:
OperationDetail & operationdetail ) ;
bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ;
static const Glib::ustring Change_UUID_Warning [] ;
private:
void resize_progress( OperationDetail *operationdetail );
void clone_progress( OperationDetail *operationdetail );

View File

@ -29,30 +29,26 @@
namespace GParted
{
const Glib::ustring fat16::Change_UUID_Warning [] =
{ _( "Changing the UUID might invalidate the Windows Product Activation (WPA) key"
)
, _( "On FAT and NTFS file systems, the"
" Volume Serial Number is used as the UUID."
" Changing the Volume Serial Number on the Windows system"
" partition, normally C:, might invalidate the WPA key."
" An invalid WPA key will prevent login until you reactivate Windows."
)
, _( "Changing the UUID on external storage media and non-system partitions"
" is usually safe, but guarantees cannot be given."
)
, ""
} ;
const Glib::ustring & fat16::get_custom_text( CUSTOM_TEXT ttype, int index ) const
{
static const Glib::ustring change_uuid_warning[] =
{ _("Changing the UUID might invalidate the Windows Product Activation "
"(WPA) key"),
_("On FAT and NTFS file systems, the Volume Serial Number is used as "
"the UUID. Changing the Volume Serial Number on the Windows system "
"partition, normally C:, might invalidate the WPA key. An invalid "
"WPA key will prevent login until you reactivate Windows."),
_("Changing the UUID on external storage media and non-system "
"partitions is usually safe, but guarantees cannot be given."),
""
};
int i ;
switch ( ttype ) {
case CTEXT_CHANGE_UUID_WARNING :
for ( i = 0 ; i < index && Change_UUID_Warning[ i ] != "" ; i++ ) {
// Just iterate...
}
return Change_UUID_Warning [ i ] ;
for ( i = 0 ; i < index && change_uuid_warning[i] != "" ; i++ )
; // Just iterate...
return change_uuid_warning[i];
default :
return FileSystem::get_custom_text( ttype, index ) ;
}

View File

@ -26,34 +26,28 @@
namespace GParted
{
const Glib::ustring ntfs::Change_UUID_Warning [] =
{ _( "Changing the UUID might invalidate the Windows Product Activation (WPA) key"
)
, _( "On FAT and NTFS file systems, the"
" Volume Serial Number is used as the UUID."
" Changing the Volume Serial Number on the Windows system"
" partition, normally C:, might invalidate the WPA key."
" An invalid WPA key will prevent login until you reactivate Windows."
)
, _( "In an attempt to avoid invalidating the WPA key, on"
" NTFS file systems only half of the UUID is set to a"
" new random value."
)
, _( "Changing the UUID on external storage media and non-system partitions"
" is usually safe, but guarantees cannot be given."
)
, ""
} ;
const Glib::ustring & ntfs::get_custom_text( CUSTOM_TEXT ttype, int index ) const
{
static const Glib::ustring change_uuid_warning[] =
{ _("Changing the UUID might invalidate the Windows Product Activation "
"(WPA) key"),
_("On FAT and NTFS file systems, the Volume Serial Number is used as "
"the UUID. Changing the Volume Serial Number on the Windows system "
"partition, normally C:, might invalidate the WPA key. An invalid "
"WPA key will prevent login until you reactivate Windows."),
_("In an attempt to avoid invalidating the WPA key, on NTFS file "
"systems only half of the UUID is set to a new random value."),
_("Changing the UUID on external storage media and non-system "
"partitions is usually safe, but guarantees cannot be given."),
""
};
int i ;
switch ( ttype ) {
case CTEXT_CHANGE_UUID_WARNING :
for ( i = 0 ; i < index && Change_UUID_Warning[ i ] != "" ; i++ ) {
// Just iterate...
}
return Change_UUID_Warning [ i ] ;
for ( i = 0 ; i < index && change_uuid_warning[i] != "" ; i++ )
; // Just iterate...
return change_uuid_warning[i];
default :
return FileSystem::get_custom_text( ttype, index ) ;
}