531-debloat_lzma.patch 31 KB

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