]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
Code scrub for the Debug library, PostCode library, Print library, and ExtractGuidedS...
[mirror_edk2.git] / MdePkg / Library / BaseUefiDecompressLib / BaseUefiDecompressLib.c
index fefa765d7e1da045e46e0c6fcfb825a35c36b538..feba9fdd6d7a194b74c430644a9218873e852975 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  UEFI Decompress Library.\r
+  UEFI Decompress Library implementation refer to UEFI specification.\r
 \r
-  Copyright (c) 2006, Intel Corporation\r
+  Copyright (c) 2006 - 2008, Intel Corporation\r
   All rights reserved. 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
@@ -23,7 +23,7 @@
 #include "BaseUefiDecompressLibInternals.h"\r
 \r
 /**\r
-  Read NumOfBit of bits from source into mBitBuf\r
+  Read NumOfBit of bits from source into mBitBuf.\r
 \r
   Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.\r
 \r
@@ -79,7 +79,7 @@ FillBuf (
 }\r
 \r
 /**\r
-  Get NumOfBits of bits out from mBitBuf\r
+  Get NumOfBits of bits out from mBitBuf.\r
 \r
   Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent \r
   NumOfBits of bits from source. Returns NumOfBits of bits that are \r
@@ -122,7 +122,7 @@ GetBits (
   @param  NumOfChar Number of symbols in the symbol set\r
   @param  BitLen    Code length array\r
   @param  TableBits The width of the mapping table\r
-  @param  Table     The table\r
+  @param  Table     The table to be created\r
 \r
   @retval  0 OK.\r
   @retval  BAD_TABLE The table is corrupted.\r
@@ -225,7 +225,7 @@ MakeTable (
           *Pointer = Avail++;\r
         }\r
 \r
-        if (Index3 & Mask) {\r
+        if ((Index3 & Mask) != 0) {\r
           Pointer = &Sd->mRight[*Pointer];\r
         } else {\r
           Pointer = &Sd->mLeft[*Pointer];\r
@@ -273,7 +273,7 @@ DecodeP (
 \r
     do {\r
 \r
-      if (Sd->mBitBuf & Mask) {\r
+      if ((Sd->mBitBuf & Mask) != 0) {\r
         Val = Sd->mRight[Val];\r
       } else {\r
         Val = Sd->mLeft[Val];\r
@@ -542,7 +542,7 @@ DecodeC (
     Mask = 1U << (BITBUFSIZ - 1 - 12);\r
 \r
     do {\r
-      if (Sd->mBitBuf & Mask) {\r
+      if ((Sd->mBitBuf & Mask) != 0) {\r
         Index2 = Sd->mRight[Index2];\r
       } else {\r
         Index2 = Sd->mLeft[Index2];\r
@@ -561,9 +561,7 @@ DecodeC (
 \r
 /**\r
   Decode the source data and put the resulting data into the destination buffer.\r
-\r
-  Decode the source data and put the resulting data into the destination buffer.\r
-  \r
\r
   @param  Sd The global scratch data\r
 \r
 **/\r
@@ -638,7 +636,9 @@ Done:
 }\r
 \r
 /**\r
-  Retrieves the size of the uncompressed buffer and the size of the scratch buffer.\r
+  Given a compressed source buffer, this function retrieves the size of \r
+  the uncompressed buffer and the size of the scratch buffer required \r
+  to decompress the compressed source buffer.\r
 \r
   Retrieves the size of the uncompressed buffer and the temporary scratch buffer \r
   required to decompress the buffer specified by Source and SourceSize.\r
@@ -665,10 +665,14 @@ Done:
                           is required to decompress the compressed buffer specified \r
                           by Source and SourceSize.\r
 \r
-  @retval  RETURN_SUCCESS The size of destination buffer and the size of scratch \r
-                          buffer are successull retrieved.\r
-  @retval  RETURN_INVALID_PARAMETER The source data is corrupted\r
-\r
+  @retval  RETURN_SUCCESS The size of the uncompressed data was returned \r
+                          in DestinationSize and the size of the scratch \r
+                          buffer was returned in ScratchSize.\r
+  @retval  RETURN_INVALID_PARAMETER \r
+                          The size of the uncompressed data or the size of \r
+                          the scratch buffer cannot be determined from \r
+                          the compressed data specified by Source \r
+                          and SourceSize.\r
 **/\r
 RETURN_STATUS\r
 EFIAPI\r
@@ -704,6 +708,7 @@ UefiDecompressGetInfo (
 /**\r
   Decompresses a compressed source buffer.\r
 \r
+  Extracts decompressed data to its original form.\r
   This function is designed so that the decompression algorithm can be implemented\r
   without using any memory services.  As a result, this function is not allowed to\r
   call any memory allocation services in its implementation.  It is the caller's r\r
@@ -723,9 +728,11 @@ UefiDecompressGetInfo (
                       This is an optional parameter that may be NULL if the \r
                       required scratch buffer size is 0.\r
                      \r
-  @retval  RETURN_SUCCESS Decompression is successfull\r
-  @retval  RETURN_INVALID_PARAMETER The source data is corrupted\r
-\r
+  @retval  RETURN_SUCCESS Decompression completed successfully, and \r
+                          the uncompressed buffer is returned in Destination.\r
+  @retval  RETURN_INVALID_PARAMETER \r
+                          The source buffer specified by Source is corrupted \r
+                          (not in a valid compressed format).\r
 **/\r
 RETURN_STATUS\r
 EFIAPI\r
@@ -769,7 +776,6 @@ UefiDecompress (
   //\r
   // The length of the field 'Position Set Code Length Array Size' in Block Header.\r
   // For UEFI 2.0 de/compression algorithm(Version 1), mPBit = 4\r
-  // For Tiano de/compression algorithm(Version 2), mPBit = 5\r
   //\r
   Sd->mPBit     = 4;\r
   Sd->mSrcBase  = (UINT8 *)Src;\r