]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c
ShellPkg/for: Fix potential null pointer deference
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / Compress.c
index b1f8327f4ab01ae7276a0d4a8ed3eefc18f78a41..736d2a35b3ac595de1232f1e533e60ec3d2ff256 100644 (file)
@@ -7,7 +7,7 @@
   This sequence is further divided into Blocks and Huffman codings\r
   are applied to each Block.\r
 \r
-  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 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
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
-\r
+#include <Uefi.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
-#include <ShellBase.h>\r
+#include <Library/ShellLib.h>\r
 \r
 //\r
 // Macro Definitions\r
@@ -67,7 +67,6 @@ typedef INT16             NODE;
   @param[in] Data    The dword to put.\r
 **/\r
 VOID\r
-EFIAPI\r
 PutDword(\r
   IN UINT32 Data\r
   );\r
@@ -127,7 +126,6 @@ INT32         mHuffmanDepth = 0;
 \r
 **/\r
 VOID\r
-EFIAPI\r
 MakeCrcTable (\r
   VOID\r
   )\r
@@ -158,7 +156,6 @@ MakeCrcTable (
   @param[in] Data    The dword to put.\r
 **/\r
 VOID\r
-EFIAPI\r
 PutDword (\r
   IN UINT32 Data\r
   )\r
@@ -187,7 +184,6 @@ PutDword (
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 AllocateMemory (\r
   VOID\r
   )\r
@@ -221,7 +217,6 @@ AllocateMemory (
 \r
 **/\r
 VOID\r
-EFIAPI\r
 FreeMemory (\r
   VOID\r
   )\r
@@ -240,7 +235,6 @@ FreeMemory (
   Initialize String Info Log data structures.\r
 **/\r
 VOID\r
-EFIAPI\r
 InitSlide (\r
   VOID\r
   )\r
@@ -272,7 +266,6 @@ InitSlide (
 \r
 **/\r
 NODE\r
-EFIAPI\r
 Child (\r
   IN NODE   LoopVar6,\r
   IN UINT8  LoopVar5\r
@@ -297,7 +290,6 @@ Child (
   @param[in] LoopVar4       The child node.\r
 **/\r
 VOID\r
-EFIAPI\r
 MakeChild (\r
   IN NODE   LoopVar6,\r
   IN UINT8  LoopVar5,\r
@@ -324,7 +316,6 @@ MakeChild (
   @param[in] Old     The node to split.\r
 **/\r
 VOID\r
-EFIAPI\r
 Split (\r
   IN NODE Old\r
   )\r
@@ -354,7 +345,6 @@ Split (
 \r
 **/\r
 VOID\r
-EFIAPI\r
 InsertNode (\r
   VOID\r
   )\r
@@ -483,7 +473,6 @@ InsertNode (
 \r
 **/\r
 VOID\r
-EFIAPI\r
 DeleteNode (\r
   VOID\r
   )\r
@@ -578,7 +567,6 @@ DeleteNode (
   @return The number of bytes actually read.\r
 **/\r
 INT32\r
-EFIAPI\r
 FreadCrc (\r
   OUT UINT8 *LoopVar7,\r
   IN  INT32 LoopVar8\r
@@ -611,7 +599,6 @@ FreadCrc (
   @retval FALSE     The operation failed due to insufficient memory.\r
 **/\r
 BOOLEAN\r
-EFIAPI\r
 GetNextMatch (\r
   VOID\r
   )\r
@@ -646,7 +633,6 @@ GetNextMatch (
   @param[in] LoopVar1    The index of the item to move.\r
 **/\r
 VOID\r
-EFIAPI\r
 DownHeap (\r
   IN INT32 i\r
   )\r
@@ -683,7 +669,6 @@ DownHeap (
   @param[in] LoopVar1      The top node.\r
 **/\r
 VOID\r
-EFIAPI\r
 CountLen (\r
   IN INT32 LoopVar1\r
   )\r
@@ -704,7 +689,6 @@ CountLen (
   @param[in] Root   The root of the tree.\r
 **/\r
 VOID\r
-EFIAPI\r
 MakeLen (\r
   IN INT32 Root\r
   )\r
@@ -760,7 +744,6 @@ MakeLen (
   @param[out] Code  The stores codes for each symbol.\r
 **/\r
 VOID\r
-EFIAPI\r
 MakeCode (\r
   IN  INT32         LoopVar8,\r
   IN  UINT8 Len[    ],\r
@@ -791,7 +774,6 @@ MakeCode (
   @return The root of the Huffman tree.\r
 **/\r
 INT32\r
-EFIAPI\r
 MakeTree (\r
   IN  INT32             NParm,\r
   IN  UINT16  FreqParm[ ],\r
@@ -875,7 +857,6 @@ MakeTree (
   @param[in] x   The data.\r
 **/\r
 VOID\r
-EFIAPI\r
 PutBits (\r
   IN INT32    LoopVar8,\r
   IN UINT32   x\r
@@ -914,7 +895,6 @@ PutBits (
   @param[in] LoopVar5     The number to encode.\r
 **/\r
 VOID\r
-EFIAPI\r
 EncodeC (\r
   IN INT32 LoopVar5\r
   )\r
@@ -928,7 +908,6 @@ EncodeC (
   @param[in] LoopVar7     The number to encode.\r
 **/\r
 VOID\r
-EFIAPI\r
 EncodeP (\r
   IN UINT32 LoopVar7\r
   )\r
@@ -955,7 +934,6 @@ EncodeP (
 \r
 **/\r
 VOID\r
-EFIAPI\r
 CountTFreq (\r
   VOID\r
   )\r
@@ -1013,7 +991,6 @@ CountTFreq (
 \r
 **/\r
 VOID\r
-EFIAPI\r
 WritePTLen (\r
   IN INT32 LoopVar8,\r
   IN INT32 nbit,\r
@@ -1052,7 +1029,6 @@ WritePTLen (
   Outputs the code length array for Char&Length Set.\r
 **/\r
 VOID\r
-EFIAPI\r
 WriteCLen (\r
   VOID\r
   )\r
@@ -1108,7 +1084,6 @@ WriteCLen (
 \r
 **/\r
 VOID\r
-EFIAPI\r
 SendBlock (\r
   VOID\r
   )\r
@@ -1182,7 +1157,6 @@ SendBlock (
 \r
 **/\r
 VOID\r
-EFIAPI\r
 HufEncodeStart (\r
   VOID\r
   )\r
@@ -1204,7 +1178,6 @@ HufEncodeStart (
   @param[in] LoopVar7     The 'Position' field of a Pointer.\r
 **/\r
 VOID\r
-EFIAPI\r
 CompressOutput (\r
   IN UINT32 LoopVar5,\r
   IN UINT32 LoopVar7\r
@@ -1242,7 +1215,6 @@ CompressOutput (
 \r
 **/\r
 VOID\r
-EFIAPI\r
 HufEncodeEnd (\r
   VOID\r
   )\r
@@ -1262,7 +1234,6 @@ HufEncodeEnd (
   @retval EFI_OUT_0F_RESOURCES  Not enough memory for compression process.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 Encode (\r
   VOID\r
   )\r
@@ -1345,7 +1316,6 @@ Encode (
   @retval EFI_BUFFER_TOO_SMALL  The buffer was too small.  DstSize is required.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 Compress (\r
   IN       VOID   *SrcBuffer,\r
   IN       UINT64 SrcSize,\r