]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / DxeExtractGuidedSectionLib / DxeExtractGuidedSectionLib.c
index 995ef1dd7ebb6a224ad3afae407dbc516d27430a..2634d2f44f327202267cedb98d23d7e4a7126ee5 100644 (file)
 #include <Library/ExtractGuidedSectionLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 \r
-#define EXTRACT_HANDLER_TABLE_SIZE   0x10\r
+#define EXTRACT_HANDLER_TABLE_SIZE  0x10\r
 \r
-UINT32               mNumberOfExtractHandler = 0;\r
-UINT32               mMaxNumberOfExtractHandler = 0;\r
+UINT32  mNumberOfExtractHandler    = 0;\r
+UINT32  mMaxNumberOfExtractHandler = 0;\r
 \r
-GUID                 *mExtractHandlerGuidTable = NULL;\r
-EXTRACT_GUIDED_SECTION_DECODE_HANDLER   *mExtractDecodeHandlerTable = NULL;\r
-EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *mExtractGetInfoHandlerTable = NULL;\r
+GUID                                     *mExtractHandlerGuidTable    = NULL;\r
+EXTRACT_GUIDED_SECTION_DECODE_HANDLER    *mExtractDecodeHandlerTable  = NULL;\r
+EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER  *mExtractGetInfoHandlerTable = NULL;\r
 \r
 /**\r
   Reallocates more global memory to store the registered guid and Handler list.\r
@@ -42,7 +42,7 @@ ReallocateExtractHandlerTable (
                                mMaxNumberOfExtractHandler * sizeof (GUID),\r
                                (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (GUID),\r
                                mExtractHandlerGuidTable\r
-                             );\r
+                               );\r
 \r
   if (mExtractHandlerGuidTable == NULL) {\r
     goto Done;\r
@@ -52,10 +52,10 @@ ReallocateExtractHandlerTable (
   // Reallocate memory for Decode handler Table\r
   //\r
   mExtractDecodeHandlerTable = ReallocatePool (\r
-                               mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),\r
-                               (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),\r
-                               mExtractDecodeHandlerTable\r
-                             );\r
+                                 mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),\r
+                                 (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),\r
+                                 mExtractDecodeHandlerTable\r
+                                 );\r
 \r
   if (mExtractDecodeHandlerTable == NULL) {\r
     goto Done;\r
@@ -65,10 +65,10 @@ ReallocateExtractHandlerTable (
   // Reallocate memory for GetInfo handler Table\r
   //\r
   mExtractGetInfoHandlerTable = ReallocatePool (\r
-                               mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),\r
-                               (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),\r
-                               mExtractGetInfoHandlerTable\r
-                             );\r
+                                  mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),\r
+                                  (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),\r
+                                  mExtractGetInfoHandlerTable\r
+                                  );\r
 \r
   if (mExtractGetInfoHandlerTable == NULL) {\r
     goto Done;\r
@@ -84,15 +84,18 @@ Done:
   if (mExtractHandlerGuidTable != NULL) {\r
     FreePool (mExtractHandlerGuidTable);\r
   }\r
+\r
   if (mExtractDecodeHandlerTable != NULL) {\r
     FreePool (mExtractDecodeHandlerTable);\r
   }\r
+\r
   if (mExtractGetInfoHandlerTable != NULL) {\r
     FreePool (mExtractGetInfoHandlerTable);\r
   }\r
 \r
   return RETURN_OUT_OF_RESOURCES;\r
 }\r
+\r
 /**\r
   Constructor allocates the global memory to store the registered guid and Handler list.\r
 \r
@@ -170,8 +173,8 @@ ExtractGuidedSectionRegisterHandlers (
   IN        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    DecodeHandler\r
   )\r
 {\r
-  UINT32 Index;\r
-  VOID   *GuidData;\r
+  UINT32  Index;\r
+  VOID    *GuidData;\r
 \r
   //\r
   // Check input parameter.\r
@@ -183,13 +186,13 @@ ExtractGuidedSectionRegisterHandlers (
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
-  for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+  for (Index = 0; Index < mNumberOfExtractHandler; Index++) {\r
     if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {\r
       //\r
       // If the guided handler has been registered before, only update its handler.\r
       //\r
-      mExtractDecodeHandlerTable [Index] = DecodeHandler;\r
-      mExtractGetInfoHandlerTable [Index] = GetInfoHandler;\r
+      mExtractDecodeHandlerTable[Index]  = DecodeHandler;\r
+      mExtractGetInfoHandlerTable[Index] = GetInfoHandler;\r
       return RETURN_SUCCESS;\r
     }\r
   }\r
@@ -206,17 +209,17 @@ ExtractGuidedSectionRegisterHandlers (
   //\r
   // Register new Handler and guid value.\r
   //\r
-  CopyGuid (&mExtractHandlerGuidTable [mNumberOfExtractHandler], SectionGuid);\r
-  mExtractDecodeHandlerTable [mNumberOfExtractHandler] = DecodeHandler;\r
-  mExtractGetInfoHandlerTable [mNumberOfExtractHandler++] = GetInfoHandler;\r
+  CopyGuid (&mExtractHandlerGuidTable[mNumberOfExtractHandler], SectionGuid);\r
+  mExtractDecodeHandlerTable[mNumberOfExtractHandler]    = DecodeHandler;\r
+  mExtractGetInfoHandlerTable[mNumberOfExtractHandler++] = GetInfoHandler;\r
 \r
   //\r
   // Install the Guided Section GUID configuration table to record the GUID itself.\r
   // Then the content of the configuration table buffer will be the same as the GUID value itself.\r
   //\r
-  GuidData = AllocateCopyPool (sizeof (GUID), (VOID *) SectionGuid);\r
+  GuidData = AllocateCopyPool (sizeof (GUID), (VOID *)SectionGuid);\r
   if (GuidData != NULL) {\r
-    gBS->InstallConfigurationTable ((EFI_GUID *) SectionGuid, GuidData);\r
+    gBS->InstallConfigurationTable ((EFI_GUID *)SectionGuid, GuidData);\r
   }\r
 \r
   return RETURN_SUCCESS;\r
@@ -265,8 +268,8 @@ ExtractGuidedSectionGetInfo (
   OUT       UINT16  *SectionAttribute\r
   )\r
 {\r
-  UINT32 Index;\r
-  EFI_GUID *SectionDefinitionGuid;\r
+  UINT32    Index;\r
+  EFI_GUID  *SectionDefinitionGuid;\r
 \r
   ASSERT (InputSection != NULL);\r
   ASSERT (OutputBufferSize != NULL);\r
@@ -274,25 +277,25 @@ ExtractGuidedSectionGetInfo (
   ASSERT (SectionAttribute != NULL);\r
 \r
   if (IS_SECTION2 (InputSection)) {\r
-    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);\r
   } else {\r
-    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\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 < mNumberOfExtractHandler; Index ++) {\r
+  for (Index = 0; Index < mNumberOfExtractHandler; Index++) {\r
     if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to getinfo for the input section data.\r
       //\r
-      return mExtractGetInfoHandlerTable [Index] (\r
-                InputSection,\r
-                OutputBufferSize,\r
-                ScratchBufferSize,\r
-                SectionAttribute\r
-              );\r
+      return mExtractGetInfoHandlerTable[Index](\r
+                                                InputSection,\r
+                                                OutputBufferSize,\r
+                                                ScratchBufferSize,\r
+                                                SectionAttribute\r
+                                                );\r
     }\r
   }\r
 \r
@@ -346,8 +349,8 @@ ExtractGuidedSectionDecode (
   OUT       UINT32  *AuthenticationStatus\r
   )\r
 {\r
-  UINT32 Index;\r
-  EFI_GUID *SectionDefinitionGuid;\r
+  UINT32    Index;\r
+  EFI_GUID  *SectionDefinitionGuid;\r
 \r
   //\r
   // Check the input parameters\r
@@ -357,25 +360,25 @@ ExtractGuidedSectionDecode (
   ASSERT (AuthenticationStatus != NULL);\r
 \r
   if (IS_SECTION2 (InputSection)) {\r
-    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);\r
   } else {\r
-    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);\r
   }\r
 \r
   //\r
   // Search the match registered extract handler for the input guided section.\r
   //\r
-  for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+  for (Index = 0; Index < mNumberOfExtractHandler; Index++) {\r
     if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to extract raw data for the input section data.\r
       //\r
-      return mExtractDecodeHandlerTable [Index] (\r
-                InputSection,\r
-                OutputBuffer,\r
-                ScratchBuffer,\r
-                AuthenticationStatus\r
-              );\r
+      return mExtractDecodeHandlerTable[Index](\r
+                                               InputSection,\r
+                                               OutputBuffer,\r
+                                               ScratchBuffer,\r
+                                               AuthenticationStatus\r
+                                               );\r
     }\r
   }\r
 \r
@@ -420,7 +423,7 @@ ExtractGuidedSectionGetHandlers (
   OUT        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    *DecodeHandler    OPTIONAL\r
   )\r
 {\r
-  UINT32 Index;\r
+  UINT32  Index;\r
 \r
   //\r
   // Check input parameter.\r
@@ -430,20 +433,22 @@ ExtractGuidedSectionGetHandlers (
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
-  for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+  for (Index = 0; Index < mNumberOfExtractHandler; Index++) {\r
     if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {\r
-\r
       //\r
       // If the guided handler has been registered before, then return the registered handlers.\r
       //\r
       if (GetInfoHandler != NULL) {\r
         *GetInfoHandler = mExtractGetInfoHandlerTable[Index];\r
       }\r
+\r
       if (DecodeHandler != NULL) {\r
         *DecodeHandler = mExtractDecodeHandlerTable[Index];\r
       }\r
+\r
       return RETURN_SUCCESS;\r
     }\r
   }\r
+\r
   return RETURN_NOT_FOUND;\r
 }\r