diff options
Diffstat (limited to 'C/LzmaDec.h')
-rwxr-xr-x | C/LzmaDec.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/C/LzmaDec.h b/C/LzmaDec.h index 9610f0ec..be594a1c 100755 --- a/C/LzmaDec.h +++ b/C/LzmaDec.h @@ -1,12 +1,12 @@ /* LzmaDec.h -- LZMA Decoder -2008-04-29 +2008-08-05 Copyright (c) 1999-2008 Igor Pavlov You can use any of the following license options: 1) GNU Lesser General Public License (GNU LGPL) 2) Common Public License (CPL) - 3) Common Development and Distribution License (CDDL) Version 1.0 - 4) Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to this file, + 3) Common Development and Distribution License (CDDL) Version 1.0 + 4) Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to this file, while you keep this file unmodified. */ @@ -16,7 +16,7 @@ You can use any of the following license options: #include "Types.h" /* #define _LZMA_PROB32 */ -/* _LZMA_PROB32 can increase the speed on some CPUs, +/* _LZMA_PROB32 can increase the speed on some CPUs, but memory usage for CLzmaDec::probs will be doubled in that case */ #ifdef _LZMA_PROB32 @@ -26,7 +26,7 @@ You can use any of the following license options: #endif -/* ---------- LZMA Properties ---------- */ +/* ---------- LZMA Properties ---------- */ #define LZMA_PROPS_SIZE 5 @@ -45,7 +45,7 @@ Returns: SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); -/* ---------- LZMA Decoder state ---------- */ +/* ---------- 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; */ @@ -81,15 +81,15 @@ void LzmaDec_Init(CLzmaDec *p); 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. 1) 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_ANY, /* finish at any point */ LZMA_FINISH_END /* block must be finished at the end */ } ELzmaFinishMode; /* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! - You must use LZMA_FINISH_END, when you know that current output buffer + You must use LZMA_FINISH_END, when you know that current output buffer covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, @@ -99,36 +99,36 @@ typedef enum You can use multiple checks to test data integrity after full decompression: 1) Check Result and "status" variable. 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. - 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. - You must use correct finish mode in that case. */ + 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 */ - LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ + LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ } ELzmaStatus; /* ELzmaStatus is used only as output value for function call */ -/* ---------- Interfaces ---------- */ +/* ---------- Interfaces ---------- */ /* There are 3 levels of interfaces: 1) Dictionary Interface 2) Buffer Interface 3) One Call Interface - You can select any of these interfaces, but don't mix functions from different + 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 - You can use variant 2, if you set dictionary buffer manually. - For Buffer Interface you must always use variant 1. + You can use variant 2, if you set dictionary buffer manually. + For Buffer Interface you must always use variant 1. LzmaDec_Allocate* can return: SZ_OK @@ -142,9 +142,9 @@ void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); -/* ---------- Dictionary Interface ---------- */ +/* ---------- Dictionary Interface ---------- */ -/* You can use it, if you want to eliminate the overhead for data copying from +/* You can use it, if you want to eliminate the overhead for data copying from dictionary to some other external buffer. You must work with CLzmaDec variables directly in this interface. @@ -166,7 +166,7 @@ void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); /* LzmaDec_DecodeToDic The decoding to internal dictionary buffer (CLzmaDec::dic). - You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! + You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! finishMode: It has meaning only if the decoding reaches output limit (dicLimit). @@ -177,34 +177,34 @@ Returns: SZ_OK status: LZMA_STATUS_FINISHED_WITH_MARK - LZMA_STATUS_NOT_FINISHED + LZMA_STATUS_NOT_FINISHED LZMA_STATUS_NEEDS_MORE_INPUT LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK SZ_ERROR_DATA - Data error */ -SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, +SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -/* ---------- Buffer Interface ---------- */ +/* ---------- Buffer Interface ---------- */ /* It's zlib-like interface. See LzmaDec_DecodeToDic description for information about STEPS and return results, but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need to work with CLzmaDec variables manually. -finishMode: +finishMode: It has meaning only if the decoding reaches output limit (*destLen). LZMA_FINISH_ANY - Decode just destLen bytes. LZMA_FINISH_END - Stream must be finished after (*destLen). */ -SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, +SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); -/* ---------- One Call Interface ---------- */ +/* ---------- One Call Interface ---------- */ /* LzmaDecode @@ -217,7 +217,7 @@ Returns: SZ_OK status: LZMA_STATUS_FINISHED_WITH_MARK - LZMA_STATUS_NOT_FINISHED + LZMA_STATUS_NOT_FINISHED LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK SZ_ERROR_DATA - Data error SZ_ERROR_MEM - Memory allocation error @@ -226,7 +226,7 @@ Returns: */ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, - const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, + const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc); #endif |