]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
ShellPkg: Apply uncrustify changes
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / UefiShellDebug1CommandsLib.c
index f918867f47afb00e3a6ed9d74f1d5a5f21147cd4..c3682eeae476145f00f21f04239d9d2a1a9f877b 100644 (file)
@@ -9,8 +9,8 @@
 #include "UefiShellDebug1CommandsLib.h"\r
 #include <Library/BcfgCommandLib.h>\r
 \r
-STATIC CONST CHAR16 mFileName[] = L"Debug1Commands";\r
-EFI_HII_HANDLE gShellDebug1HiiHandle = NULL;\r
+STATIC CONST CHAR16  mFileName[]           = L"Debug1Commands";\r
+EFI_HII_HANDLE       gShellDebug1HiiHandle = NULL;\r
 \r
 /**\r
   Gets the debug file name.  This will be used if HII is not working.\r
@@ -18,7 +18,7 @@ EFI_HII_HANDLE gShellDebug1HiiHandle = NULL;
   @retval NULL    No file is available.\r
   @return         The NULL-terminated filename to get help from.\r
 **/\r
-CONST CHAR16*\r
+CONST CHAR16 *\r
 EFIAPI\r
 ShellCommandGetManFileNameDebug1 (\r
   VOID\r
@@ -46,7 +46,7 @@ UefiShellDebug1CommandsLibConstructor (
   //\r
   // check our bit of the profiles mask\r
   //\r
-  if ((PcdGet8(PcdShellProfileMask) & BIT1) == 0) {\r
+  if ((PcdGet8 (PcdShellProfileMask) & BIT1) == 0) {\r
     return (EFI_SUCCESS);\r
   }\r
 \r
@@ -61,27 +61,27 @@ UefiShellDebug1CommandsLibConstructor (
   //\r
   // install our shell command handlers that are always installed\r
   //\r
-  ShellCommandRegisterCommandName(L"setsize",       ShellCommandRunSetSize            , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETSIZE)      );\r
-  ShellCommandRegisterCommandName(L"comp",          ShellCommandRunComp               , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_COMP)         );\r
-  ShellCommandRegisterCommandName(L"mode",          ShellCommandRunMode               , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MODE)         );\r
-  ShellCommandRegisterCommandName(L"memmap",        ShellCommandRunMemMap             , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MEMMAP)       );\r
-  ShellCommandRegisterCommandName(L"eficompress",   ShellCommandRunEfiCompress        , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFICOMPRESS)  );\r
-  ShellCommandRegisterCommandName(L"efidecompress", ShellCommandRunEfiDecompress      , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFIDCOMPRESS) );\r
-  ShellCommandRegisterCommandName(L"dmem",          ShellCommandRunDmem               , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMEM)         );\r
-  ShellCommandRegisterCommandName(L"loadpcirom",    ShellCommandRunLoadPciRom         , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_LOAD_PCI_ROM) );\r
-  ShellCommandRegisterCommandName(L"mm",            ShellCommandRunMm                 , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MM)           );\r
-  ShellCommandRegisterCommandName(L"setvar",        ShellCommandRunSetVar             , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETVAR)       );\r
-  ShellCommandRegisterCommandName(L"sermode",       ShellCommandRunSerMode            , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SERMODE)      );\r
-  ShellCommandRegisterCommandName(L"pci",           ShellCommandRunPci                , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_PCI)          );\r
-  ShellCommandRegisterCommandName(L"smbiosview",    ShellCommandRunSmbiosView         , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SMBIOSVIEW)   );\r
-  ShellCommandRegisterCommandName(L"dmpstore",      ShellCommandRunDmpStore           , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMPSTORE)     );\r
-  ShellCommandRegisterCommandName(L"dblk",          ShellCommandRunDblk               , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DBLK)         );\r
-  ShellCommandRegisterCommandName(L"edit",          ShellCommandRunEdit               , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EDIT)         );\r
-  ShellCommandRegisterCommandName(L"hexedit",       ShellCommandRunHexEdit            , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT)      );\r
-\r
-  ShellCommandRegisterAlias(L"dmem", L"mem");\r
-\r
-  BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Debug1");\r
+  ShellCommandRegisterCommandName (L"setsize", ShellCommandRunSetSize, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_SETSIZE));\r
+  ShellCommandRegisterCommandName (L"comp", ShellCommandRunComp, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_COMP));\r
+  ShellCommandRegisterCommandName (L"mode", ShellCommandRunMode, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_MODE));\r
+  ShellCommandRegisterCommandName (L"memmap", ShellCommandRunMemMap, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_MEMMAP));\r
+  ShellCommandRegisterCommandName (L"eficompress", ShellCommandRunEfiCompress, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_EFICOMPRESS));\r
+  ShellCommandRegisterCommandName (L"efidecompress", ShellCommandRunEfiDecompress, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_EFIDCOMPRESS));\r
+  ShellCommandRegisterCommandName (L"dmem", ShellCommandRunDmem, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_DMEM));\r
+  ShellCommandRegisterCommandName (L"loadpcirom", ShellCommandRunLoadPciRom, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_LOAD_PCI_ROM));\r
+  ShellCommandRegisterCommandName (L"mm", ShellCommandRunMm, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_MM));\r
+  ShellCommandRegisterCommandName (L"setvar", ShellCommandRunSetVar, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_SETVAR));\r
+  ShellCommandRegisterCommandName (L"sermode", ShellCommandRunSerMode, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_SERMODE));\r
+  ShellCommandRegisterCommandName (L"pci", ShellCommandRunPci, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_PCI));\r
+  ShellCommandRegisterCommandName (L"smbiosview", ShellCommandRunSmbiosView, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_SMBIOSVIEW));\r
+  ShellCommandRegisterCommandName (L"dmpstore", ShellCommandRunDmpStore, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_DMPSTORE));\r
+  ShellCommandRegisterCommandName (L"dblk", ShellCommandRunDblk, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_DBLK));\r
+  ShellCommandRegisterCommandName (L"edit", ShellCommandRunEdit, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_EDIT));\r
+  ShellCommandRegisterCommandName (L"hexedit", ShellCommandRunHexEdit, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_HEXEDIT));\r
+\r
+  ShellCommandRegisterAlias (L"dmem", L"mem");\r
+\r
+  BcfgLibraryRegisterBcfgCommand (ImageHandle, SystemTable, L"Debug1");\r
 \r
   return (EFI_SUCCESS);\r
 }\r
