]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c
EmbeddedPkg: Change OPTIONAL keyword usage style
[mirror_edk2.git] / EmbeddedPkg / Library / PrePiExtractGuidedSectionLib / PrePiExtractGuidedSectionLib.c
index 7b08de8ab9fe58fa8afff9dada4559af5638b885..12885f42305ded8d455dc0aabba544c5ef83e556 100644 (file)
@@ -2,13 +2,7 @@
 \r
   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
 \r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -123,6 +117,7 @@ ExtractGuidedSectionGetInfo (
 {\r
   PRE_PI_EXTRACT_GUIDED_SECTION_DATA  *SavedData;\r
   UINT32                              Index;\r
+  EFI_GUID                            *SectionDefinitionGuid;\r
 \r
   if (InputSection == NULL) {\r
     return RETURN_INVALID_PARAMETER;\r
@@ -134,11 +129,17 @@ ExtractGuidedSectionGetInfo (
 \r
   SavedData = GetSavedData();\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
   for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
       break;\r
     }\r
   }\r
@@ -166,12 +167,13 @@ EFIAPI
 ExtractGuidedSectionDecode (\r
   IN  CONST VOID    *InputSection,\r
   OUT       VOID    **OutputBuffer,\r
-  OUT       VOID    *ScratchBuffer,        OPTIONAL\r
+  OUT       VOID    *ScratchBuffer         OPTIONAL,\r
   OUT       UINT32  *AuthenticationStatus\r
   )\r
 {\r
   PRE_PI_EXTRACT_GUIDED_SECTION_DATA  *SavedData;\r
   UINT32                              Index;\r
+  EFI_GUID                            *SectionDefinitionGuid;\r
 \r
   if (InputSection == NULL) {\r
     return RETURN_INVALID_PARAMETER;\r
@@ -182,11 +184,17 @@ ExtractGuidedSectionDecode (
 \r
   SavedData = GetSavedData();\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
   for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
       break;\r
     }\r
   }\r