]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
ShellPkg/UefiShellDebug1CommandsLib: Remove unnecessary EFIAPI
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / Edit / FileBuffer.c
index 897700bd341bd7a0b5e085fc8f2ac26314fe3cac..9713ccaf5083dd2f44cf553502cd28fe535db990 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implements filebuffer interface functions.\r
 \r
-  Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. <BR>\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
@@ -72,7 +72,6 @@ extern BOOLEAN          EditorMouseAction;
   @param EFI_OUT_OF_RESOURCES   A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferInit (\r
   VOID\r
   )\r
@@ -121,7 +120,6 @@ FileBufferInit (
   @retval EFI_SUCCESS           The backup operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferBackup (\r
   VOID\r
   )\r
@@ -155,7 +153,6 @@ FileBufferBackup (
   @return  The line structure after the advance.\r
 **/\r
 EFI_EDITOR_LINE *\r
-EFIAPI\r
 InternalEditorMiscLineAdvance (\r
   IN CONST UINTN            Count,\r
   IN CONST EFI_EDITOR_LINE  *CurrentLine,\r
@@ -195,7 +192,6 @@ InternalEditorMiscLineAdvance (
   @return  The line structure after the retreat.\r
 **/\r
 EFI_EDITOR_LINE *\r
-EFIAPI\r
 InternalEditorMiscLineRetreat (\r
   IN CONST UINTN            Count,\r
   IN CONST EFI_EDITOR_LINE  *CurrentLine,\r
@@ -262,7 +258,6 @@ MoveLine (
   @retval EFI_SUCCESS           The backup operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferRestoreMousePosition (\r
   VOID\r
   )\r
@@ -301,8 +296,8 @@ FileBufferRestoreMousePosition (
       //\r
       Orig                  = MainEditor.ColorAttributes;\r
       New.Data              = 0;\r
-      New.Colors.Foreground = Orig.Colors.Background;\r
-      New.Colors.Background = Orig.Colors.Foreground;\r
+      New.Colors.Foreground = Orig.Colors.Background & 0xF;\r
+      New.Colors.Background = Orig.Colors.Foreground & 0x7;\r
 \r
       //\r
       // clear the old mouse position\r
@@ -343,7 +338,7 @@ FileBufferRestoreMousePosition (
       //\r
       // set the new mouse position\r
       //\r
-      gST->ConOut->SetAttribute (gST->ConOut, New.Data);\r
+      gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);\r
 \r
       //\r
       // clear the old mouse position\r
@@ -406,7 +401,6 @@ FileBufferRestoreMousePosition (
   @retval EFI_SUCCESS     The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferFreeLines (\r
   VOID\r
   )\r
@@ -450,7 +444,6 @@ FileBufferFreeLines (
   @retval EFI_SUCCESS   The cleanup was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferCleanup (\r
   VOID\r
   )\r
@@ -505,29 +498,28 @@ FileBufferPrintLine (
 \r
   BufLen = (MainEditor.ScreenSize.Column + 1) * sizeof (CHAR16);\r
   PrintLine = AllocatePool (BufLen);\r
-  ASSERT (PrintLine != NULL);\r
-\r
-  StrnCpy (PrintLine, Buffer, MIN(Limit, MainEditor.ScreenSize.Column));\r
-  for (; Limit < MainEditor.ScreenSize.Column; Limit++) {\r
-    PrintLine[Limit] = L' ';\r
-  }\r
-\r
-  PrintLine[MainEditor.ScreenSize.Column] = CHAR_NULL;\r
-\r
-  PrintLine2 = AllocatePool (BufLen * 2);\r
-  ASSERT (PrintLine2 != NULL);\r
+  if (PrintLine != NULL) {\r
+    StrnCpyS (PrintLine, BufLen/sizeof(CHAR16), Buffer, MIN(Limit, MainEditor.ScreenSize.Column));\r
+    for (; Limit < MainEditor.ScreenSize.Column; Limit++) {\r
+      PrintLine[Limit] = L' ';\r
+    }\r
 \r
-  ShellCopySearchAndReplace(PrintLine, PrintLine2, BufLen * 2, L"%", L"^%", FALSE, FALSE);\r
+    PrintLine[MainEditor.ScreenSize.Column] = CHAR_NULL;\r
 \r
-  ShellPrintEx (\r
-    0,\r
-    (INT32)Row - 1,\r
-    L"%s",\r
-    PrintLine2\r
-    );\r
+    PrintLine2 = AllocatePool (BufLen * 2);\r
+    if (PrintLine2 != NULL) {\r
+      ShellCopySearchAndReplace(PrintLine, PrintLine2, BufLen * 2, L"%", L"^%", FALSE, FALSE);\r
 \r
-  FreePool (PrintLine);\r
-  FreePool (PrintLine2);\r
+      ShellPrintEx (\r
+        0,\r
+        (INT32)Row - 1,\r
+        L"%s",\r
+        PrintLine2\r
+        );\r
+      FreePool (PrintLine2);\r
+    }\r
+    FreePool (PrintLine);\r
+  }\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -538,7 +530,6 @@ FileBufferPrintLine (
   @retval EFI_SUCCESS           The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferRestorePosition (\r
   VOID\r
   )\r
@@ -560,7 +551,6 @@ FileBufferRestorePosition (
   @retval EFI_LOAD_ERROR  There was an error finding what to write.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferRefresh (\r
   VOID\r
   )\r
@@ -672,7 +662,6 @@ FileBufferRefresh (
   @return         The line created.\r
 **/\r
 EFI_EDITOR_LINE *\r
-EFIAPI\r
 FileBufferCreateLine (\r
   VOID\r
   )\r
@@ -727,7 +716,6 @@ FileBufferCreateLine (
   @retval EFI_INVALID_PARAMETER Str is not a valid filename.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferSetFileName (\r
   IN CONST CHAR16 *Str\r
   )\r
@@ -759,7 +747,6 @@ FileBufferSetFileName (
   @retval EFI_SUCCESS           The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferFree (\r
   VOID\r
   )\r
@@ -786,7 +773,6 @@ FileBufferFree (
   @retval EFI_INVALID_PARAMETER  FileName is a directory.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferRead (\r
   IN CONST CHAR16  *FileName,\r
   IN CONST BOOLEAN Recover\r
@@ -1281,7 +1267,6 @@ Done:
   @param[out] Size              The amount of the buffer used on return.\r
 **/\r
 VOID\r
-EFIAPI\r
 GetNewLine (\r
   IN CONST EE_NEWLINE_TYPE Type,\r
   OUT CHAR8           *Buffer,\r
@@ -1388,7 +1373,6 @@ GetNewLine (
   @return The actuall length.\r
 **/\r
 UINTN\r
-EFIAPI\r
 UnicodeToAscii (\r
   IN CONST CHAR16   *UStr,\r
   IN CONST UINTN    Length,\r
@@ -1417,7 +1401,6 @@ UnicodeToAscii (
   @retval EFI_OUT_OF_RESOURCES  There were not enough resources to write the file.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferSave (\r
   IN CONST CHAR16 *FileName\r
   )\r
@@ -1657,7 +1640,6 @@ FileBufferSave (
   @retval EFI_SUCCESS     The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferScrollLeft (\r
   VOID\r
   )\r
@@ -1704,7 +1686,6 @@ FileBufferScrollLeft (
   @param[in] Pos         Position to delete the char at ( start from 0 ).\r
 **/\r
 VOID\r
-EFIAPI\r
 LineDeleteAt (\r
   IN  OUT EFI_EDITOR_LINE       *Line,\r
   IN      UINTN                 Pos\r
@@ -1729,7 +1710,6 @@ LineDeleteAt (
   @param[in] Src         Src String.\r
 **/\r
 VOID\r
-EFIAPI\r
 LineCat (\r
   IN  OUT EFI_EDITOR_LINE *Dest,\r
   IN      EFI_EDITOR_LINE *Src\r
@@ -1770,7 +1750,6 @@ LineCat (
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferDoBackspace (\r
   VOID\r
   )\r
@@ -1842,7 +1821,6 @@ FileBufferDoBackspace (
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferDoReturn (\r
   VOID\r
   )\r
@@ -1939,7 +1917,6 @@ FileBufferDoReturn (
   @retval EFI_SUCCESS\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferDoDelete (\r
   VOID\r
   )\r
@@ -2002,7 +1979,6 @@ FileBufferDoDelete (
   @retval EFI_SUCCESS     The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferScrollRight (\r
   VOID\r
   )\r
@@ -2056,7 +2032,6 @@ FileBufferScrollRight (
   @return The new string size ( include CHAR_NULL ) ( unit is Unicode character ).\r
 **/\r
 UINTN\r
-EFIAPI\r
 LineStrInsert (\r
   IN      EFI_EDITOR_LINE  *Line,\r
   IN      CHAR16           Char,\r
@@ -2109,7 +2084,6 @@ LineStrInsert (
   @retval EFI_SUCCESS           The input was succesful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferAddChar (\r
   IN  CHAR16  Char\r
   )\r
@@ -2157,7 +2131,6 @@ FileBufferAddChar (
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferDoCharInput (\r
   IN CONST CHAR16 Char\r
   )\r
@@ -2208,7 +2181,6 @@ FileBufferDoCharInput (
   @retval EFI_SUCCESS     The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferScrollDown (\r
   VOID\r
   )\r
@@ -2254,7 +2226,6 @@ FileBufferScrollDown (
   @retval EFI_SUCCESS     The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferScrollUp (\r
   VOID\r
   )\r
@@ -2297,7 +2268,6 @@ FileBufferScrollUp (
   @retval EFI_SUCCESS     The operation wa successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferPageDown (\r
   VOID\r
   )\r
@@ -2348,7 +2318,6 @@ FileBufferPageDown (
   @retval EFI_SUCCESS     The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferPageUp (\r
   VOID\r
   )\r
@@ -2404,7 +2373,6 @@ FileBufferPageUp (
   @retval EFI_SUCCESS       The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferEnd (\r
   VOID\r
   )\r
@@ -2442,7 +2410,6 @@ FileBufferEnd (
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferHandleInput (\r
   IN CONST EFI_INPUT_KEY *Key\r
   )\r
@@ -2558,7 +2525,6 @@ FileBufferHandleInput (
   @retval FALSE   It is not above the current screen.\r
 **/\r
 BOOLEAN\r
-EFIAPI\r
 AboveCurrentScreen (\r
   IN UINTN FileRow\r
   )\r
@@ -2582,7 +2548,6 @@ AboveCurrentScreen (
   @retval FALSE     It is not under the current screen.\r
 **/\r
 BOOLEAN\r
-EFIAPI\r
 UnderCurrentScreen (\r
   IN UINTN FileRow\r
   )\r
@@ -2606,7 +2571,6 @@ UnderCurrentScreen (
   @retval FALSE   It is not to the left.\r
 **/\r
 BOOLEAN\r
-EFIAPI\r
 LeftCurrentScreen (\r
   IN UINTN FileCol\r
   )\r
@@ -2630,7 +2594,6 @@ LeftCurrentScreen (
   @retval FALSE   It is not to the right.\r
 **/\r
 BOOLEAN\r
-EFIAPI\r
 RightCurrentScreen (\r
   IN UINTN FileCol\r
   )\r
@@ -2656,7 +2619,6 @@ RightCurrentScreen (
   @return The line after advance/retreat.\r
 **/\r
 EFI_EDITOR_LINE *\r
-EFIAPI\r
 MoveCurrentLine (\r
   IN  INTN Count\r
   )\r
@@ -2687,7 +2649,6 @@ MoveCurrentLine (
   @param[in] NewFilePosCol    The column of file position ( start from 1 ).\r
 **/\r
 VOID\r
-EFIAPI\r
 FileBufferMovePosition (\r
   IN CONST UINTN NewFilePosRow,\r
   IN CONST UINTN NewFilePosCol\r
@@ -2803,7 +2764,6 @@ FileBufferMovePosition (
   @retval EFI_OUT_OF_RESOURCES    A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferCutLine (\r
   OUT EFI_EDITOR_LINE **CutLine\r
   )\r
@@ -2883,7 +2843,6 @@ FileBufferCutLine (
   @retval EFI_OUT_OF_RESOURCES    A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferPasteLine (\r
   VOID\r
   )\r
@@ -2955,7 +2914,6 @@ FileBufferPasteLine (
   @retval EFI_NOT_FOUND     The string Str was not found.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferSearch (\r
   IN CONST CHAR16  *Str,\r
   IN CONST UINTN Offset\r
@@ -3061,7 +3019,6 @@ FileBufferSearch (
   @retval EFI_OUT_OF_RESOURCES    A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferReplace (\r
   IN CONST CHAR16   *Replace,\r
   IN CONST UINTN    SearchLen\r
@@ -3166,7 +3123,6 @@ FileBufferReplace (
   @param[in] TextY      The new y-coordinate.\r
 **/\r
 VOID\r
-EFIAPI\r
 FileBufferAdjustMousePosition (\r
   IN CONST INT32 TextX,\r
   IN CONST INT32 TextY\r
@@ -3243,7 +3199,6 @@ FileBufferAdjustMousePosition (
   @param[in] Offset       The column to start at.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 FileBufferReplaceAll (\r
   IN CHAR16 *SearchStr,\r
   IN CHAR16 *ReplaceStr,\r
@@ -3361,7 +3316,6 @@ FileBufferReplaceAll (
   Set the modified state to TRUE.\r
 **/\r
 VOID\r
-EFIAPI\r
 FileBufferSetModified (\r
   VOID\r
   )\r