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