Rebased from upstream / out of band repository.
[librecmc/librecmc.git] / target / linux / generic / hack-4.9 / 531-debloat_lzma.patch
1 From 3fd297761ac246c54d7723c57fca95c112b99465 Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Sat, 15 Jul 2017 21:15:44 +0200
4 Subject: lzma: de-bloat the lzma library used by jffs2
5
6 lede-commit: 3fd1dd08fbcbb78b34efefd32c3032e5c99108d6
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
9  include/linux/lzma/LzFind.h  |  17 ---
10  include/linux/lzma/LzmaDec.h | 101 ---------------
11  include/linux/lzma/LzmaEnc.h |  20 ---
12  lib/lzma/LzFind.c            | 287 ++++---------------------------------------
13  lib/lzma/LzmaDec.c           |  86 +------------
14  lib/lzma/LzmaEnc.c           | 172 ++------------------------
15  6 files changed, 42 insertions(+), 641 deletions(-)
16
17 --- a/include/linux/lzma/LzFind.h
18 +++ b/include/linux/lzma/LzFind.h
19 @@ -55,11 +55,6 @@ typedef struct _CMatchFinder
20  
21  #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
22  
23 -int MatchFinder_NeedMove(CMatchFinder *p);
24 -Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
25 -void MatchFinder_MoveBlock(CMatchFinder *p);
26 -void MatchFinder_ReadIfRequired(CMatchFinder *p);
27 -
28  void MatchFinder_Construct(CMatchFinder *p);
29  
30  /* Conditions:
31 @@ -70,12 +65,6 @@ int MatchFinder_Create(CMatchFinder *p,
32      UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
33      ISzAlloc *alloc);
34  void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
35 -void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
36 -void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
37 -
38 -UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
39 -    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
40 -    UInt32 *distances, UInt32 maxLen);
41  
42  /*
43  Conditions:
44 @@ -102,12 +91,6 @@ typedef struct _IMatchFinder
45  
46  void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
47  
48 -void MatchFinder_Init(CMatchFinder *p);
49 -UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
50 -UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
51 -void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
52 -void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
53 -
54  #ifdef __cplusplus
55  }
56  #endif
57 --- a/include/linux/lzma/LzmaDec.h
58 +++ b/include/linux/lzma/LzmaDec.h
59 @@ -31,14 +31,6 @@ typedef struct _CLzmaProps
60    UInt32 dicSize;
61  } CLzmaProps;
62  
63 -/* LzmaProps_Decode - decodes properties
64 -Returns:
65 -  SZ_OK
66 -  SZ_ERROR_UNSUPPORTED - Unsupported properties
67 -*/
68 -
69 -SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
70 -
71  
72  /* ---------- LZMA Decoder state ---------- */
73  
74 @@ -70,8 +62,6 @@ typedef struct
75  
76  #define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
77  
78 -void LzmaDec_Init(CLzmaDec *p);
79 -
80  /* There are two types of LZMA streams:
81       0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
82       1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
83 @@ -108,97 +98,6 @@ typedef enum
84  
85  /* ELzmaStatus is used only as output value for function call */
86  
87 -
88 -/* ---------- Interfaces ---------- */
89 -
90 -/* There are 3 levels of interfaces:
91 -     1) Dictionary Interface
92 -     2) Buffer Interface
93 -     3) One Call Interface
94 -   You can select any of these interfaces, but don't mix functions from different
95 -   groups for same object. */
96 -
97 -
98 -/* There are two variants to allocate state for Dictionary Interface:
99 -     1) LzmaDec_Allocate / LzmaDec_Free
100 -     2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
101 -   You can use variant 2, if you set dictionary buffer manually.
102 -   For Buffer Interface you must always use variant 1.
103 -
104 -LzmaDec_Allocate* can return:
105 -  SZ_OK
106 -  SZ_ERROR_MEM         - Memory allocation error
107 -  SZ_ERROR_UNSUPPORTED - Unsupported properties
108 -*/
109 -   
110 -SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
111 -void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
112 -
113 -SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
114 -void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
115 -
116 -/* ---------- Dictionary Interface ---------- */
117 -
118 -/* You can use it, if you want to eliminate the overhead for data copying from
119 -   dictionary to some other external buffer.
120 -   You must work with CLzmaDec variables directly in this interface.
121 -
122 -   STEPS:
123 -     LzmaDec_Constr()
124 -     LzmaDec_Allocate()
125 -     for (each new stream)
126 -     {
127 -       LzmaDec_Init()
128 -       while (it needs more decompression)
129 -       {
130 -         LzmaDec_DecodeToDic()
131 -         use data from CLzmaDec::dic and update CLzmaDec::dicPos
132 -       }
133 -     }
134 -     LzmaDec_Free()
135 -*/
136 -
137 -/* LzmaDec_DecodeToDic
138 -   
139 -   The decoding to internal dictionary buffer (CLzmaDec::dic).
140 -   You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
141 -
142 -finishMode:
143 -  It has meaning only if the decoding reaches output limit (dicLimit).
144 -  LZMA_FINISH_ANY - Decode just dicLimit bytes.
145 -  LZMA_FINISH_END - Stream must be finished after dicLimit.
146 -
147 -Returns:
148 -  SZ_OK
149 -    status:
150 -      LZMA_STATUS_FINISHED_WITH_MARK
151 -      LZMA_STATUS_NOT_FINISHED
152 -      LZMA_STATUS_NEEDS_MORE_INPUT
153 -      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
154 -  SZ_ERROR_DATA - Data error
155 -*/
156 -
157 -SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
158 -    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
159 -
160 -
161 -/* ---------- Buffer Interface ---------- */
162 -
163 -/* It's zlib-like interface.
164 -   See LzmaDec_DecodeToDic description for information about STEPS and return results,
165 -   but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
166 -   to work with CLzmaDec variables manually.
167 -
168 -finishMode:
169 -  It has meaning only if the decoding reaches output limit (*destLen).
170 -  LZMA_FINISH_ANY - Decode just destLen bytes.
171 -  LZMA_FINISH_END - Stream must be finished after (*destLen).
172 -*/
173 -
174 -SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
175 -    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
176 -
177 -
178  /* ---------- One Call Interface ---------- */
179  
180  /* LzmaDecode
181 --- a/include/linux/lzma/LzmaEnc.h
182 +++ b/include/linux/lzma/LzmaEnc.h
183 @@ -31,9 +31,6 @@ typedef struct _CLzmaEncProps
184  } CLzmaEncProps;
185  
186  void LzmaEncProps_Init(CLzmaEncProps *p);
187 -void LzmaEncProps_Normalize(CLzmaEncProps *p);
188 -UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
189 -
190  
191  /* ---------- CLzmaEncHandle Interface ---------- */
192  
193 @@ -53,26 +50,9 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc *
194  void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
195  SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
196  SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
197 -SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
198 -    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
199  SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
200      int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
201  
202 -/* ---------- One Call Interface ---------- */
203 -
204 -/* LzmaEncode
205 -Return code:
206 -  SZ_OK               - OK
207 -  SZ_ERROR_MEM        - Memory allocation error
208 -  SZ_ERROR_PARAM      - Incorrect paramater
209 -  SZ_ERROR_OUTPUT_EOF - output buffer overflow
210 -  SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)
211 -*/
212 -
213 -SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
214 -    const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
215 -    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
216 -
217  #ifdef __cplusplus
218  }
219  #endif
220 --- a/lib/lzma/LzFind.c
221 +++ b/lib/lzma/LzFind.c
222 @@ -14,9 +14,15 @@
223  
224  #define kStartMaxLen 3
225  
226 +#if 0
227 +#define DIRECT_INPUT   p->directInput
228 +#else
229 +#define DIRECT_INPUT   1
230 +#endif
231 +
232  static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
233  {
234 -  if (!p->directInput)
235 +  if (!DIRECT_INPUT)
236    {
237      alloc->Free(alloc, p->bufferBase);
238      p->bufferBase = 0;
239 @@ -28,7 +34,7 @@ static void LzInWindow_Free(CMatchFinder
240  static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
241  {
242    UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
243 -  if (p->directInput)
244 +  if (DIRECT_INPUT)
245    {
246      p->blockSize = blockSize;
247      return 1;
248 @@ -42,12 +48,12 @@ static int LzInWindow_Create(CMatchFinde
249    return (p->bufferBase != 0);
250  }
251  
252 -Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
253 -Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
254 +static Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
255 +static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
256  
257 -UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
258 +static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
259  
260 -void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
261 +static void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
262  {
263    p->posLimit -= subValue;
264    p->pos -= subValue;
265 @@ -58,7 +64,7 @@ static void MatchFinder_ReadBlock(CMatch
266  {
267    if (p->streamEndWasReached || p->result != SZ_OK)
268      return;
269 -  if (p->directInput)
270 +  if (DIRECT_INPUT)
271    {
272      UInt32 curSize = 0xFFFFFFFF - p->streamPos;
273      if (curSize > p->directInputRem)
274 @@ -89,7 +95,7 @@ static void MatchFinder_ReadBlock(CMatch
275    }
276  }
277  
278 -void MatchFinder_MoveBlock(CMatchFinder *p)
279 +static void MatchFinder_MoveBlock(CMatchFinder *p)
280  {
281    memmove(p->bufferBase,
282      p->buffer - p->keepSizeBefore,
283 @@ -97,22 +103,14 @@ void MatchFinder_MoveBlock(CMatchFinder
284    p->buffer = p->bufferBase + p->keepSizeBefore;
285  }
286  
287 -int MatchFinder_NeedMove(CMatchFinder *p)
288 +static int MatchFinder_NeedMove(CMatchFinder *p)
289  {
290 -  if (p->directInput)
291 +  if (DIRECT_INPUT)
292      return 0;
293    /* if (p->streamEndWasReached) return 0; */
294    return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
295  }
296  
297 -void MatchFinder_ReadIfRequired(CMatchFinder *p)
298 -{
299 -  if (p->streamEndWasReached)
300 -    return;
301 -  if (p->keepSizeAfter >= p->streamPos - p->pos)
302 -    MatchFinder_ReadBlock(p);
303 -}
304 -
305  static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
306  {
307    if (MatchFinder_NeedMove(p))
308 @@ -268,7 +266,7 @@ static void MatchFinder_SetLimits(CMatch
309    p->posLimit = p->pos + limit;
310  }
311  
312 -void MatchFinder_Init(CMatchFinder *p)
313 +static void MatchFinder_Init(CMatchFinder *p)
314  {
315    UInt32 i;
316    for (i = 0; i < p->hashSizeSum; i++)
317 @@ -287,7 +285,7 @@ static UInt32 MatchFinder_GetSubValue(CM
318    return (p->pos - p->historySize - 1) & kNormalizeMask;
319  }
320  
321 -void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
322 +static void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
323  {
324    UInt32 i;
325    for (i = 0; i < numItems; i++)
326 @@ -319,38 +317,7 @@ static void MatchFinder_CheckLimits(CMat
327    MatchFinder_SetLimits(p);
328  }
329  
330 -static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
331 -    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
332 -    UInt32 *distances, UInt32 maxLen)
333 -{
334 -  son[_cyclicBufferPos] = curMatch;
335 -  for (;;)
336 -  {
337 -    UInt32 delta = pos - curMatch;
338 -    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
339 -      return distances;
340 -    {
341 -      const Byte *pb = cur - delta;
342 -      curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
343 -      if (pb[maxLen] == cur[maxLen] && *pb == *cur)
344 -      {
345 -        UInt32 len = 0;
346 -        while (++len != lenLimit)
347 -          if (pb[len] != cur[len])
348 -            break;
349 -        if (maxLen < len)
350 -        {
351 -          *distances++ = maxLen = len;
352 -          *distances++ = delta - 1;
353 -          if (len == lenLimit)
354 -            return distances;
355 -        }
356 -      }
357 -    }
358 -  }
359 -}
360 -
361 -UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
362 +static UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
363      UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
364      UInt32 *distances, UInt32 maxLen)
365  {
366 @@ -460,10 +427,10 @@ static void SkipMatchesSpec(UInt32 lenLi
367    p->buffer++; \
368    if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
369  
370 -#define MOVE_POS_RET MOVE_POS return offset;
371 -
372  static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
373  
374 +#define MOVE_POS_RET MatchFinder_MovePos(p); return offset;
375 +
376  #define GET_MATCHES_HEADER2(minLen, ret_op) \
377    UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
378    lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
379 @@ -479,62 +446,7 @@ static void MatchFinder_MovePos(CMatchFi
380    distances + offset, maxLen) - distances); MOVE_POS_RET;
381  
382  #define SKIP_FOOTER \
383 -  SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
384 -
385 -static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
386 -{
387 -  UInt32 offset;
388 -  GET_MATCHES_HEADER(2)
389 -  HASH2_CALC;
390 -  curMatch = p->hash[hashValue];
391 -  p->hash[hashValue] = p->pos;
392 -  offset = 0;
393 -  GET_MATCHES_FOOTER(offset, 1)
394 -}
395 -
396 -UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
397 -{
398 -  UInt32 offset;
399 -  GET_MATCHES_HEADER(3)
400 -  HASH_ZIP_CALC;
401 -  curMatch = p->hash[hashValue];
402 -  p->hash[hashValue] = p->pos;
403 -  offset = 0;
404 -  GET_MATCHES_FOOTER(offset, 2)
405 -}
406 -
407 -static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
408 -{
409 -  UInt32 hash2Value, delta2, maxLen, offset;
410 -  GET_MATCHES_HEADER(3)
411 -
412 -  HASH3_CALC;
413 -
414 -  delta2 = p->pos - p->hash[hash2Value];
415 -  curMatch = p->hash[kFix3HashSize + hashValue];
416 -  
417 -  p->hash[hash2Value] =
418 -  p->hash[kFix3HashSize + hashValue] = p->pos;
419 -
420 -
421 -  maxLen = 2;
422 -  offset = 0;
423 -  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
424 -  {
425 -    for (; maxLen != lenLimit; maxLen++)
426 -      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
427 -        break;
428 -    distances[0] = maxLen;
429 -    distances[1] = delta2 - 1;
430 -    offset = 2;
431 -    if (maxLen == lenLimit)
432 -    {
433 -      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
434 -      MOVE_POS_RET;
435 -    }
436 -  }
437 -  GET_MATCHES_FOOTER(offset, maxLen)
438 -}
439 +  SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MatchFinder_MovePos(p);
440  
441  static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
442  {
443 @@ -583,108 +495,6 @@ static UInt32 Bt4_MatchFinder_GetMatches
444    GET_MATCHES_FOOTER(offset, maxLen)
445  }
446  
447 -static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
448 -{
449 -  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
450 -  GET_MATCHES_HEADER(4)
451 -
452 -  HASH4_CALC;
453 -
454 -  delta2 = p->pos - p->hash[                hash2Value];
455 -  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
456 -  curMatch = p->hash[kFix4HashSize + hashValue];
457 -
458 -  p->hash[                hash2Value] =
459 -  p->hash[kFix3HashSize + hash3Value] =
460 -  p->hash[kFix4HashSize + hashValue] = p->pos;
461 -
462 -  maxLen = 1;
463 -  offset = 0;
464 -  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
465 -  {
466 -    distances[0] = maxLen = 2;
467 -    distances[1] = delta2 - 1;
468 -    offset = 2;
469 -  }
470 -  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
471 -  {
472 -    maxLen = 3;
473 -    distances[offset + 1] = delta3 - 1;
474 -    offset += 2;
475 -    delta2 = delta3;
476 -  }
477 -  if (offset != 0)
478 -  {
479 -    for (; maxLen != lenLimit; maxLen++)
480 -      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
481 -        break;
482 -    distances[offset - 2] = maxLen;
483 -    if (maxLen == lenLimit)
484 -    {
485 -      p->son[p->cyclicBufferPos] = curMatch;
486 -      MOVE_POS_RET;
487 -    }
488 -  }
489 -  if (maxLen < 3)
490 -    maxLen = 3;
491 -  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
492 -    distances + offset, maxLen) - (distances));
493 -  MOVE_POS_RET
494 -}
495 -
496 -UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
497 -{
498 -  UInt32 offset;
499 -  GET_MATCHES_HEADER(3)
500 -  HASH_ZIP_CALC;
501 -  curMatch = p->hash[hashValue];
502 -  p->hash[hashValue] = p->pos;
503 -  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
504 -    distances, 2) - (distances));
505 -  MOVE_POS_RET
506 -}
507 -
508 -static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
509 -{
510 -  do
511 -  {
512 -    SKIP_HEADER(2)
513 -    HASH2_CALC;
514 -    curMatch = p->hash[hashValue];
515 -    p->hash[hashValue] = p->pos;
516 -    SKIP_FOOTER
517 -  }
518 -  while (--num != 0);
519 -}
520 -
521 -void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
522 -{
523 -  do
524 -  {
525 -    SKIP_HEADER(3)
526 -    HASH_ZIP_CALC;
527 -    curMatch = p->hash[hashValue];
528 -    p->hash[hashValue] = p->pos;
529 -    SKIP_FOOTER
530 -  }
531 -  while (--num != 0);
532 -}
533 -
534 -static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
535 -{
536 -  do
537 -  {
538 -    UInt32 hash2Value;
539 -    SKIP_HEADER(3)
540 -    HASH3_CALC;
541 -    curMatch = p->hash[kFix3HashSize + hashValue];
542 -    p->hash[hash2Value] =
543 -    p->hash[kFix3HashSize + hashValue] = p->pos;
544 -    SKIP_FOOTER
545 -  }
546 -  while (--num != 0);
547 -}
548 -
549  static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
550  {
551    do
552 @@ -701,61 +511,12 @@ static void Bt4_MatchFinder_Skip(CMatchF
553    while (--num != 0);
554  }
555  
556 -static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
557 -{
558 -  do
559 -  {
560 -    UInt32 hash2Value, hash3Value;
561 -    SKIP_HEADER(4)
562 -    HASH4_CALC;
563 -    curMatch = p->hash[kFix4HashSize + hashValue];
564 -    p->hash[                hash2Value] =
565 -    p->hash[kFix3HashSize + hash3Value] =
566 -    p->hash[kFix4HashSize + hashValue] = p->pos;
567 -    p->son[p->cyclicBufferPos] = curMatch;
568 -    MOVE_POS
569 -  }
570 -  while (--num != 0);
571 -}
572 -
573 -void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
574 -{
575 -  do
576 -  {
577 -    SKIP_HEADER(3)
578 -    HASH_ZIP_CALC;
579 -    curMatch = p->hash[hashValue];
580 -    p->hash[hashValue] = p->pos;
581 -    p->son[p->cyclicBufferPos] = curMatch;
582 -    MOVE_POS
583 -  }
584 -  while (--num != 0);
585 -}
586 -
587  void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
588  {
589    vTable->Init = (Mf_Init_Func)MatchFinder_Init;
590    vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
591    vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
592    vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
593 -  if (!p->btMode)
594 -  {
595 -    vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
596 -    vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
597 -  }
598 -  else if (p->numHashBytes == 2)
599 -  {
600 -    vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
601 -    vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
602 -  }
603 -  else if (p->numHashBytes == 3)
604 -  {
605 -    vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
606 -    vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
607 -  }
608 -  else
609 -  {
610 -    vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
611 -    vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
612 -  }
613 +  vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
614 +  vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
615  }
616 --- a/lib/lzma/LzmaDec.c
617 +++ b/lib/lzma/LzmaDec.c
618 @@ -682,7 +682,7 @@ static void LzmaDec_InitRc(CLzmaDec *p,
619    p->needFlush = 0;
620  }
621  
622 -void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
623 +static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
624  {
625    p->needFlush = 1;
626    p->remainLen = 0;
627 @@ -698,7 +698,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p
628      p->needInitState = 1;
629  }
630  
631 -void LzmaDec_Init(CLzmaDec *p)
632 +static void LzmaDec_Init(CLzmaDec *p)
633  {
634    p->dicPos = 0;
635    LzmaDec_InitDicAndState(p, True, True);
636 @@ -716,7 +716,7 @@ static void LzmaDec_InitStateReal(CLzmaD
637    p->needInitState = 0;
638  }
639  
640 -SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
641 +static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
642      ELzmaFinishMode finishMode, ELzmaStatus *status)
643  {
644    SizeT inSize = *srcLen;
645 @@ -837,65 +837,13 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si
646    return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
647  }
648  
649 -SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
650 -{
651 -  SizeT outSize = *destLen;
652 -  SizeT inSize = *srcLen;
653 -  *srcLen = *destLen = 0;
654 -  for (;;)
655 -  {
656 -    SizeT inSizeCur = inSize, outSizeCur, dicPos;
657 -    ELzmaFinishMode curFinishMode;
658 -    SRes res;
659 -    if (p->dicPos == p->dicBufSize)
660 -      p->dicPos = 0;
661 -    dicPos = p->dicPos;
662 -    if (outSize > p->dicBufSize - dicPos)
663 -    {
664 -      outSizeCur = p->dicBufSize;
665 -      curFinishMode = LZMA_FINISH_ANY;
666 -    }
667 -    else
668 -    {
669 -      outSizeCur = dicPos + outSize;
670 -      curFinishMode = finishMode;
671 -    }
672 -
673 -    res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
674 -    src += inSizeCur;
675 -    inSize -= inSizeCur;
676 -    *srcLen += inSizeCur;
677 -    outSizeCur = p->dicPos - dicPos;
678 -    memcpy(dest, p->dic + dicPos, outSizeCur);
679 -    dest += outSizeCur;
680 -    outSize -= outSizeCur;
681 -    *destLen += outSizeCur;
682 -    if (res != 0)
683 -      return res;
684 -    if (outSizeCur == 0 || outSize == 0)
685 -      return SZ_OK;
686 -  }
687 -}
688 -
689 -void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
690 +static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
691  {
692    alloc->Free(alloc, p->probs);
693    p->probs = 0;
694  }
695  
696 -static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc)
697 -{
698 -  alloc->Free(alloc, p->dic);
699 -  p->dic = 0;
700 -}
701 -
702 -void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
703 -{
704 -  LzmaDec_FreeProbs(p, alloc);
705 -  LzmaDec_FreeDict(p, alloc);
706 -}
707 -
708 -SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
709 +static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
710  {
711    UInt32 dicSize;
712    Byte d;
713 @@ -935,7 +883,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma
714    return SZ_OK;
715  }
716  
717 -SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
718 +static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
719  {
720    CLzmaProps propNew;
721    RINOK(LzmaProps_Decode(&propNew, props, propsSize));
722 @@ -943,28 +891,6 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p,
723    p->prop = propNew;
724    return SZ_OK;
725  }
726 -
727 -SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
728 -{
729 -  CLzmaProps propNew;
730 -  SizeT dicBufSize;
731 -  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
732 -  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
733 -  dicBufSize = propNew.dicSize;
734 -  if (p->dic == 0 || dicBufSize != p->dicBufSize)
735 -  {
736 -    LzmaDec_FreeDict(p, alloc);
737 -    p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
738 -    if (p->dic == 0)
739 -    {
740 -      LzmaDec_FreeProbs(p, alloc);
741 -      return SZ_ERROR_MEM;
742 -    }
743 -  }
744 -  p->dicBufSize = dicBufSize;
745 -  p->prop = propNew;
746 -  return SZ_OK;
747 -}
748  
749  SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
750      const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
751 --- a/lib/lzma/LzmaEnc.c
752 +++ b/lib/lzma/LzmaEnc.c
753 @@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
754    p->writeEndMark = 0;
755  }
756  
757 -void LzmaEncProps_Normalize(CLzmaEncProps *p)
758 +static void LzmaEncProps_Normalize(CLzmaEncProps *p)
759  {
760    int level = p->level;
761    if (level < 0) level = 5;
762 @@ -76,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProp
763        #endif
764  }
765  
766 -UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
767 +static UInt32 __maybe_unused LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
768  {
769    CLzmaEncProps props = *props2;
770    LzmaEncProps_Normalize(&props);
771 @@ -93,7 +93,7 @@ UInt32 LzmaEncProps_GetDictSize(const CL
772  
773  #define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
774  
775 -UInt32 GetPosSlot1(UInt32 pos)
776 +static UInt32 GetPosSlot1(UInt32 pos)
777  {
778    UInt32 res;
779    BSR2_RET(pos, res);
780 @@ -107,7 +107,7 @@ UInt32 GetPosSlot1(UInt32 pos)
781  #define kNumLogBits (9 + (int)sizeof(size_t) / 2)
782  #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
783  
784 -void LzmaEnc_FastPosInit(Byte *g_FastPos)
785 +static void LzmaEnc_FastPosInit(Byte *g_FastPos)
786  {
787    int c = 2, slotFast;
788    g_FastPos[0] = 0;
789 @@ -339,58 +339,6 @@ typedef struct
790    CSaveState saveState;
791  } CLzmaEnc;
792  
793 -void LzmaEnc_SaveState(CLzmaEncHandle pp)
794 -{
795 -  CLzmaEnc *p = (CLzmaEnc *)pp;
796 -  CSaveState *dest = &p->saveState;
797 -  int i;
798 -  dest->lenEnc = p->lenEnc;
799 -  dest->repLenEnc = p->repLenEnc;
800 -  dest->state = p->state;
801 -
802 -  for (i = 0; i < kNumStates; i++)
803 -  {
804 -    memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
805 -    memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
806 -  }
807 -  for (i = 0; i < kNumLenToPosStates; i++)
808 -    memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
809 -  memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
810 -  memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
811 -  memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
812 -  memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
813 -  memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
814 -  memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
815 -  memcpy(dest->reps, p->reps, sizeof(p->reps));
816 -  memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
817 -}
818 -
819 -void LzmaEnc_RestoreState(CLzmaEncHandle pp)
820 -{
821 -  CLzmaEnc *dest = (CLzmaEnc *)pp;
822 -  const CSaveState *p = &dest->saveState;
823 -  int i;
824 -  dest->lenEnc = p->lenEnc;
825 -  dest->repLenEnc = p->repLenEnc;
826 -  dest->state = p->state;
827 -
828 -  for (i = 0; i < kNumStates; i++)
829 -  {
830 -    memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
831 -    memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
832 -  }
833 -  for (i = 0; i < kNumLenToPosStates; i++)
834 -    memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
835 -  memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
836 -  memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
837 -  memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
838 -  memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
839 -  memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
840 -  memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
841 -  memcpy(dest->reps, p->reps, sizeof(p->reps));
842 -  memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb));
843 -}
844 -
845  SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
846  {
847    CLzmaEnc *p = (CLzmaEnc *)pp;
848 @@ -600,7 +548,7 @@ static void LitEnc_EncodeMatched(CRangeE
849    while (symbol < 0x10000);
850  }
851  
852 -void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
853 +static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
854  {
855    UInt32 i;
856    for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
857 @@ -1676,7 +1624,7 @@ static void FillDistancesPrices(CLzmaEnc
858    p->matchPriceCount = 0;
859  }
860  
861 -void LzmaEnc_Construct(CLzmaEnc *p)
862 +static void LzmaEnc_Construct(CLzmaEnc *p)
863  {
864    RangeEnc_Construct(&p->rc);
865    MatchFinder_Construct(&p->matchFinderBase);
866 @@ -1709,7 +1657,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc *
867    return p;
868  }
869  
870 -void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
871 +static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
872  {
873    alloc->Free(alloc, p->litProbs);
874    alloc->Free(alloc, p->saveState.litProbs);
875 @@ -1717,7 +1665,7 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAl
876    p->saveState.litProbs = 0;
877  }
878  
879 -void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
880 +static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
881  {
882    #ifndef _7ZIP_ST
883    MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
884 @@ -1947,7 +1895,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, U
885    return SZ_OK;
886  }
887  
888 -void LzmaEnc_Init(CLzmaEnc *p)
889 +static void LzmaEnc_Init(CLzmaEnc *p)
890  {
891    UInt32 i;
892    p->state = 0;
893 @@ -2005,7 +1953,7 @@ void LzmaEnc_Init(CLzmaEnc *p)
894    p->lpMask = (1 << p->lp) - 1;
895  }
896  
897 -void LzmaEnc_InitPrices(CLzmaEnc *p)
898 +static void LzmaEnc_InitPrices(CLzmaEnc *p)
899  {
900    if (!p->fastMode)
901    {
902 @@ -2037,26 +1985,6 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn
903    return SZ_OK;
904  }
905  
906 -static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream,
907 -    ISzAlloc *alloc, ISzAlloc *allocBig)
908 -{
909 -  CLzmaEnc *p = (CLzmaEnc *)pp;
910 -  p->matchFinderBase.stream = inStream;
911 -  p->needInit = 1;
912 -  p->rc.outStream = outStream;
913 -  return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
914 -}
915 -
916 -SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
917 -    ISeqInStream *inStream, UInt32 keepWindowSize,
918 -    ISzAlloc *alloc, ISzAlloc *allocBig)
919 -{
920 -  CLzmaEnc *p = (CLzmaEnc *)pp;
921 -  p->matchFinderBase.stream = inStream;
922 -  p->needInit = 1;
923 -  return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
924 -}
925 -
926  static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
927  {
928    p->matchFinderBase.directInput = 1;
929 @@ -2064,7 +1992,7 @@ static void LzmaEnc_SetInputBuf(CLzmaEnc
930    p->matchFinderBase.directInputRem = srcLen;
931  }
932  
933 -SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
934 +static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
935      UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
936  {
937    CLzmaEnc *p = (CLzmaEnc *)pp;
938 @@ -2074,7 +2002,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle p
939    return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
940  }
941  
942 -void LzmaEnc_Finish(CLzmaEncHandle pp)
943 +static void LzmaEnc_Finish(CLzmaEncHandle pp)
944  {
945    #ifndef _7ZIP_ST
946    CLzmaEnc *p = (CLzmaEnc *)pp;
947 @@ -2107,53 +2035,6 @@ static size_t MyWrite(void *pp, const vo
948    return size;
949  }
950  
951 -
952 -UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
953 -{
954 -  const CLzmaEnc *p = (CLzmaEnc *)pp;
955 -  return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
956 -}
957 -
958 -const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
959 -{
960 -  const CLzmaEnc *p = (CLzmaEnc *)pp;
961 -  return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
962 -}
963 -
964 -SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
965 -    Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
966 -{
967 -  CLzmaEnc *p = (CLzmaEnc *)pp;
968 -  UInt64 nowPos64;
969 -  SRes res;
970 -  CSeqOutStreamBuf outStream;
971 -
972 -  outStream.funcTable.Write = MyWrite;
973 -  outStream.data = dest;
974 -  outStream.rem = *destLen;
975 -  outStream.overflow = False;
976 -
977 -  p->writeEndMark = False;
978 -  p->finished = False;
979 -  p->result = SZ_OK;
980 -
981 -  if (reInit)
982 -    LzmaEnc_Init(p);
983 -  LzmaEnc_InitPrices(p);
984 -  nowPos64 = p->nowPos64;
985 -  RangeEnc_Init(&p->rc);
986 -  p->rc.outStream = &outStream.funcTable;
987 -
988 -  res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize);
989 -  
990 -  *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
991 -  *destLen -= outStream.rem;
992 -  if (outStream.overflow)
993 -    return SZ_ERROR_OUTPUT_EOF;
994 -
995 -  return res;
996 -}
997 -
998  static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
999  {
1000    SRes res = SZ_OK;
1001 @@ -2184,13 +2065,6 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p,
1002    return res;
1003  }
1004  
1005 -SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
1006 -    ISzAlloc *alloc, ISzAlloc *allocBig)
1007 -{
1008 -  RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig));
1009 -  return LzmaEnc_Encode2((CLzmaEnc *)pp, progress);
1010 -}
1011 -
1012  SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
1013  {
1014    CLzmaEnc *p = (CLzmaEnc *)pp;
1015 @@ -2247,25 +2121,3 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp
1016      return SZ_ERROR_OUTPUT_EOF;
1017    return res;
1018  }
1019 -
1020 -SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
1021 -    const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
1022 -    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
1023 -{
1024 -  CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
1025 -  SRes res;
1026 -  if (p == 0)
1027 -    return SZ_ERROR_MEM;
1028 -
1029 -  res = LzmaEnc_SetProps(p, props);
1030 -  if (res == SZ_OK)
1031 -  {
1032 -    res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
1033 -    if (res == SZ_OK)
1034 -      res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
1035 -          writeEndMark, progress, alloc, allocBig);
1036 -  }
1037 -
1038 -  LzmaEnc_Destroy(p, alloc, allocBig);
1039 -  return res;
1040 -}