summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseUefiDecompressLib
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-15 11:12:43 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-15 11:12:43 +0000
commiteceb3a4cb9b97d331ba91ea0a930465c05e8e20b (patch)
tree2f30cbf356491a3bea738c3facb2c37d056ffd66 /MdePkg/Library/BaseUefiDecompressLib
parent329d3f3d01b5470a2311ada36e36664519eb3447 (diff)
downloadedk2-platforms-eceb3a4cb9b97d331ba91ea0a930465c05e8e20b.tar.xz
Code scrub for the Debug library, PostCode library, Print library, and ExtractGuidedSection library.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5478 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseUefiDecompressLib')
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c46
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h17
2 files changed, 33 insertions, 30 deletions
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
index fefa765d7e..feba9fdd6d 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
@@ -1,7 +1,7 @@
/** @file
- UEFI Decompress Library.
+ UEFI Decompress Library implementation refer to UEFI specification.
- Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -23,7 +23,7 @@
#include "BaseUefiDecompressLibInternals.h"
/**
- Read NumOfBit of bits from source into mBitBuf
+ Read NumOfBit of bits from source into mBitBuf.
Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
@@ -79,7 +79,7 @@ FillBuf (
}
/**
- Get NumOfBits of bits out from mBitBuf
+ Get NumOfBits of bits out from mBitBuf.
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
NumOfBits of bits from source. Returns NumOfBits of bits that are
@@ -122,7 +122,7 @@ GetBits (
@param NumOfChar Number of symbols in the symbol set
@param BitLen Code length array
@param TableBits The width of the mapping table
- @param Table The table
+ @param Table The table to be created
@retval 0 OK.
@retval BAD_TABLE The table is corrupted.
@@ -225,7 +225,7 @@ MakeTable (
*Pointer = Avail++;
}
- if (Index3 & Mask) {
+ if ((Index3 & Mask) != 0) {
Pointer = &Sd->mRight[*Pointer];
} else {
Pointer = &Sd->mLeft[*Pointer];
@@ -273,7 +273,7 @@ DecodeP (
do {
- if (Sd->mBitBuf & Mask) {
+ if ((Sd->mBitBuf & Mask) != 0) {
Val = Sd->mRight[Val];
} else {
Val = Sd->mLeft[Val];
@@ -542,7 +542,7 @@ DecodeC (
Mask = 1U << (BITBUFSIZ - 1 - 12);
do {
- if (Sd->mBitBuf & Mask) {
+ if ((Sd->mBitBuf & Mask) != 0) {
Index2 = Sd->mRight[Index2];
} else {
Index2 = Sd->mLeft[Index2];
@@ -561,9 +561,7 @@ DecodeC (
/**
Decode the source data and put the resulting data into the destination buffer.
-
- Decode the source data and put the resulting data into the destination buffer.
-
+
@param Sd The global scratch data
**/
@@ -638,7 +636,9 @@ Done:
}
/**
- Retrieves the size of the uncompressed buffer and the size of the scratch buffer.
+ Given a compressed source buffer, this function retrieves the size of
+ the uncompressed buffer and the size of the scratch buffer required
+ to decompress the compressed source buffer.
Retrieves the size of the uncompressed buffer and the temporary scratch buffer
required to decompress the buffer specified by Source and SourceSize.
@@ -665,10 +665,14 @@ Done:
is required to decompress the compressed buffer specified
by Source and SourceSize.
- @retval RETURN_SUCCESS The size of destination buffer and the size of scratch
- buffer are successull retrieved.
- @retval RETURN_INVALID_PARAMETER The source data is corrupted
-
+ @retval RETURN_SUCCESS The size of the uncompressed data was returned
+ in DestinationSize and the size of the scratch
+ buffer was returned in ScratchSize.
+ @retval RETURN_INVALID_PARAMETER
+ The size of the uncompressed data or the size of
+ the scratch buffer cannot be determined from
+ the compressed data specified by Source
+ and SourceSize.
**/
RETURN_STATUS
EFIAPI
@@ -704,6 +708,7 @@ UefiDecompressGetInfo (
/**
Decompresses a compressed source buffer.
+ Extracts decompressed data to its original form.
This function is designed so that the decompression algorithm can be implemented
without using any memory services. As a result, this function is not allowed to
call any memory allocation services in its implementation. It is the caller's r
@@ -723,9 +728,11 @@ UefiDecompressGetInfo (
This is an optional parameter that may be NULL if the
required scratch buffer size is 0.
- @retval RETURN_SUCCESS Decompression is successfull
- @retval RETURN_INVALID_PARAMETER The source data is corrupted
-
+ @retval RETURN_SUCCESS Decompression completed successfully, and
+ the uncompressed buffer is returned in Destination.
+ @retval RETURN_INVALID_PARAMETER
+ The source buffer specified by Source is corrupted
+ (not in a valid compressed format).
**/
RETURN_STATUS
EFIAPI
@@ -769,7 +776,6 @@ UefiDecompress (
//
// The length of the field 'Position Set Code Length Array Size' in Block Header.
// For UEFI 2.0 de/compression algorithm(Version 1), mPBit = 4
- // For Tiano de/compression algorithm(Version 2), mPBit = 5
//
Sd->mPBit = 4;
Sd->mSrcBase = (UINT8 *)Src;
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h
index 84638866b5..57a44a502f 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h
@@ -1,7 +1,7 @@
/** @file
- Internal include file for Base UEFI Decompress Libary.
+ Internal data structure defintions for Base UEFI Decompress Libary.
- Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -40,8 +40,8 @@
#endif
typedef struct {
- UINT8 *mSrcBase; ///< Starting address of compressed data
- UINT8 *mDstBase; ///< Starting address of decompressed data
+ UINT8 *mSrcBase; // Starting address of compressed data
+ UINT8 *mDstBase; // Starting address of decompressed data
UINT32 mOutBuf;
UINT32 mInBuf;
@@ -64,13 +64,12 @@ typedef struct {
///
/// The length of the field 'Position Set Code Length Array Size' in Block Header.
/// For UEFI 2.0 de/compression algorithm, mPBit = 4
- /// For Tiano de/compression algorithm, mPBit = 5
///
UINT8 mPBit;
} SCRATCH_DATA;
/**
- Read NumOfBit of bits from source into mBitBuf
+ Read NumOfBit of bits from source into mBitBuf.
Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
@@ -85,7 +84,7 @@ FillBuf (
);
/**
- Get NumOfBits of bits out from mBitBuf
+ Get NumOfBits of bits out from mBitBuf.
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
NumOfBits of bits from source. Returns NumOfBits of bits that are
@@ -113,7 +112,7 @@ GetBits (
@param NumOfChar Number of symbols in the symbol set
@param BitLen Code length array
@param TableBits The width of the mapping table
- @param Table The table
+ @param Table The table to be created.
@retval 0 OK.
@retval BAD_TABLE The table is corrupted.
@@ -200,8 +199,6 @@ DecodeC (
/**
Decode the source data and put the resulting data into the destination buffer.
- Decode the source data and put the resulting data into the destination buffer.
-
@param Sd The global scratch data
**/