From 7ce2a876448ea33b371ec379a3259a9f7f6d16da Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 18 Jun 2021 13:49:31 +0200 Subject: [PATCH] [partition] Fix build - fsName was a QString (a copy) so it could be modified; - the modification isn't really necessary. - While here, pick up new PointerSetter convenience class. --- src/modules/partition/core/PartUtils.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 8bff2c95f..2f269d37f 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -22,6 +22,7 @@ #include "partition/PartitionQuery.h" #include "utils/CalamaresUtilsSystem.h" #include "utils/Logger.h" +#include "utils/RAII.h" #include #include @@ -481,19 +482,17 @@ isEfiBootable( const Partition* candidate ) QString canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType ) { - QStringList fsLanguage { QLatin1String( "C" ) }; // Required language list to turn off localization + cPointerSetter type( fsType ); if ( fsName.isEmpty() ) { - fsName = QStringLiteral( "ext4" ); + type = FileSystem::Ext4; + return QStringLiteral( "ext4" ); } - FileSystem::Type tmpType = FileSystem::typeForName( fsName, fsLanguage ); - if ( tmpType != FileSystem::Unknown ) + QStringList fsLanguage { QLatin1String( "C" ) }; // Required language list to turn off localization + + if ( ( type = FileSystem::typeForName( fsName, fsLanguage ) ) != FileSystem::Unknown ) { - if ( fsType ) - { - *fsType = tmpType; - } return fsName; } @@ -513,7 +512,6 @@ canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType ) } cWarning() << "Filesystem" << fsName << "not found, using ext4"; - fsName = QStringLiteral( "ext4" ); // fsType can be used to check whether fsName was a valid filesystem. if ( fsType ) { @@ -533,7 +531,8 @@ canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType ) } } #endif - return fsName; + type = FileSystem::Unknown; + return QStringLiteral( "ext4" ); } } // namespace PartUtils