[partition] Warnings--

Avoid the extra indirection through the otherwise-unused
prettyGptType(const QString&), construct table of names
only on first call to avoid static-initialization order
(though that's not important here).
This commit is contained in:
Adriaan de Groot 2021-03-29 11:03:32 +02:00
parent 0ccd55e33f
commit df1d7dea61

View File

@ -33,6 +33,11 @@ CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition )
{
}
static QString
prettyGptType( const Partition* partition )
{
#ifdef WITH_KPMCORE42API
static const QMap< QString, QString > gptTypePrettyStrings = {
{ "44479540-f297-41b2-9af7-d131d5f0458a", "Linux Root Partition (x86)" },
{ "4f68bce3-e8cd-4db1-96e7-fbcaf984b709", "Linux Root Partition (x86-64)" },
@ -65,17 +70,8 @@ static const QMap< QString, QString > gptTypePrettyStrings = {
{ "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7", "Microsoft basic data" },
};
static QString
prettyGptType( const QString& type )
{
auto type = partition->type();
return gptTypePrettyStrings.value( type.toLower(), type );
}
static QString
prettyGptType( const Partition* partition )
{
#ifdef WITH_KPMCORE42API
return prettyGptType( partition->type() );
#else
return QString();
#endif