summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.h
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.h')
-rw-r--r--MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.h153
1 files changed, 99 insertions, 54 deletions
diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.h b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.h
index ebc568cb4f..11f028876f 100644
--- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.h
+++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.h
@@ -9,6 +9,7 @@
EXTERN_C_BEGIN
/* #define _LZMA_PROB32 */
+
/* _LZMA_PROB32 can increase the speed on some CPUs,
but memory usage for CLzmaDec::probs will be doubled in that case */
@@ -20,18 +21,16 @@ typedef
#endif
CLzmaProb;
-
/* ---------- LZMA Properties ---------- */
-#define LZMA_PROPS_SIZE 5
+#define LZMA_PROPS_SIZE 5
-typedef struct _CLzmaProps
-{
- Byte lc;
- Byte lp;
- Byte pb;
- Byte _pad_;
- UInt32 dicSize;
+typedef struct _CLzmaProps {
+ Byte lc;
+ Byte lp;
+ Byte pb;
+ Byte _pad_;
+ UInt32 dicSize;
} CLzmaProps;
/* LzmaProps_Decode - decodes properties
@@ -40,49 +39,54 @@ Returns:
SZ_ERROR_UNSUPPORTED - Unsupported properties
*/
-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
-
+SRes
+LzmaProps_Decode (
+ CLzmaProps *p,
+ const Byte *data,
+ unsigned size
+ );
/* ---------- LZMA Decoder state ---------- */
/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
-#define LZMA_REQUIRED_INPUT_MAX 20
+#define LZMA_REQUIRED_INPUT_MAX 20
-typedef struct
-{
+typedef struct {
/* Don't change this structure. ASM code can use it. */
- CLzmaProps prop;
- CLzmaProb *probs;
- CLzmaProb *probs_1664;
- Byte *dic;
- SizeT dicBufSize;
- SizeT dicPos;
- const Byte *buf;
- UInt32 range;
- UInt32 code;
- UInt32 processedPos;
- UInt32 checkDicSize;
- UInt32 reps[4];
- UInt32 state;
- UInt32 remainLen;
-
- UInt32 numProbs;
- unsigned tempBufSize;
- Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
+ CLzmaProps prop;
+ CLzmaProb *probs;
+ CLzmaProb *probs_1664;
+ Byte *dic;
+ SizeT dicBufSize;
+ SizeT dicPos;
+ const Byte *buf;
+ UInt32 range;
+ UInt32 code;
+ UInt32 processedPos;
+ UInt32 checkDicSize;
+ UInt32 reps[4];
+ UInt32 state;
+ UInt32 remainLen;
+
+ UInt32 numProbs;
+ unsigned tempBufSize;
+ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
} CLzmaDec;
-#define LzmaDec_Construct(p) { (p)->dic = NULL; (p)->probs = NULL; }
+#define LzmaDec_Construct(p) { (p)->dic = NULL; (p)->probs = NULL; }
-void LzmaDec_Init(CLzmaDec *p);
+void
+LzmaDec_Init (
+ CLzmaDec *p
+ );
/* There are two types of LZMA streams:
- Stream with end mark. That end mark adds about 6 bytes to compressed size.
- Stream without end mark. You must know exact uncompressed size to decompress such stream. */
-typedef enum
-{
+typedef enum {
LZMA_FINISH_ANY, /* finish at any point */
LZMA_FINISH_END /* block must be finished at the end */
} ELzmaFinishMode;
@@ -102,8 +106,7 @@ typedef enum
3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
You must use correct finish mode in that case. */
-typedef enum
-{
+typedef enum {
LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
@@ -113,7 +116,6 @@ typedef enum
/* ELzmaStatus is used only as output value for function call */
-
/* ---------- Interfaces ---------- */
/* There are 3 levels of interfaces:
@@ -123,7 +125,6 @@ typedef enum
You can select any of these interfaces, but don't mix functions from different
groups for same object. */
-
/* There are two variants to allocate state for Dictionary Interface:
1) LzmaDec_Allocate / LzmaDec_Free
2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
@@ -136,11 +137,33 @@ LzmaDec_Allocate* can return:
SZ_ERROR_UNSUPPORTED - Unsupported properties
*/
-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAllocPtr alloc);
-
-SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
-void LzmaDec_Free(CLzmaDec *p, ISzAllocPtr alloc);
+SRes
+LzmaDec_AllocateProbs (
+ CLzmaDec *p,
+ const Byte *props,
+ unsigned propsSize,
+ ISzAllocPtr alloc
+ );
+
+void
+LzmaDec_FreeProbs (
+ CLzmaDec *p,
+ ISzAllocPtr alloc
+ );
+
+SRes
+LzmaDec_Allocate (
+ CLzmaDec *p,
+ const Byte *props,
+ unsigned propsSize,
+ ISzAllocPtr alloc
+ );
+
+void
+LzmaDec_Free (
+ CLzmaDec *p,
+ ISzAllocPtr alloc
+ );
/* ---------- Dictionary Interface ---------- */
@@ -183,9 +206,15 @@ Returns:
SZ_ERROR_DATA - Data error
*/
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
-
+SRes
+LzmaDec_DecodeToDic (
+ CLzmaDec *p,
+ SizeT dicLimit,
+ const Byte *src,
+ SizeT *srcLen,
+ ELzmaFinishMode finishMode,
+ ELzmaStatus *status
+ );
/* ---------- Buffer Interface ---------- */
@@ -200,9 +229,16 @@ finishMode:
LZMA_FINISH_END - Stream must be finished after (*destLen).
*/
-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
-
+SRes
+LzmaDec_DecodeToBuf (
+ CLzmaDec *p,
+ Byte *dest,
+ SizeT *destLen,
+ const Byte *src,
+ SizeT *srcLen,
+ ELzmaFinishMode finishMode,
+ ELzmaStatus *status
+ );
/* ---------- One Call Interface ---------- */
@@ -225,9 +261,18 @@ Returns:
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
*/
-SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
- const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
- ELzmaStatus *status, ISzAllocPtr alloc);
+SRes
+LzmaDecode (
+ Byte *dest,
+ SizeT *destLen,
+ const Byte *src,
+ SizeT *srcLen,
+ const Byte *propData,
+ unsigned propSize,
+ ELzmaFinishMode finishMode,
+ ELzmaStatus *status,
+ ISzAllocPtr alloc
+ );
EXTERN_C_END