From a9e85698f2d7dd34de3c36791163a84bd60b7db0 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Mon, 21 May 2018 12:53:14 +0100 Subject: [PATCH] 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. --- include/fat16.h | 1 - include/ntfs.h | 2 -- src/fat16.cc | 34 +++++++++++++++------------------- src/ntfs.cc | 40 +++++++++++++++++----------------------- 4 files changed, 32 insertions(+), 45 deletions(-) diff --git a/include/fat16.h b/include/fat16.h index c0ab9e36..4d1f3163 100644 --- a/include/fat16.h +++ b/include/fat16.h @@ -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; }; diff --git a/include/ntfs.h b/include/ntfs.h index 08a7a296..dd7389cb 100644 --- a/include/ntfs.h +++ b/include/ntfs.h @@ -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 ); diff --git a/src/fat16.cc b/src/fat16.cc index b9146146..1687a925 100644 --- a/src/fat16.cc +++ b/src/fat16.cc @@ -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 ) ; } diff --git a/src/ntfs.cc b/src/ntfs.cc index 9e954aea..84749660 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -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 ) ; }