@@ -100,14 +100,13 @@ UefiShellDebug1CommandsLibDestructor (
   )\r
 {\r
   if (gShellDebug1HiiHandle != NULL) {\r
-    HiiRemovePackages(gShellDebug1HiiHandle);\r
+    HiiRemovePackages (gShellDebug1HiiHandle);\r
   }\r
 \r
-  BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable);\r
+  BcfgLibraryUnregisterBcfgCommand (ImageHandle, SystemTable);\r
   return (EFI_SUCCESS);\r
 }\r
 \r
-\r
 /**\r
   Function returns a system configuration table that is stored in the\r
   EFI System Table based on the provided GUID.\r
@@ -120,11 +119,12 @@ UefiShellDebug1CommandsLibDestructor (
 **/\r
 EFI_STATUS\r
 GetSystemConfigurationTable (\r
-  IN EFI_GUID *TableGuid,\r
-  IN OUT VOID **Table\r
+  IN EFI_GUID  *TableGuid,\r
+  IN OUT VOID  **Table\r
   )\r
 {\r
-  UINTN Index;\r
+  UINTN  Index;\r
+\r
   ASSERT (Table != NULL);\r
 \r
   for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {\r
@@ -146,13 +146,13 @@ GetSystemConfigurationTable (
 **/\r
 VOID\r
 EditorClearLine (\r
-  IN UINTN Row,\r
-  IN UINTN LastCol,\r
-  IN UINTN LastRow\r
+  IN UINTN  Row,\r
+  IN UINTN  LastCol,\r
+  IN UINTN  LastRow\r
   )\r
 {\r
-  UINTN  Col;\r
-  CHAR16 Line[200];\r
+  UINTN   Col;\r
+  CHAR16  Line[200];\r
 \r
   if (Row == 0) {\r
     Row = 1;\r
@@ -180,7 +180,7 @@ EditorClearLine (
     //\r
     // print out the blank line\r
     //\r
-    ShellPrintEx ((INT32) Col - 1, (INT32) Row - 1, Line);\r
+    ShellPrintEx ((INT32)Col - 1, (INT32)Row - 1, Line);\r
   }\r
 }\r
 \r
@@ -194,13 +194,13 @@ EditorClearLine (
 **/\r
 BOOLEAN\r
 IsValidFileNameChar (\r
-  IN CONST CHAR16 Ch\r
+  IN CONST CHAR16  Ch\r
   )\r
 {\r
   //\r
   // See if there are any illegal characters within the name\r
   //\r
-  if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|') {\r
+  if ((Ch < 0x20) || (Ch == L'\"') || (Ch == L'*') || (Ch == L'/') || (Ch == L'<') || (Ch == L'>') || (Ch == L'?') || (Ch == L'|')) {\r
     return FALSE;\r
   }\r
 \r
@@ -217,25 +217,25 @@ IsValidFileNameChar (
 **/\r
 BOOLEAN\r
 IsValidFileName (\r
-  IN CONST CHAR16 *Name\r
+  IN CONST CHAR16  *Name\r
   )\r
 {\r
-\r
-  UINTN Index;\r
-  UINTN Len;\r
+  UINTN  Index;\r
+  UINTN  Len;\r
 \r
   //\r
   // check the length of Name\r
   //\r
   for (Len = 0, Index = StrLen (Name) - 1; Index + 1 != 0; Index--, Len++) {\r
-    if (Name[Index] == '\\' || Name[Index] == ':') {\r
+    if ((Name[Index] == '\\') || (Name[Index] == ':')) {\r
       break;\r
     }\r
   }\r
 \r
-  if (Len == 0 || Len > 255) {\r
+  if ((Len == 0) || (Len > 255)) {\r
     return FALSE;\r
   }\r
+\r
   //\r
   // check whether any char in Name not appears in valid file name char\r
   //\r
@@ -258,14 +258,14 @@ IsValidFileName (
 **/\r
 CHAR16 *\r
 EditGetDefaultFileName (\r
-  IN CONST CHAR16 *Extension\r
+  IN CONST CHAR16  *Extension\r
   )\r
 {\r
-  EFI_STATUS         Status;\r
-  UINTN              Suffix;\r
-  CHAR16             *FileNameTmp;\r
+  EFI_STATUS  Status;\r
+  UINTN       Suffix;\r
+  CHAR16      *FileNameTmp;\r
 \r
-  Suffix       = 0;\r
+  Suffix = 0;\r
 \r
   do {\r
     FileNameTmp = CatSPrint (NULL, L"NewFile%d.%s", Suffix, Extension);\r
@@ -311,27 +311,27 @@ EditGetDefaultFileName (
 **/\r
 EFI_STATUS\r
 ReadFileIntoBuffer (\r
-  IN CONST CHAR16 *FileName,\r
-  OUT VOID        **Buffer,\r
-  OUT UINTN       *BufferSize OPTIONAL,\r
-  OUT BOOLEAN     *ReadOnly\r
+  IN CONST CHAR16  *FileName,\r
+  OUT VOID         **Buffer,\r
+  OUT UINTN        *BufferSize OPTIONAL,\r
+  OUT BOOLEAN      *ReadOnly\r
   )\r
 {\r
-  VOID              *InternalBuffer;\r
-  UINTN             FileSize;\r
-  SHELL_FILE_HANDLE FileHandle;\r
-  BOOLEAN           CreateFile;\r
-  EFI_STATUS        Status;\r
-  EFI_FILE_INFO     *Info;\r
-\r
-  InternalBuffer  = NULL;\r
-  FileSize        = 0;\r
-  FileHandle      = NULL;\r
-  CreateFile      = FALSE;\r
-  Status          = EFI_SUCCESS;\r
-  Info            = NULL;\r
-\r
-  if (FileName == NULL || Buffer == NULL || ReadOnly == NULL) {\r
+  VOID               *InternalBuffer;\r
+  UINTN              FileSize;\r
+  SHELL_FILE_HANDLE  FileHandle;\r
+  BOOLEAN            CreateFile;\r
+  EFI_STATUS         Status;\r
+  EFI_FILE_INFO      *Info;\r
+\r
+  InternalBuffer = NULL;\r
+  FileSize       = 0;\r
+  FileHandle     = NULL;\r
+  CreateFile     = FALSE;\r
+  Status         = EFI_SUCCESS;\r
+  Info           = NULL;\r
+\r
+  if ((FileName == NULL) || (Buffer == NULL) || (ReadOnly == NULL)) {\r
     return (EFI_INVALID_PARAMETER);\r
   }\r
 \r
@@ -340,13 +340,13 @@ ReadFileIntoBuffer (
   //\r
   Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0);\r
 \r
-  if (!EFI_ERROR(Status)) {\r
-    ASSERT(CreateFile == FALSE);\r
+  if (!EFI_ERROR (Status)) {\r
+    ASSERT (CreateFile == FALSE);\r
     if (FileHandle == NULL) {\r
       return EFI_LOAD_ERROR;\r
     }\r
 \r
-    Info = ShellGetFileInfo(FileHandle);\r
+    Info = ShellGetFileInfo (FileHandle);\r
 \r
     if (Info->Attribute & EFI_FILE_DIRECTORY) {\r
       FreePool (Info);\r
@@ -358,10 +358,11 @@ ReadFileIntoBuffer (
     } else {\r
       *ReadOnly = FALSE;\r
     }\r
+\r
     //\r
     // get file size\r
     //\r
-    FileSize = (UINTN) Info->FileSize;\r
+    FileSize = (UINTN)Info->FileSize;\r
 \r
     FreePool (Info);\r
   } else if (Status == EFI_NOT_FOUND) {\r
@@ -379,10 +380,12 @@ ReadFileIntoBuffer (
       if (Status == EFI_WARN_DELETE_FAILURE) {\r
         Status = EFI_ACCESS_DENIED;\r
       }\r
+\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
     }\r
+\r
     //\r
     // file doesn't exist, so set CreateFile to TRUE and can't be read-only\r
     //\r
@@ -401,21 +404,23 @@ ReadFileIntoBuffer (
     if (InternalBuffer == NULL) {\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
+\r
     //\r
     // read file into InternalBuffer\r
     //\r
     Status = ShellReadFile (FileHandle, &FileSize, InternalBuffer);\r
-    ShellCloseFile(&FileHandle);\r
+    ShellCloseFile (&FileHandle);\r
     FileHandle = NULL;\r
     if (EFI_ERROR (Status)) {\r
       SHELL_FREE_NON_NULL (InternalBuffer);\r
       return EFI_LOAD_ERROR;\r
     }\r
   }\r
+\r
   *Buffer = InternalBuffer;\r
   if (BufferSize != NULL) {\r
     *BufferSize = FileSize;\r
   }\r
-  return (EFI_SUCCESS);\r
 \r
+  return (EFI_SUCCESS);\r
 }\r