]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-lzma.patch
- updated for 4.4.8
[packages/rpm.git] / rpm-lzma.patch
CommitLineData
04f3bb4c 1--- /dev/null 2005-12-16 15:50:59.000000000 +0100
2+++ rpm-4.4.5/rpmio/LzmaDecode.c 2006-04-23 13:07:24.000000000 +0200
3@@ -0,0 +1,588 @@
4+/*
5+ LzmaDecode.c
6+ LZMA Decoder (optimized for Speed version)
7+
8+ LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10)
9+ http://www.7-zip.org/
10+
11+ LZMA SDK is licensed under two licenses:
12+ 1) GNU Lesser General Public License (GNU LGPL)
13+ 2) Common Public License (CPL)
14+ It means that you can select one of these two licenses and
15+ follow rules of that license.
16+
17+ SPECIAL EXCEPTION:
18+ Igor Pavlov, as the author of this Code, expressly permits you to
19+ statically or dynamically link your Code (or bind by name) to the
20+ interfaces of this file without subjecting your linked Code to the
21+ terms of the CPL or GNU LGPL. Any modifications or additions
22+ to this file, however, are subject to the LGPL or CPL terms.
23+*/
24+
25+#include "LzmaDecode.h"
26+
27+#ifndef Byte
28+#define Byte unsigned char
29+#endif
30+
31+#define kNumTopBits 24
32+#define kTopValue ((UInt32)1 << kNumTopBits)
33+
34+#define kNumBitModelTotalBits 11
35+#define kBitModelTotal (1 << kNumBitModelTotalBits)
36+#define kNumMoveBits 5
37+
38+#define RC_READ_BYTE (*Buffer++)
39+
40+#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
41+ { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
42+
43+#ifdef _LZMA_IN_CB
44+
45+#define RC_TEST { if (Buffer == BufferLim) \
46+ { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \
47+ BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }}
48+
49+#define RC_INIT Buffer = BufferLim = 0; RC_INIT2
50+
51+#else
52+
53+#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
54+
55+#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
56+
57+#endif
58+
59+#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
60+
61+#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
62+#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
63+#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
64+
65+#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
66+ { UpdateBit0(p); mi <<= 1; A0; } else \
67+ { UpdateBit1(p); mi = (mi + mi) + 1; A1; }
68+
69+#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
70+
71+#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
72+ { int i = numLevels; res = 1; \
73+ do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \
74+ res -= (1 << numLevels); }
75+
76+
77+#define kNumPosBitsMax 4
78+#define kNumPosStatesMax (1 << kNumPosBitsMax)
79+
80+#define kLenNumLowBits 3
81+#define kLenNumLowSymbols (1 << kLenNumLowBits)
82+#define kLenNumMidBits 3
83+#define kLenNumMidSymbols (1 << kLenNumMidBits)
84+#define kLenNumHighBits 8
85+#define kLenNumHighSymbols (1 << kLenNumHighBits)
86+
87+#define LenChoice 0
88+#define LenChoice2 (LenChoice + 1)
89+#define LenLow (LenChoice2 + 1)
90+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
91+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
92+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
93+
94+
95+#define kNumStates 12
96+#define kNumLitStates 7
97+
98+#define kStartPosModelIndex 4
99+#define kEndPosModelIndex 14
100+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
101+
102+#define kNumPosSlotBits 6
103+#define kNumLenToPosStates 4
104+
105+#define kNumAlignBits 4
106+#define kAlignTableSize (1 << kNumAlignBits)
107+
108+#define kMatchMinLen 2
109+
110+#define IsMatch 0
111+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
112+#define IsRepG0 (IsRep + kNumStates)
113+#define IsRepG1 (IsRepG0 + kNumStates)
114+#define IsRepG2 (IsRepG1 + kNumStates)
115+#define IsRep0Long (IsRepG2 + kNumStates)
116+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
117+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
118+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
119+#define LenCoder (Align + kAlignTableSize)
120+#define RepLenCoder (LenCoder + kNumLenProbs)
121+#define Literal (RepLenCoder + kNumLenProbs)
122+
123+#if Literal != LZMA_BASE_SIZE
124+StopCompilingDueBUG
125+#endif
126+
127+int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
128+{
129+ unsigned char prop0;
130+ if (size < LZMA_PROPERTIES_SIZE)
131+ return LZMA_RESULT_DATA_ERROR;
132+ prop0 = propsData[0];
133+ if (prop0 >= (9 * 5 * 5))
134+ return LZMA_RESULT_DATA_ERROR;
135+ {
136+ for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
137+ for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
138+ propsRes->lc = prop0;
139+ /*
140+ unsigned char remainder = (unsigned char)(prop0 / 9);
141+ propsRes->lc = prop0 % 9;
142+ propsRes->pb = remainder / 5;
143+ propsRes->lp = remainder % 5;
144+ */
145+ }
146+
147+ #ifdef _LZMA_OUT_READ
148+ {
149+ int i;
150+ propsRes->DictionarySize = 0;
151+ for (i = 0; i < 4; i++)
152+ propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8);
153+ if (propsRes->DictionarySize == 0)
154+ propsRes->DictionarySize = 1;
155+ }
156+ #endif
157+ return LZMA_RESULT_OK;
158+}
159+
160+#define kLzmaStreamWasFinishedId (-1)
161+
162+int LzmaDecode(CLzmaDecoderState *vs,
163+ #ifdef _LZMA_IN_CB
164+ ILzmaInCallback *InCallback,
165+ #else
166+ const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
167+ #endif
168+ unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
169+{
170+ CProb *p = vs->Probs;
171+ SizeT nowPos = 0;
172+ Byte previousByte = 0;
173+ UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
174+ UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
175+ int lc = vs->Properties.lc;
176+
177+ #ifdef _LZMA_OUT_READ
178+
179+ UInt32 Range = vs->Range;
180+ UInt32 Code = vs->Code;
181+ #ifdef _LZMA_IN_CB
182+ const Byte *Buffer = vs->Buffer;
183+ const Byte *BufferLim = vs->BufferLim;
184+ #else
185+ const Byte *Buffer = inStream;
186+ const Byte *BufferLim = inStream + inSize;
187+ #endif
188+ int state = vs->State;
189+ UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
190+ int len = vs->RemainLen;
191+ UInt32 globalPos = vs->GlobalPos;
192+ UInt32 distanceLimit = vs->DistanceLimit;
193+
194+ Byte *dictionary = vs->Dictionary;
195+ UInt32 dictionarySize = vs->Properties.DictionarySize;
196+ UInt32 dictionaryPos = vs->DictionaryPos;
197+
198+ Byte tempDictionary[4];
199+
200+ #ifndef _LZMA_IN_CB
201+ *inSizeProcessed = 0;
202+ #endif
203+ *outSizeProcessed = 0;
204+ if (len == kLzmaStreamWasFinishedId)
205+ return LZMA_RESULT_OK;
206+
207+ if (dictionarySize == 0)
208+ {
209+ dictionary = tempDictionary;
210+ dictionarySize = 1;
211+ tempDictionary[0] = vs->TempDictionary[0];
212+ }
213+
214+ if (len == kLzmaNeedInitId)
215+ {
216+ {
217+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
218+ UInt32 i;
219+ for (i = 0; i < numProbs; i++)
220+ p[i] = kBitModelTotal >> 1;
221+ rep0 = rep1 = rep2 = rep3 = 1;
222+ state = 0;
223+ globalPos = 0;
224+ distanceLimit = 0;
225+ dictionaryPos = 0;
226+ dictionary[dictionarySize - 1] = 0;
227+ #ifdef _LZMA_IN_CB
228+ RC_INIT;
229+ #else
230+ RC_INIT(inStream, inSize);
231+ #endif
232+ }
233+ len = 0;
234+ }
235+ while(len != 0 && nowPos < outSize)
236+ {
237+ UInt32 pos = dictionaryPos - rep0;
238+ if (pos >= dictionarySize)
239+ pos += dictionarySize;
240+ outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
241+ if (++dictionaryPos == dictionarySize)
242+ dictionaryPos = 0;
243+ len--;
244+ }
245+ if (dictionaryPos == 0)
246+ previousByte = dictionary[dictionarySize - 1];
247+ else
248+ previousByte = dictionary[dictionaryPos - 1];
249+
250+ #else /* if !_LZMA_OUT_READ */
251+
252+ int state = 0;
253+ UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
254+ int len = 0;
255+ const Byte *Buffer;
256+ const Byte *BufferLim;
257+ UInt32 Range;
258+ UInt32 Code;
259+
260+ #ifndef _LZMA_IN_CB
261+ *inSizeProcessed = 0;
262+ #endif
263+ *outSizeProcessed = 0;
264+
265+ {
266+ UInt32 i;
267+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
268+ for (i = 0; i < numProbs; i++)
269+ p[i] = kBitModelTotal >> 1;
270+ }
271+
272+ #ifdef _LZMA_IN_CB
273+ RC_INIT;
274+ #else
275+ RC_INIT(inStream, inSize);
276+ #endif
277+
278+ #endif /* _LZMA_OUT_READ */
279+
280+ while(nowPos < outSize)
281+ {
282+ CProb *prob;
283+ UInt32 bound;
284+ int posState = (int)(
285+ (nowPos
286+ #ifdef _LZMA_OUT_READ
287+ + globalPos
288+ #endif
289+ )
290+ & posStateMask);
291+
292+ prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
293+ IfBit0(prob)
294+ {
295+ int symbol = 1;
296+ UpdateBit0(prob)
297+ prob = p + Literal + (LZMA_LIT_SIZE *
298+ (((
299+ (nowPos
300+ #ifdef _LZMA_OUT_READ
301+ + globalPos
302+ #endif
303+ )
304+ & literalPosMask) << lc) + (previousByte >> (8 - lc))));
305+
306+ if (state >= kNumLitStates)
307+ {
308+ int matchByte;
309+ #ifdef _LZMA_OUT_READ
310+ UInt32 pos = dictionaryPos - rep0;
311+ if (pos >= dictionarySize)
312+ pos += dictionarySize;
313+ matchByte = dictionary[pos];
314+ #else
315+ matchByte = outStream[nowPos - rep0];
316+ #endif
317+ do
318+ {
319+ int bit;
320+ CProb *probLit;
321+ matchByte <<= 1;
322+ bit = (matchByte & 0x100);
323+ probLit = prob + 0x100 + bit + symbol;
324+ RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
325+ }
326+ while (symbol < 0x100);
327+ }
328+ while (symbol < 0x100)
329+ {
330+ CProb *probLit = prob + symbol;
331+ RC_GET_BIT(probLit, symbol)
332+ }
333+ previousByte = (Byte)symbol;
334+
335+ outStream[nowPos++] = previousByte;
336+ #ifdef _LZMA_OUT_READ
337+ if (distanceLimit < dictionarySize)
338+ distanceLimit++;
339+
340+ dictionary[dictionaryPos] = previousByte;
341+ if (++dictionaryPos == dictionarySize)
342+ dictionaryPos = 0;
343+ #endif
344+ if (state < 4) state = 0;
345+ else if (state < 10) state -= 3;
346+ else state -= 6;
347+ }
348+ else
349+ {
350+ UpdateBit1(prob);
351+ prob = p + IsRep + state;
352+ IfBit0(prob)
353+ {
354+ UpdateBit0(prob);
355+ rep3 = rep2;
356+ rep2 = rep1;
357+ rep1 = rep0;
358+ state = state < kNumLitStates ? 0 : 3;
359+ prob = p + LenCoder;
360+ }
361+ else
362+ {
363+ UpdateBit1(prob);
364+ prob = p + IsRepG0 + state;
365+ IfBit0(prob)
366+ {
367+ UpdateBit0(prob);
368+ prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
369+ IfBit0(prob)
370+ {
371+ #ifdef _LZMA_OUT_READ
372+ UInt32 pos;
373+ #endif
374+ UpdateBit0(prob);
375+
376+ #ifdef _LZMA_OUT_READ
377+ if (distanceLimit == 0)
378+ #else
379+ if (nowPos == 0)
380+ #endif
381+ return LZMA_RESULT_DATA_ERROR;
382+
383+ state = state < kNumLitStates ? 9 : 11;
384+ #ifdef _LZMA_OUT_READ
385+ pos = dictionaryPos - rep0;
386+ if (pos >= dictionarySize)
387+ pos += dictionarySize;
388+ previousByte = dictionary[pos];
389+ dictionary[dictionaryPos] = previousByte;
390+ if (++dictionaryPos == dictionarySize)
391+ dictionaryPos = 0;
392+ #else
393+ previousByte = outStream[nowPos - rep0];
394+ #endif
395+ outStream[nowPos++] = previousByte;
396+ #ifdef _LZMA_OUT_READ
397+ if (distanceLimit < dictionarySize)
398+ distanceLimit++;
399+ #endif
400+
401+ continue;
402+ }
403+ else
404+ {
405+ UpdateBit1(prob);
406+ }
407+ }
408+ else
409+ {
410+ UInt32 distance;
411+ UpdateBit1(prob);
412+ prob = p + IsRepG1 + state;
413+ IfBit0(prob)
414+ {
415+ UpdateBit0(prob);
416+ distance = rep1;
417+ }
418+ else
419+ {
420+ UpdateBit1(prob);
421+ prob = p + IsRepG2 + state;
422+ IfBit0(prob)
423+ {
424+ UpdateBit0(prob);
425+ distance = rep2;
426+ }
427+ else
428+ {
429+ UpdateBit1(prob);
430+ distance = rep3;
431+ rep3 = rep2;
432+ }
433+ rep2 = rep1;
434+ }
435+ rep1 = rep0;
436+ rep0 = distance;
437+ }
438+ state = state < kNumLitStates ? 8 : 11;
439+ prob = p + RepLenCoder;
440+ }
441+ {
442+ int numBits, offset;
443+ CProb *probLen = prob + LenChoice;
444+ IfBit0(probLen)
445+ {
446+ UpdateBit0(probLen);
447+ probLen = prob + LenLow + (posState << kLenNumLowBits);
448+ offset = 0;
449+ numBits = kLenNumLowBits;
450+ }
451+ else
452+ {
453+ UpdateBit1(probLen);
454+ probLen = prob + LenChoice2;
455+ IfBit0(probLen)
456+ {
457+ UpdateBit0(probLen);
458+ probLen = prob + LenMid + (posState << kLenNumMidBits);
459+ offset = kLenNumLowSymbols;
460+ numBits = kLenNumMidBits;
461+ }
462+ else
463+ {
464+ UpdateBit1(probLen);
465+ probLen = prob + LenHigh;
466+ offset = kLenNumLowSymbols + kLenNumMidSymbols;
467+ numBits = kLenNumHighBits;
468+ }
469+ }
470+ RangeDecoderBitTreeDecode(probLen, numBits, len);
471+ len += offset;
472+ }
473+
474+ if (state < 4)
475+ {
476+ int posSlot;
477+ state += kNumLitStates;
478+ prob = p + PosSlot +
479+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
480+ kNumPosSlotBits);
481+ RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
482+ if (posSlot >= kStartPosModelIndex)
483+ {
484+ int numDirectBits = ((posSlot >> 1) - 1);
485+ rep0 = (2 | ((UInt32)posSlot & 1));
486+ if (posSlot < kEndPosModelIndex)
487+ {
488+ rep0 <<= numDirectBits;
489+ prob = p + SpecPos + rep0 - posSlot - 1;
490+ }
491+ else
492+ {
493+ numDirectBits -= kNumAlignBits;
494+ do
495+ {
496+ RC_NORMALIZE
497+ Range >>= 1;
498+ rep0 <<= 1;
499+ if (Code >= Range)
500+ {
501+ Code -= Range;
502+ rep0 |= 1;
503+ }
504+ }
505+ while (--numDirectBits != 0);
506+ prob = p + Align;
507+ rep0 <<= kNumAlignBits;
508+ numDirectBits = kNumAlignBits;
509+ }
510+ {
511+ int i = 1;
512+ int mi = 1;
513+ do
514+ {
515+ CProb *prob3 = prob + mi;
516+ RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
517+ i <<= 1;
518+ }
519+ while(--numDirectBits != 0);
520+ }
521+ }
522+ else
523+ rep0 = posSlot;
524+ if (++rep0 == (UInt32)(0))
525+ {
526+ /* it's for stream version */
527+ len = kLzmaStreamWasFinishedId;
528+ break;
529+ }
530+ }
531+
532+ len += kMatchMinLen;
533+ #ifdef _LZMA_OUT_READ
534+ if (rep0 > distanceLimit)
535+ #else
536+ if (rep0 > nowPos)
537+ #endif
538+ return LZMA_RESULT_DATA_ERROR;
539+
540+ #ifdef _LZMA_OUT_READ
541+ if (dictionarySize - distanceLimit > (UInt32)len)
542+ distanceLimit += len;
543+ else
544+ distanceLimit = dictionarySize;
545+ #endif
546+
547+ do
548+ {
549+ #ifdef _LZMA_OUT_READ
550+ UInt32 pos = dictionaryPos - rep0;
551+ if (pos >= dictionarySize)
552+ pos += dictionarySize;
553+ previousByte = dictionary[pos];
554+ dictionary[dictionaryPos] = previousByte;
555+ if (++dictionaryPos == dictionarySize)
556+ dictionaryPos = 0;
557+ #else
558+ previousByte = outStream[nowPos - rep0];
559+ #endif
560+ len--;
561+ outStream[nowPos++] = previousByte;
562+ }
563+ while(len != 0 && nowPos < outSize);
564+ }
565+ }
566+ RC_NORMALIZE;
567+
568+ #ifdef _LZMA_OUT_READ
569+ vs->Range = Range;
570+ vs->Code = Code;
571+ vs->DictionaryPos = dictionaryPos;
572+ vs->GlobalPos = globalPos + (UInt32)nowPos;
573+ vs->DistanceLimit = distanceLimit;
574+ vs->Reps[0] = rep0;
575+ vs->Reps[1] = rep1;
576+ vs->Reps[2] = rep2;
577+ vs->Reps[3] = rep3;
578+ vs->State = state;
579+ vs->RemainLen = len;
580+ vs->TempDictionary[0] = tempDictionary[0];
581+ #endif
582+
583+ #ifdef _LZMA_IN_CB
584+ vs->Buffer = Buffer;
585+ vs->BufferLim = BufferLim;
586+ #else
587+ *inSizeProcessed = (SizeT)(Buffer - inStream);
588+ #endif
589+ *outSizeProcessed = nowPos;
590+ return LZMA_RESULT_OK;
591+}
592--- /dev/null 2005-12-16 15:50:59.000000000 +0100
593+++ rpm-4.4.5/rpmio/LzmaDecode.h 2006-04-23 13:25:41.000000000 +0200
594@@ -0,0 +1,131 @@
595+/*
596+ LzmaDecode.h
597+ LZMA Decoder interface
598+
599+ LZMA SDK 4.21 Copyright (c) 1999-2005 Igor Pavlov (2005-06-08)
600+ http://www.7-zip.org/
601+
602+ LZMA SDK is licensed under two licenses:
603+ 1) GNU Lesser General Public License (GNU LGPL)
604+ 2) Common Public License (CPL)
605+ It means that you can select one of these two licenses and
606+ follow rules of that license.
607+
608+ SPECIAL EXCEPTION:
609+ Igor Pavlov, as the author of this code, expressly permits you to
610+ statically or dynamically link your code (or bind by name) to the
611+ interfaces of this file without subjecting your linked code to the
612+ terms of the CPL or GNU LGPL. Any modifications or additions
613+ to this file, however, are subject to the LGPL or CPL terms.
614+*/
615+
616+#ifndef __LZMADECODE_H
617+#define __LZMADECODE_H
618+
619+#define _LZMA_IN_CB
620+/* Use callback for input data */
621+
622+#define _LZMA_OUT_READ
623+/* Use read function for output data */
624+
625+/* #define _LZMA_PROB32 */
626+/* It can increase speed on some 32-bit CPUs,
627+ but memory usage will be doubled in that case */
628+
629+/* #define _LZMA_LOC_OPT */
630+/* Enable local speed optimizations inside code */
631+
632+/* #define _LZMA_SYSTEM_SIZE_T */
633+/* Use system's size_t. You can use it to enable 64-bit sizes supporting*/
634+
635+#ifndef UInt32
636+#ifdef _LZMA_UINT32_IS_ULONG
637+#define UInt32 unsigned long
638+#else
639+#define UInt32 unsigned int
640+#endif
641+#endif
642+
643+#ifndef SizeT
644+#ifdef _LZMA_SYSTEM_SIZE_T
645+#include <stddef.h>
646+#define SizeT size_t
647+#else
648+#define SizeT UInt32
649+#endif
650+#endif
651+
652+#ifdef _LZMA_PROB32
653+#define CProb UInt32
654+#else
655+#define CProb unsigned short
656+#endif
657+
658+#define LZMA_RESULT_OK 0
659+#define LZMA_RESULT_DATA_ERROR 1
660+
661+#ifdef _LZMA_IN_CB
662+typedef struct _ILzmaInCallback
663+{
664+ int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize);
665+} ILzmaInCallback;
666+#endif
667+
668+#define LZMA_BASE_SIZE 1846
669+#define LZMA_LIT_SIZE 768
670+
671+#define LZMA_PROPERTIES_SIZE 5
672+
673+typedef struct _CLzmaProperties
674+{
675+ int lc;
676+ int lp;
677+ int pb;
678+ #ifdef _LZMA_OUT_READ
679+ UInt32 DictionarySize;
680+ #endif
681+}CLzmaProperties;
682+
683+int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
684+
685+#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
686+
687+#define kLzmaNeedInitId (-2)
688+
689+typedef struct _CLzmaDecoderState
690+{
691+ CLzmaProperties Properties;
692+ CProb *Probs;
693+
694+ #ifdef _LZMA_IN_CB
695+ const unsigned char *Buffer;
696+ const unsigned char *BufferLim;
697+ #endif
698+
699+ #ifdef _LZMA_OUT_READ
700+ unsigned char *Dictionary;
701+ UInt32 Range;
702+ UInt32 Code;
703+ UInt32 DictionaryPos;
704+ UInt32 GlobalPos;
705+ UInt32 DistanceLimit;
706+ UInt32 Reps[4];
707+ int State;
708+ int RemainLen;
709+ unsigned char TempDictionary[4];
710+ #endif
711+} CLzmaDecoderState;
712+
713+#ifdef _LZMA_OUT_READ
714+#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
715+#endif
716+
717+int LzmaDecode(CLzmaDecoderState *vs,
718+ #ifdef _LZMA_IN_CB
719+ ILzmaInCallback *inCallback,
720+ #else
721+ const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
722+ #endif
723+ unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
724+
725+#endif
This page took 0.152752 seconds and 4 git commands to generate.