From df1d7dea611d992a88cbbd9fe7a20ff2341bebb8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 29 Mar 2021 11:03:32 +0200 Subject: [PATCH] [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). --- .../partition/jobs/CreatePartitionJob.cpp | 72 +++++++++---------- 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/src/modules/partition/jobs/CreatePartitionJob.cpp b/src/modules/partition/jobs/CreatePartitionJob.cpp index b4d89c5eb..241e0a451 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionJob.cpp @@ -33,49 +33,45 @@ CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition ) { } -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)" }, - { "69dad710-2ce4-4e3c-b16c-21a1d49abed3", "Linux Root Partition (32-bit ARM)" }, - { "b921b045-1df0-41c3-af44-4c6f280d3fae", "Linux Root Partition (64-bit ARM)" }, - { "993d8d3d-f80e-4225-855a-9daf8ed7ea97", "Linux Root Partition (Itanium/IA-64)" }, - { "d13c5d3b-b5d1-422a-b29f-9454fdc89d76", "Linux Root Verity Partition (x86)" }, - { "2c7357ed-ebd2-46d9-aec1-23d437ec2bf5", "Linux Root Verity Partition (x86-64)" }, - { "7386cdf2-203c-47a9-a498-f2ecce45a2d6", "Linux Root Verity Partition (32-bit ARM)" }, - { "df3300ce-d69f-4c92-978c-9bfb0f38d820", "Linux Root Verity Partition (64-bit ARM/AArch64)" }, - { "86ed10d5-b607-45bb-8957-d350f23d0571", "Linux Root Verity Partition (Itanium/IA-64)" }, - { "75250d76-8cc6-458e-bd66-bd47cc81a812", "Linux /usr Partition (x86)" }, - { "8484680c-9521-48c6-9c11-b0720656f69e", "Linux /usr Partition (x86-64)" }, - { "7d0359a3-02b3-4f0a-865c-654403e70625", "Linux /usr Partition (32-bit ARM)" }, - { "b0e01050-ee5f-4390-949a-9101b17104e9", "Linux /usr Partition (64-bit ARM/AArch64)" }, - { "4301d2a6-4e3b-4b2a-bb94-9e0b2c4225ea", "Linux /usr Partition (Itanium/IA-64)" }, - { "8f461b0d-14ee-4e81-9aa9-049b6fb97abd", "Linux /usr Verity Partition (x86)" }, - { "77ff5f63-e7b6-4633-acf4-1565b864c0e6", "Linux /usr Verity Partition (x86-64)" }, - { "c215d751-7bcd-4649-be90-6627490a4c05", "Linux /usr Verity Partition (32-bit ARM)" }, - { "6e11a4e7-fbca-4ded-b9e9-e1a512bb664e", "Linux /usr Verity Partition (64-bit ARM/AArch64)" }, - { "6a491e03-3be7-4545-8e38-83320e0ea880", "Linux /usr Verity Partition (Itanium/IA-64)" }, - { "933ac7e1-2eb4-4f13-b844-0e14e2aef915", "Linux Home Partition" }, - { "3b8f8425-20e0-4f3b-907f-1a25a76f98e8", "Linux Server Data Partition" }, - { "4d21b016-b534-45c2-a9fb-5c16e091fd2d", "Linux Variable Data Partition" }, - { "7ec6f557-3bc5-4aca-b293-16ef5df639d1", "Linux Temporary Data Partition" }, - { "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f", "Linux Swap" }, - { "c12a7328-f81f-11d2-ba4b-00a0c93ec93b", "EFI System Partition" }, - { "bc13c2ff-59e6-4262-a352-b275fd6f7172", "Extended Boot Loader Partition" }, - { "0fc63daf-8483-4772-8e79-3d69d8477de4", "Other Data Partitions" }, - { "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7", "Microsoft basic data" }, -}; - -static QString -prettyGptType( const QString& type ) -{ - return gptTypePrettyStrings.value( type.toLower(), type ); -} static QString prettyGptType( const Partition* partition ) { #ifdef WITH_KPMCORE42API - return prettyGptType( partition->type() ); + 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)" }, + { "69dad710-2ce4-4e3c-b16c-21a1d49abed3", "Linux Root Partition (32-bit ARM)" }, + { "b921b045-1df0-41c3-af44-4c6f280d3fae", "Linux Root Partition (64-bit ARM)" }, + { "993d8d3d-f80e-4225-855a-9daf8ed7ea97", "Linux Root Partition (Itanium/IA-64)" }, + { "d13c5d3b-b5d1-422a-b29f-9454fdc89d76", "Linux Root Verity Partition (x86)" }, + { "2c7357ed-ebd2-46d9-aec1-23d437ec2bf5", "Linux Root Verity Partition (x86-64)" }, + { "7386cdf2-203c-47a9-a498-f2ecce45a2d6", "Linux Root Verity Partition (32-bit ARM)" }, + { "df3300ce-d69f-4c92-978c-9bfb0f38d820", "Linux Root Verity Partition (64-bit ARM/AArch64)" }, + { "86ed10d5-b607-45bb-8957-d350f23d0571", "Linux Root Verity Partition (Itanium/IA-64)" }, + { "75250d76-8cc6-458e-bd66-bd47cc81a812", "Linux /usr Partition (x86)" }, + { "8484680c-9521-48c6-9c11-b0720656f69e", "Linux /usr Partition (x86-64)" }, + { "7d0359a3-02b3-4f0a-865c-654403e70625", "Linux /usr Partition (32-bit ARM)" }, + { "b0e01050-ee5f-4390-949a-9101b17104e9", "Linux /usr Partition (64-bit ARM/AArch64)" }, + { "4301d2a6-4e3b-4b2a-bb94-9e0b2c4225ea", "Linux /usr Partition (Itanium/IA-64)" }, + { "8f461b0d-14ee-4e81-9aa9-049b6fb97abd", "Linux /usr Verity Partition (x86)" }, + { "77ff5f63-e7b6-4633-acf4-1565b864c0e6", "Linux /usr Verity Partition (x86-64)" }, + { "c215d751-7bcd-4649-be90-6627490a4c05", "Linux /usr Verity Partition (32-bit ARM)" }, + { "6e11a4e7-fbca-4ded-b9e9-e1a512bb664e", "Linux /usr Verity Partition (64-bit ARM/AArch64)" }, + { "6a491e03-3be7-4545-8e38-83320e0ea880", "Linux /usr Verity Partition (Itanium/IA-64)" }, + { "933ac7e1-2eb4-4f13-b844-0e14e2aef915", "Linux Home Partition" }, + { "3b8f8425-20e0-4f3b-907f-1a25a76f98e8", "Linux Server Data Partition" }, + { "4d21b016-b534-45c2-a9fb-5c16e091fd2d", "Linux Variable Data Partition" }, + { "7ec6f557-3bc5-4aca-b293-16ef5df639d1", "Linux Temporary Data Partition" }, + { "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f", "Linux Swap" }, + { "c12a7328-f81f-11d2-ba4b-00a0c93ec93b", "EFI System Partition" }, + { "bc13c2ff-59e6-4262-a352-b275fd6f7172", "Extended Boot Loader Partition" }, + { "0fc63daf-8483-4772-8e79-3d69d8477de4", "Other Data Partitions" }, + { "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7", "Microsoft basic data" }, + }; + + auto type = partition->type(); + return gptTypePrettyStrings.value( type.toLower(), type ); #else return QString(); #endif