[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.
This commit is contained in:
Adriaan de Groot 2021-06-18 13:49:31 +02:00
parent ef436ac4d7
commit 7ce2a87644

View File

@ -22,6 +22,7 @@
#include "partition/PartitionQuery.h" #include "partition/PartitionQuery.h"
#include "utils/CalamaresUtilsSystem.h" #include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/RAII.h"
#include <kpmcore/backend/corebackend.h> #include <kpmcore/backend/corebackend.h>
#include <kpmcore/backend/corebackendmanager.h> #include <kpmcore/backend/corebackendmanager.h>
@ -481,19 +482,17 @@ isEfiBootable( const Partition* candidate )
QString QString
canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType ) canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType )
{ {
QStringList fsLanguage { QLatin1String( "C" ) }; // Required language list to turn off localization cPointerSetter type( fsType );
if ( fsName.isEmpty() ) if ( fsName.isEmpty() )
{ {
fsName = QStringLiteral( "ext4" ); type = FileSystem::Ext4;
return QStringLiteral( "ext4" );
} }
FileSystem::Type tmpType = FileSystem::typeForName( fsName, fsLanguage ); QStringList fsLanguage { QLatin1String( "C" ) }; // Required language list to turn off localization
if ( tmpType != FileSystem::Unknown )
if ( ( type = FileSystem::typeForName( fsName, fsLanguage ) ) != FileSystem::Unknown )
{ {
if ( fsType )
{
*fsType = tmpType;
}
return fsName; return fsName;
} }
@ -513,7 +512,6 @@ canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType )
} }
cWarning() << "Filesystem" << fsName << "not found, using ext4"; cWarning() << "Filesystem" << fsName << "not found, using ext4";
fsName = QStringLiteral( "ext4" );
// fsType can be used to check whether fsName was a valid filesystem. // fsType can be used to check whether fsName was a valid filesystem.
if ( fsType ) if ( fsType )
{ {
@ -533,7 +531,8 @@ canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType )
} }
} }
#endif #endif
return fsName; type = FileSystem::Unknown;
return QStringLiteral( "ext4" );
} }
} // namespace PartUtils } // namespace PartUtils