]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SignedCapsulePkg/Universal/SystemFirmwareUpdate/ParseConfigProfile.c
SignedCapsulePkg: Apply uncrustify changes
[mirror_edk2.git] / SignedCapsulePkg / Universal / SystemFirmwareUpdate / ParseConfigProfile.c
index 878c6680a33864f65b7ea36492c8c9243397ab90..7edbb11eb559f0a4b141111d0f114a15ae7ccfca 100644 (file)
@@ -12,7 +12,7 @@
 #include <Library/IniParsingLib.h>\r
 #include <Library/PrintLib.h>\r
 \r
-#define MAX_LINE_LENGTH           512\r
+#define MAX_LINE_LENGTH  512\r
 \r
 /**\r
   Parse Config data file to get the updated data array.\r
 **/\r
 EFI_STATUS\r
 ParseUpdateDataFile (\r
-  IN      UINT8                         *DataBuffer,\r
-  IN      UINTN                         BufferSize,\r
-  IN OUT  CONFIG_HEADER                 *ConfigHeader,\r
-  IN OUT  UPDATE_CONFIG_DATA            **UpdateArray\r
+  IN      UINT8               *DataBuffer,\r
+  IN      UINTN               BufferSize,\r
+  IN OUT  CONFIG_HEADER       *ConfigHeader,\r
+  IN OUT  UPDATE_CONFIG_DATA  **UpdateArray\r
   )\r
 {\r
-  EFI_STATUS                            Status;\r
-  CHAR8                                 *SectionName;\r
-  CHAR8                                 Entry[MAX_LINE_LENGTH];\r
-  UINTN                                 Num;\r
-  UINT64                                Num64;\r
-  UINTN                                 Index;\r
-  EFI_GUID                              FileGuid;\r
-  VOID                                  *Context;\r
+  EFI_STATUS  Status;\r
+  CHAR8       *SectionName;\r
+  CHAR8       Entry[MAX_LINE_LENGTH];\r
+  UINTN       Num;\r
+  UINT64      Num64;\r
+  UINTN       Index;\r
+  EFI_GUID    FileGuid;\r
+  VOID        *Context;\r
 \r
   //\r
   // First process the data buffer and get all sections and entries\r
   //\r
-  Context = OpenIniFile(DataBuffer, BufferSize);\r
+  Context = OpenIniFile (DataBuffer, BufferSize);\r
   if (Context == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -55,26 +55,26 @@ ParseUpdateDataFile (
   //\r
   // Now get NumOfUpdate\r
   //\r
-  Status = GetDecimalUintnFromDataFile(\r
+  Status = GetDecimalUintnFromDataFile (\r
              Context,\r
              "Head",\r
              "NumOfUpdate",\r
              &Num\r
              );\r
-  if (EFI_ERROR(Status) || (Num == 0)) {\r
-    DEBUG((DEBUG_ERROR, "NumOfUpdate not found\n"));\r
-    CloseIniFile(Context);\r
+  if (EFI_ERROR (Status) || (Num == 0)) {\r
+    DEBUG ((DEBUG_ERROR, "NumOfUpdate not found\n"));\r
+    CloseIniFile (Context);\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
   ConfigHeader->NumOfUpdates = Num;\r
-  *UpdateArray = AllocateZeroPool ((sizeof (UPDATE_CONFIG_DATA) * Num));\r
+  *UpdateArray               = AllocateZeroPool ((sizeof (UPDATE_CONFIG_DATA) * Num));\r
   if (*UpdateArray == NULL) {\r
-    CloseIniFile(Context);\r
+    CloseIniFile (Context);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  for (Index = 0 ; Index < ConfigHeader->NumOfUpdates ; Index++) {\r
+  for (Index = 0; Index < ConfigHeader->NumOfUpdates; Index++) {\r
     //\r
     // Get the section name of each update\r
     //\r
@@ -86,15 +86,15 @@ ParseUpdateDataFile (
       Index,\r
       0\r
       );\r
-    Status = GetStringFromDataFile(\r
+    Status = GetStringFromDataFile (\r
                Context,\r
                "Head",\r
                Entry,\r
                &SectionName\r
                );\r
-    if (EFI_ERROR(Status) || (SectionName == NULL)) {\r
-      DEBUG((DEBUG_ERROR, "[%d] %a not found\n", Index, Entry));\r
-      CloseIniFile(Context);\r
+    if (EFI_ERROR (Status) || (SectionName == NULL)) {\r
+      DEBUG ((DEBUG_ERROR, "[%d] %a not found\n", Index, Entry));\r
+      CloseIniFile (Context);\r
       return EFI_NOT_FOUND;\r
     }\r
 \r
@@ -107,106 +107,110 @@ ParseUpdateDataFile (
     //\r
     // FirmwareType\r
     //\r
-    Status = GetDecimalUintnFromDataFile(\r
+    Status = GetDecimalUintnFromDataFile (\r
                Context,\r
                SectionName,\r
                "FirmwareType",\r
                &Num\r
                );\r
-    if (EFI_ERROR(Status)) {\r
-      CloseIniFile(Context);\r
-      DEBUG((DEBUG_ERROR, "[%d] FirmwareType not found\n", Index));\r
+    if (EFI_ERROR (Status)) {\r
+      CloseIniFile (Context);\r
+      DEBUG ((DEBUG_ERROR, "[%d] FirmwareType not found\n", Index));\r
       return EFI_NOT_FOUND;\r
     }\r
-    (*UpdateArray)[Index].FirmwareType = (PLATFORM_FIRMWARE_TYPE) Num;\r
+\r
+    (*UpdateArray)[Index].FirmwareType = (PLATFORM_FIRMWARE_TYPE)Num;\r
 \r
     //\r
     // AddressType\r
     //\r
-    Status = GetDecimalUintnFromDataFile(\r
+    Status = GetDecimalUintnFromDataFile (\r
                Context,\r
                SectionName,\r
                "AddressType",\r
                &Num\r
                );\r
-    if (EFI_ERROR(Status)) {\r
-      CloseIniFile(Context);\r
-      DEBUG((DEBUG_ERROR, "[%d] AddressType not found\n", Index));\r
+    if (EFI_ERROR (Status)) {\r
+      CloseIniFile (Context);\r
+      DEBUG ((DEBUG_ERROR, "[%d] AddressType not found\n", Index));\r
       return EFI_NOT_FOUND;\r
     }\r
-    (*UpdateArray)[Index].AddressType = (FLASH_ADDRESS_TYPE) Num;\r
+\r
+    (*UpdateArray)[Index].AddressType = (FLASH_ADDRESS_TYPE)Num;\r
 \r
     //\r
     // BaseAddress\r
     //\r
-    Status = GetHexUint64FromDataFile(\r
+    Status = GetHexUint64FromDataFile (\r
                Context,\r
                SectionName,\r
                "BaseAddress",\r
                &Num64\r
                );\r
-    if (EFI_ERROR(Status)) {\r
-      CloseIniFile(Context);\r
-      DEBUG((DEBUG_ERROR, "[%d] BaseAddress not found\n", Index));\r
+    if (EFI_ERROR (Status)) {\r
+      CloseIniFile (Context);\r
+      DEBUG ((DEBUG_ERROR, "[%d] BaseAddress not found\n", Index));\r
       return EFI_NOT_FOUND;\r
     }\r
-    (*UpdateArray)[Index].BaseAddress = (EFI_PHYSICAL_ADDRESS) Num64;\r
+\r
+    (*UpdateArray)[Index].BaseAddress = (EFI_PHYSICAL_ADDRESS)Num64;\r
 \r
     //\r
     // FileGuid\r
     //\r
-    Status = GetGuidFromDataFile(\r
+    Status = GetGuidFromDataFile (\r
                Context,\r
                SectionName,\r
                "FileGuid",\r
                &FileGuid\r
                );\r
-    if (EFI_ERROR(Status)) {\r
-      CloseIniFile(Context);\r
-      DEBUG((DEBUG_ERROR, "[%d] FileGuid not found\n", Index));\r
+    if (EFI_ERROR (Status)) {\r
+      CloseIniFile (Context);\r
+      DEBUG ((DEBUG_ERROR, "[%d] FileGuid not found\n", Index));\r
       return EFI_NOT_FOUND;\r
     }\r
 \r
-    CopyGuid(&((*UpdateArray)[Index].FileGuid), &FileGuid);\r
+    CopyGuid (&((*UpdateArray)[Index].FileGuid), &FileGuid);\r
 \r
     //\r
     // Length\r
     //\r
-    Status = GetHexUintnFromDataFile(\r
+    Status = GetHexUintnFromDataFile (\r
                Context,\r
                SectionName,\r
                "Length",\r
                &Num\r
                );\r
-    if (EFI_ERROR(Status)) {\r
-      CloseIniFile(Context);\r
-      DEBUG((DEBUG_ERROR, "[%d] Length not found\n", Index));\r
+    if (EFI_ERROR (Status)) {\r
+      CloseIniFile (Context);\r
+      DEBUG ((DEBUG_ERROR, "[%d] Length not found\n", Index));\r
       return EFI_NOT_FOUND;\r
     }\r
-    (*UpdateArray)[Index].Length = (UINTN) Num;\r
+\r
+    (*UpdateArray)[Index].Length = (UINTN)Num;\r
 \r
     //\r
     // ImageOffset\r
     //\r
-    Status = GetHexUintnFromDataFile(\r
+    Status = GetHexUintnFromDataFile (\r
                Context,\r
                SectionName,\r
                "ImageOffset",\r
                &Num\r
                );\r
-    if (EFI_ERROR(Status)) {\r
-      CloseIniFile(Context);\r
-      DEBUG((DEBUG_ERROR, "[%d] ImageOffset not found\n", Index));\r
+    if (EFI_ERROR (Status)) {\r
+      CloseIniFile (Context);\r
+      DEBUG ((DEBUG_ERROR, "[%d] ImageOffset not found\n", Index));\r
       return EFI_NOT_FOUND;\r
     }\r
-    (*UpdateArray)[Index].ImageOffset = (UINTN) Num;\r
+\r
+    (*UpdateArray)[Index].ImageOffset = (UINTN)Num;\r
   }\r
 \r
   //\r
   // Now all configuration data got. Free those temporary buffers\r
   //\r
-  CloseIniFile(Context);\r
+  CloseIniFile (Context);\r
 \r
   return EFI_SUCCESS;\r
 }\r
-\r