[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,7 +33,12 @@ CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition )
{ {
} }
static const QMap< QString, QString > gptTypePrettyStrings = {
static QString
prettyGptType( const Partition* partition )
{
#ifdef WITH_KPMCORE42API
static const QMap< QString, QString > gptTypePrettyStrings = {
{ "44479540-f297-41b2-9af7-d131d5f0458a", "Linux Root Partition (x86)" }, { "44479540-f297-41b2-9af7-d131d5f0458a", "Linux Root Partition (x86)" },
{ "4f68bce3-e8cd-4db1-96e7-fbcaf984b709", "Linux Root Partition (x86-64)" }, { "4f68bce3-e8cd-4db1-96e7-fbcaf984b709", "Linux Root Partition (x86-64)" },
{ "69dad710-2ce4-4e3c-b16c-21a1d49abed3", "Linux Root Partition (32-bit ARM)" }, { "69dad710-2ce4-4e3c-b16c-21a1d49abed3", "Linux Root Partition (32-bit ARM)" },
@ -63,19 +68,10 @@ static const QMap< QString, QString > gptTypePrettyStrings = {
{ "bc13c2ff-59e6-4262-a352-b275fd6f7172", "Extended Boot Loader Partition" }, { "bc13c2ff-59e6-4262-a352-b275fd6f7172", "Extended Boot Loader Partition" },
{ "0fc63daf-8483-4772-8e79-3d69d8477de4", "Other Data Partitions" }, { "0fc63daf-8483-4772-8e79-3d69d8477de4", "Other Data Partitions" },
{ "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7", "Microsoft basic data" }, { "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7", "Microsoft basic data" },
}; };
static QString auto type = partition->type();
prettyGptType( const QString& type )
{
return gptTypePrettyStrings.value( type.toLower(), type ); return gptTypePrettyStrings.value( type.toLower(), type );
}
static QString
prettyGptType( const Partition* partition )
{
#ifdef WITH_KPMCORE42API
return prettyGptType( partition->type() );
#else #else
return QString(); return QString();
#endif #endif