]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
ShellPkg/UefiShellDebug1CommandsLib: Remove unnecessary EFIAPI
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / BufferImage.c
index 57c4a9c739f29e0a17dd637f1c5977f007a51a2e..68d2443d2e5ed7f57dfb2fc7782fd2d74d81221d 100644 (file)
@@ -2,7 +2,7 @@
   Defines HBufferImage - the view of the file that is visible at any point,\r
   as well as the event handlers for editing the file\r
   \r
-  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2005 - 2014, 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
@@ -184,7 +184,7 @@ HBufferImageBackup (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**
+/**\r
   Free all the lines in HBufferImage.\r
     Fields affected:\r
     Lines\r
@@ -318,9 +318,9 @@ HBufferImagePrintLine (
     }\r
 \r
     if (BeNewColor) {\r
-      gST->ConOut->SetAttribute (gST->ConOut, New.Data);\r
+      gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);\r
     } else {\r
-      gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);\r
+      gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);\r
     }\r
 \r
     Pos = 10 + (Index * 3);\r
@@ -337,7 +337,7 @@ HBufferImagePrintLine (
 \r
   }\r
 \r
-  gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);\r
+  gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);\r
   while (Index < 0x08) {\r
     Pos = 10 + (Index * 3);\r
     ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"    ");\r
@@ -355,9 +355,9 @@ HBufferImagePrintLine (
     }\r
 \r
     if (BeNewColor) {\r
-      gST->ConOut->SetAttribute (gST->ConOut, New.Data);\r
+      gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);\r
     } else {\r
-      gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);\r
+      gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);\r
     }\r
 \r
     Pos = 10 + (Index * 3) + 1;\r
@@ -370,7 +370,7 @@ HBufferImagePrintLine (
     Index++;\r
   }\r
 \r
-  gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);\r
+  gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);\r
   while (Index < 0x10) {\r
     Pos = 10 + (Index * 3) + 1;\r
     ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"   ");\r
@@ -379,7 +379,7 @@ HBufferImagePrintLine (
   //\r
   // restore the original color\r
   //\r
-  gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);\r
+  gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);\r
 \r
   //\r
   // PRINT the buffer content\r
@@ -580,8 +580,9 @@ HBufferImageRestoreMousePosition (
       // backup the old screen attributes\r
       //\r
       Orig                  = HMainEditor.ColorAttributes;\r
-      New.Colors.Foreground = Orig.Colors.Background;\r
-      New.Colors.Background = Orig.Colors.Foreground;\r
+      New.Data              = 0;\r
+      New.Colors.Foreground = Orig.Colors.Background & 0xF;\r
+      New.Colors.Background = Orig.Colors.Foreground & 0x7;\r
 \r
       //\r
       // if in selected area,\r
@@ -593,7 +594,7 @@ HBufferImageRestoreMousePosition (
             )) {\r
         gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);\r
       } else {\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
@@ -645,7 +646,7 @@ HBufferImageRestoreMousePosition (
             HBufferImage.MousePosition.Row,\r
             HBufferImage.MousePosition.Column\r
             )) {\r
-        gST->ConOut->SetAttribute (gST->ConOut, New.Data);\r
+        gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);\r
       } else {\r
         gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);\r
       }\r
@@ -731,7 +732,7 @@ HBufferImageRestorePosition (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**
+/**\r
   Refresh function for HBufferImage.\r
 \r
   @retval EFI_SUCCESS     The operation was successful.\r
@@ -752,10 +753,10 @@ HBufferImageRefresh (
   UINTN                   StartRow;\r
   UINTN                   EndRow;\r
   UINTN                   FStartRow;\r
-  UINTN                   FEndRow;\r
   UINTN                   Tmp;\r
 \r
   Orig                  = HMainEditor.ColorAttributes;\r
+  New.Data              = 0;\r
   New.Colors.Foreground = Orig.Colors.Background;\r
   New.Colors.Background = Orig.Colors.Foreground;\r
 \r
@@ -821,7 +822,6 @@ HBufferImageRefresh (
       }\r
 \r
       FStartRow = StartRow;\r
-      FEndRow   = EndRow;\r
 \r
       StartRow  = 2 + StartRow - HBufferImage.LowVisibleRow;\r
       EndRow    = 2 + EndRow - HBufferImage.LowVisibleRow;\r
@@ -832,7 +832,7 @@ HBufferImageRefresh (
       //\r
       FStartRow = HBufferImage.LowVisibleRow;\r
       StartRow  = 2;\r
-      EndRow    = (HMainEditor.ScreenSize.Row - 4);\r
+      EndRow    = (HMainEditor.ScreenSize.Row - 1);\r
     }\r
     //\r
     // no line\r
@@ -906,7 +906,6 @@ HBufferImageRefresh (
   @return EFI_SUCCESS     The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 HBufferImageRead (\r
   IN CONST CHAR16                   *FileName,\r
   IN CONST CHAR16                   *DiskName,\r
@@ -1027,7 +1026,7 @@ HBufferImageSave (
   return Status;\r
 }\r
 \r
-/**
+/**\r
   Create a new line and append it to the line list.\r
     Fields affected:\r
     NumLines\r
@@ -1074,7 +1073,7 @@ HBufferImageCreateLine (
   return Line;\r
 }\r
 \r
-/**
+/**\r
   Free the current image.\r
 \r
   @retval EFI_SUCCESS   The operation was successful.\r
@@ -1092,7 +1091,7 @@ HBufferImageFree (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**
+/**\r
   change char to int value based on Hex.\r
 \r
   @param[in] Char     The input char.\r
@@ -1101,7 +1100,6 @@ HBufferImageFree (
   @retval -1  The operation failed.\r
 **/\r
 INTN\r
-EFIAPI\r
 HBufferImageCharToHex (\r
   IN CHAR16 Char\r
   )\r
@@ -1133,7 +1131,6 @@ HBufferImageCharToHex (
   @retval EFI_OUT_OF_RESOURCES    A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 HBufferImageAddChar (\r
   IN  CHAR16  Char\r
   )\r
@@ -1264,7 +1261,6 @@ HBufferImageAddChar (
   @retval EFI_SUCCESS   The operationw as successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 HBufferImageDoBackspace (\r
   VOID\r
   )\r
@@ -1328,7 +1324,6 @@ HBufferImageDoBackspace (
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 HBufferImageDoCharInput (\r
   IN  CHAR16  Char\r
   )\r
@@ -1404,7 +1399,7 @@ HUnderCurrentScreen (
   IN  UINTN FileRow\r
   )\r
 {\r
-  if (FileRow > HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 5) - 1) {\r
+  if (FileRow > HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 2) - 1) {\r
     return TRUE;\r
   }\r
 \r
@@ -1712,8 +1707,8 @@ HBufferImagePageDown (
   //\r
   // has next page\r
   //\r
-  if (HBufferImage.NumLines >= FRow + (HMainEditor.ScreenSize.Row - 5)) {\r
-    Gap = (HMainEditor.ScreenSize.Row - 5);\r
+  if (HBufferImage.NumLines >= FRow + (HMainEditor.ScreenSize.Row - 2)) {\r
+    Gap = (HMainEditor.ScreenSize.Row - 2);\r
   } else {\r
     //\r
     // MOVE CURSOR TO LAST LINE\r
@@ -1750,22 +1745,19 @@ HBufferImagePageUp (
   VOID\r
   )\r
 {\r
-  HEFI_EDITOR_LINE  *Line;\r
   UINTN             FRow;\r
   UINTN             FCol;\r
   UINTN             Gap;\r
   INTN              Retreat;\r
 \r
-  Line  = HBufferImage.CurrentLine;\r
-\r
   FRow  = HBufferImage.BufferPosition.Row;\r
   FCol  = HBufferImage.BufferPosition.Column;\r
 \r
   //\r
   // has previous page\r
   //\r
-  if (FRow > (HMainEditor.ScreenSize.Row - 5)) {\r
-    Gap = (HMainEditor.ScreenSize.Row - 5);\r
+  if (FRow > (HMainEditor.ScreenSize.Row - 2)) {\r
+    Gap = (HMainEditor.ScreenSize.Row - 2);\r
   } else {\r
     //\r
     // the first line of file will displayed on the first line of screen\r
@@ -1776,11 +1768,6 @@ HBufferImagePageUp (
   Retreat = Gap;\r
   Retreat = -Retreat;\r
 \r
-  //\r
-  // get correct line\r
-  //\r
-  Line = HMoveLine (Retreat);\r
-\r
   FRow -= Gap;\r
 \r
   HBufferImageMovePosition (FRow, FCol, HBufferImage.HighBits);\r
@@ -1798,13 +1785,10 @@ HBufferImageHome (
   VOID\r
   )\r
 {\r
-  HEFI_EDITOR_LINE  *Line;\r
   UINTN             FRow;\r
   UINTN             FCol;\r
   BOOLEAN           HighBits;\r
 \r
-  Line = HBufferImage.CurrentLine;\r
-\r
   //\r
   // curosr will at the high bit\r
   //\r
@@ -1918,7 +1902,6 @@ HBufferImageDeleteCharacterFromBuffer (
 \r
   HEFI_EDITOR_LINE  *Line;\r
   LIST_ENTRY    *Link;\r
-  UINTN             StartRow;\r
 \r
   UINTN             OldFCol;\r
   UINTN             OldFRow;\r
@@ -1928,11 +1911,6 @@ HBufferImageDeleteCharacterFromBuffer (
 \r
   EFI_STATUS        Status;\r
 \r
-  //\r
-  // get the line that start position is at\r
-  //\r
-  StartRow  = Pos / 0x10;\r
-\r
   Size      = HBufferImageGetTotalSize ();\r
 \r
   if (Size < Count) {\r
@@ -2054,7 +2032,6 @@ HBufferImageAddCharacterToBuffer (
   HEFI_EDITOR_LINE  *Line;\r
 \r
   LIST_ENTRY    *Link;\r
-  UINTN             StartRow;\r
 \r
   UINTN             OldFCol;\r
   UINTN             OldFRow;\r
@@ -2062,11 +2039,6 @@ HBufferImageAddCharacterToBuffer (
 \r
   UINTN             NewPos;\r
 \r
-  //\r
-  // get the line that start position is at\r
-  //\r
-  StartRow  = Pos / 0x10;\r
-\r
   Size      = HBufferImageGetTotalSize ();\r
 \r
   //\r
@@ -2142,7 +2114,6 @@ HBufferImageAddCharacterToBuffer (
   @retval EFI_SUCCESS   The operationw as successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 HBufferImageDoDelete (\r
   VOID\r
   )\r
@@ -2203,7 +2174,6 @@ HBufferImageDoDelete (
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 HBufferImageBufferToList (\r
   IN VOID   *Buffer,\r
   IN UINTN  Bytes\r
@@ -2268,7 +2238,6 @@ HBufferImageBufferToList (
   @retval EFI_SUCCESS   The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 HBufferImageListToBuffer (\r
   IN VOID   *Buffer,\r
   IN UINTN  Bytes\r
@@ -2323,7 +2292,6 @@ HBufferImageListToBuffer (
   @param[in] TextY    The y-coordinate.\r
 **/\r
 VOID\r
-EFIAPI\r
 HBufferImageAdjustMousePosition (\r
   IN INT32 TextX,\r
   IN INT32 TextY\r
@@ -2392,12 +2360,12 @@ HBufferImageAdjustMousePosition (
   // check whether new mouse row position is beyond screen\r
   // if not, adjust it\r
   //\r
-  if (TempY >= 2 && TempY <= (HMainEditor.ScreenSize.Row - 4)) {\r
+  if (TempY >= 2 && TempY <= (HMainEditor.ScreenSize.Row - 1)) {\r
     HBufferImage.MousePosition.Row = TempY;\r
   } else if (TempY < 2) {\r
     HBufferImage.MousePosition.Row = 2;\r
-  } else if (TempY > (HMainEditor.ScreenSize.Row - 4)) {\r
-    HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 4);\r
+  } else if (TempY > (HMainEditor.ScreenSize.Row - 1)) {\r
+    HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 1);\r
   }\r
 \r
 }\r