1 --- a/include/linux/lzma/LzmaDec.h
2 +++ b/include/linux/lzma/LzmaDec.h
3 @@ -31,14 +31,6 @@ typedef struct _CLzmaProps
7 -/* LzmaProps_Decode - decodes properties
10 - SZ_ERROR_UNSUPPORTED - Unsupported properties
13 -SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
16 /* ---------- LZMA Decoder state ---------- */
18 @@ -70,8 +62,6 @@ typedef struct
20 #define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
22 -void LzmaDec_Init(CLzmaDec *p);
24 /* There are two types of LZMA streams:
25 0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
26 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
27 @@ -108,97 +98,6 @@ typedef enum
29 /* ELzmaStatus is used only as output value for function call */
32 -/* ---------- Interfaces ---------- */
34 -/* There are 3 levels of interfaces:
35 - 1) Dictionary Interface
37 - 3) One Call Interface
38 - You can select any of these interfaces, but don't mix functions from different
39 - groups for same object. */
42 -/* There are two variants to allocate state for Dictionary Interface:
43 - 1) LzmaDec_Allocate / LzmaDec_Free
44 - 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
45 - You can use variant 2, if you set dictionary buffer manually.
46 - For Buffer Interface you must always use variant 1.
48 -LzmaDec_Allocate* can return:
50 - SZ_ERROR_MEM - Memory allocation error
51 - SZ_ERROR_UNSUPPORTED - Unsupported properties
54 -SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
55 -void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
57 -SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
58 -void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
60 -/* ---------- Dictionary Interface ---------- */
62 -/* You can use it, if you want to eliminate the overhead for data copying from
63 - dictionary to some other external buffer.
64 - You must work with CLzmaDec variables directly in this interface.
69 - for (each new stream)
72 - while (it needs more decompression)
74 - LzmaDec_DecodeToDic()
75 - use data from CLzmaDec::dic and update CLzmaDec::dicPos
81 -/* LzmaDec_DecodeToDic
83 - The decoding to internal dictionary buffer (CLzmaDec::dic).
84 - You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
87 - It has meaning only if the decoding reaches output limit (dicLimit).
88 - LZMA_FINISH_ANY - Decode just dicLimit bytes.
89 - LZMA_FINISH_END - Stream must be finished after dicLimit.
94 - LZMA_STATUS_FINISHED_WITH_MARK
95 - LZMA_STATUS_NOT_FINISHED
96 - LZMA_STATUS_NEEDS_MORE_INPUT
97 - LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
98 - SZ_ERROR_DATA - Data error
101 -SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
102 - const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
105 -/* ---------- Buffer Interface ---------- */
107 -/* It's zlib-like interface.
108 - See LzmaDec_DecodeToDic description for information about STEPS and return results,
109 - but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
110 - to work with CLzmaDec variables manually.
113 - It has meaning only if the decoding reaches output limit (*destLen).
114 - LZMA_FINISH_ANY - Decode just destLen bytes.
115 - LZMA_FINISH_END - Stream must be finished after (*destLen).
118 -SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
119 - const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
122 /* ---------- One Call Interface ---------- */
125 --- a/lib/lzma/LzmaDec.c
126 +++ b/lib/lzma/LzmaDec.c
127 @@ -682,7 +682,7 @@ static void LzmaDec_InitRc(CLzmaDec *p,
131 -void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
132 +static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
136 @@ -698,7 +698,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p
137 p->needInitState = 1;
140 -void LzmaDec_Init(CLzmaDec *p)
141 +static void LzmaDec_Init(CLzmaDec *p)
144 LzmaDec_InitDicAndState(p, True, True);
145 @@ -716,7 +716,7 @@ static void LzmaDec_InitStateReal(CLzmaD
146 p->needInitState = 0;
149 -SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
150 +static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
151 ELzmaFinishMode finishMode, ELzmaStatus *status)
153 SizeT inSize = *srcLen;
154 @@ -837,7 +837,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si
155 return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
158 -SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
159 +static __maybe_unused SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
161 SizeT outSize = *destLen;
162 SizeT inSize = *srcLen;
163 @@ -877,7 +877,7 @@ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, By
167 -void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
168 +static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
170 alloc->Free(alloc, p->probs);
172 @@ -889,13 +889,13 @@ static void LzmaDec_FreeDict(CLzmaDec *p
176 -void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
177 +static void __maybe_unused LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
179 LzmaDec_FreeProbs(p, alloc);
180 LzmaDec_FreeDict(p, alloc);
183 -SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
184 +static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
188 @@ -935,7 +935,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma
192 -SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
193 +static SRes __maybe_unused LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
196 RINOK(LzmaProps_Decode(&propNew, props, propsSize));
197 @@ -944,7 +944,7 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p,
201 -SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
202 +static SRes __maybe_unused LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
206 --- a/include/linux/lzma/LzmaEnc.h
207 +++ b/include/linux/lzma/LzmaEnc.h
208 @@ -31,9 +31,6 @@ typedef struct _CLzmaEncProps
211 void LzmaEncProps_Init(CLzmaEncProps *p);
212 -void LzmaEncProps_Normalize(CLzmaEncProps *p);
213 -UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
216 /* ---------- CLzmaEncHandle Interface ---------- */
218 @@ -53,26 +50,9 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc *
219 void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
220 SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
221 SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
222 -SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
223 - ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
224 SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
225 int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
227 -/* ---------- One Call Interface ---------- */
232 - SZ_ERROR_MEM - Memory allocation error
233 - SZ_ERROR_PARAM - Incorrect paramater
234 - SZ_ERROR_OUTPUT_EOF - output buffer overflow
235 - SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
238 -SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
239 - const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
240 - ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
245 --- a/lib/lzma/LzmaEnc.c
246 +++ b/lib/lzma/LzmaEnc.c
247 @@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
251 -void LzmaEncProps_Normalize(CLzmaEncProps *p)
252 +static void LzmaEncProps_Normalize(CLzmaEncProps *p)
254 int level = p->level;
255 if (level < 0) level = 5;
256 @@ -76,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProp
260 -UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
261 +static UInt32 __maybe_unused LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
263 CLzmaEncProps props = *props2;
264 LzmaEncProps_Normalize(&props);
265 @@ -93,7 +93,7 @@ UInt32 LzmaEncProps_GetDictSize(const CL
267 #define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
269 -UInt32 GetPosSlot1(UInt32 pos)
270 +static UInt32 GetPosSlot1(UInt32 pos)
274 @@ -107,7 +107,7 @@ UInt32 GetPosSlot1(UInt32 pos)
275 #define kNumLogBits (9 + (int)sizeof(size_t) / 2)
276 #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
278 -void LzmaEnc_FastPosInit(Byte *g_FastPos)
279 +static void LzmaEnc_FastPosInit(Byte *g_FastPos)
283 @@ -339,7 +339,7 @@ typedef struct
284 CSaveState saveState;
287 -void LzmaEnc_SaveState(CLzmaEncHandle pp)
288 +static void __maybe_unused LzmaEnc_SaveState(CLzmaEncHandle pp)
290 CLzmaEnc *p = (CLzmaEnc *)pp;
291 CSaveState *dest = &p->saveState;
292 @@ -365,7 +365,7 @@ void LzmaEnc_SaveState(CLzmaEncHandle pp
293 memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
296 -void LzmaEnc_RestoreState(CLzmaEncHandle pp)
297 +static void __maybe_unused LzmaEnc_RestoreState(CLzmaEncHandle pp)
299 CLzmaEnc *dest = (CLzmaEnc *)pp;
300 const CSaveState *p = &dest->saveState;
301 @@ -600,7 +600,7 @@ static void LitEnc_EncodeMatched(CRangeE
302 while (symbol < 0x10000);
305 -void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
306 +static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
309 for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
310 @@ -1676,7 +1676,7 @@ static void FillDistancesPrices(CLzmaEnc
311 p->matchPriceCount = 0;
314 -void LzmaEnc_Construct(CLzmaEnc *p)
315 +static void LzmaEnc_Construct(CLzmaEnc *p)
317 RangeEnc_Construct(&p->rc);
318 MatchFinder_Construct(&p->matchFinderBase);
319 @@ -1709,7 +1709,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc *
323 -void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
324 +static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
326 alloc->Free(alloc, p->litProbs);
327 alloc->Free(alloc, p->saveState.litProbs);
328 @@ -2074,7 +2074,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle p
329 return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
332 -void LzmaEnc_Finish(CLzmaEncHandle pp)
333 +static void LzmaEnc_Finish(CLzmaEncHandle pp)
336 CLzmaEnc *p = (CLzmaEnc *)pp;
337 @@ -2108,7 +2108,7 @@ static size_t MyWrite(void *pp, const vo
341 -UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
342 +static UInt32 __maybe_unused LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
344 const CLzmaEnc *p = (CLzmaEnc *)pp;
345 return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
346 @@ -2120,7 +2120,7 @@ const Byte *LzmaEnc_GetCurBuf(CLzmaEncHa
347 return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
350 -SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
351 +static SRes __maybe_unused LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
352 Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
354 CLzmaEnc *p = (CLzmaEnc *)pp;
355 @@ -2248,7 +2248,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp
359 -SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
360 +static __maybe_unused SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
361 const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
362 ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
364 --- a/include/linux/lzma/LzFind.h
365 +++ b/include/linux/lzma/LzFind.h
366 @@ -55,11 +55,6 @@ typedef struct _CMatchFinder
368 #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
370 -int MatchFinder_NeedMove(CMatchFinder *p);
371 -Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
372 -void MatchFinder_MoveBlock(CMatchFinder *p);
373 -void MatchFinder_ReadIfRequired(CMatchFinder *p);
375 void MatchFinder_Construct(CMatchFinder *p);
378 @@ -70,12 +65,6 @@ int MatchFinder_Create(CMatchFinder *p,
379 UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
381 void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
382 -void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
383 -void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
385 -UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
386 - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
387 - UInt32 *distances, UInt32 maxLen);
391 @@ -102,12 +91,6 @@ typedef struct _IMatchFinder
393 void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
395 -void MatchFinder_Init(CMatchFinder *p);
396 -UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
397 -UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
398 -void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
399 -void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
404 --- a/lib/lzma/LzFind.c
405 +++ b/lib/lzma/LzFind.c
406 @@ -42,12 +42,12 @@ static int LzInWindow_Create(CMatchFinde
407 return (p->bufferBase != 0);
410 -Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
411 -Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
412 +static Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
413 +static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
415 -UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
416 +static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
418 -void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
419 +static void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
421 p->posLimit -= subValue;
423 @@ -268,7 +268,7 @@ static void MatchFinder_SetLimits(CMatch
424 p->posLimit = p->pos + limit;
427 -void MatchFinder_Init(CMatchFinder *p)
428 +static void MatchFinder_Init(CMatchFinder *p)
431 for (i = 0; i < p->hashSizeSum; i++)
432 @@ -287,7 +287,7 @@ static UInt32 MatchFinder_GetSubValue(CM
433 return (p->pos - p->historySize - 1) & kNormalizeMask;
436 -void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
437 +static void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
440 for (i = 0; i < numItems; i++)
441 @@ -350,7 +350,7 @@ static UInt32 * Hc_GetMatchesSpec(UInt32
445 -UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
446 +static UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
447 UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
448 UInt32 *distances, UInt32 maxLen)
450 @@ -492,7 +492,7 @@ static UInt32 Bt2_MatchFinder_GetMatches
451 GET_MATCHES_FOOTER(offset, 1)
454 -UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
455 +static __maybe_unused UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
458 GET_MATCHES_HEADER(3)
459 @@ -632,7 +632,7 @@ static UInt32 Hc4_MatchFinder_GetMatches
463 -UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
464 +static __maybe_unused UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
467 GET_MATCHES_HEADER(3)
468 @@ -657,7 +657,7 @@ static void Bt2_MatchFinder_Skip(CMatchF
472 -void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
473 +static __maybe_unused void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
477 @@ -718,7 +718,7 @@ static void Hc4_MatchFinder_Skip(CMatchF
481 -void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
482 +static __maybe_unused void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)