2
0

531-debloat_lzma.patch 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  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,7 +883,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma
  210. return SZ_OK;
  211. }
  212. -SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
  213. +static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
  214. {
  215. CLzmaProps propNew;
  216. RINOK(LzmaProps_Decode(&propNew, props, propsSize));
  217. @@ -943,28 +891,6 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p,
  218. p->prop = propNew;
  219. return SZ_OK;
  220. }
  221. -
  222. -SRes LzmaDec_Allocate(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. SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
  244. const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
  245. --- a/include/linux/lzma/LzmaEnc.h
  246. +++ b/include/linux/lzma/LzmaEnc.h
  247. @@ -31,9 +31,6 @@ typedef struct _CLzmaEncProps
  248. } CLzmaEncProps;
  249. void LzmaEncProps_Init(CLzmaEncProps *p);
  250. -void LzmaEncProps_Normalize(CLzmaEncProps *p);
  251. -UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
  252. -
  253. /* ---------- CLzmaEncHandle Interface ---------- */
  254. @@ -53,26 +50,9 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc *
  255. void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
  256. SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
  257. SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
  258. -SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
  259. - ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
  260. SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
  261. int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
  262. -/* ---------- One Call Interface ---------- */
  263. -
  264. -/* LzmaEncode
  265. -Return code:
  266. - SZ_OK - OK
  267. - SZ_ERROR_MEM - Memory allocation error
  268. - SZ_ERROR_PARAM - Incorrect paramater
  269. - SZ_ERROR_OUTPUT_EOF - output buffer overflow
  270. - SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
  271. -*/
  272. -
  273. -SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
  274. - const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
  275. - ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
  276. -
  277. #ifdef __cplusplus
  278. }
  279. #endif
  280. --- a/lib/lzma/LzmaEnc.c
  281. +++ b/lib/lzma/LzmaEnc.c
  282. @@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
  283. p->writeEndMark = 0;
  284. }
  285. -void LzmaEncProps_Normalize(CLzmaEncProps *p)
  286. +static void LzmaEncProps_Normalize(CLzmaEncProps *p)
  287. {
  288. int level = p->level;
  289. if (level < 0) level = 5;
  290. @@ -76,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProp
  291. #endif
  292. }
  293. -UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
  294. +static UInt32 __maybe_unused LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
  295. {
  296. CLzmaEncProps props = *props2;
  297. LzmaEncProps_Normalize(&props);
  298. @@ -93,7 +93,7 @@ UInt32 LzmaEncProps_GetDictSize(const CL
  299. #define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
  300. -UInt32 GetPosSlot1(UInt32 pos)
  301. +static UInt32 GetPosSlot1(UInt32 pos)
  302. {
  303. UInt32 res;
  304. BSR2_RET(pos, res);
  305. @@ -107,7 +107,7 @@ UInt32 GetPosSlot1(UInt32 pos)
  306. #define kNumLogBits (9 + (int)sizeof(size_t) / 2)
  307. #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
  308. -void LzmaEnc_FastPosInit(Byte *g_FastPos)
  309. +static void LzmaEnc_FastPosInit(Byte *g_FastPos)
  310. {
  311. int c = 2, slotFast;
  312. g_FastPos[0] = 0;
  313. @@ -339,58 +339,6 @@ typedef struct
  314. CSaveState saveState;
  315. } CLzmaEnc;
  316. -void LzmaEnc_SaveState(CLzmaEncHandle pp)
  317. -{
  318. - CLzmaEnc *p = (CLzmaEnc *)pp;
  319. - CSaveState *dest = &p->saveState;
  320. - int i;
  321. - dest->lenEnc = p->lenEnc;
  322. - dest->repLenEnc = p->repLenEnc;
  323. - dest->state = p->state;
  324. -
  325. - for (i = 0; i < kNumStates; i++)
  326. - {
  327. - memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
  328. - memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
  329. - }
  330. - for (i = 0; i < kNumLenToPosStates; i++)
  331. - memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
  332. - memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
  333. - memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
  334. - memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
  335. - memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
  336. - memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
  337. - memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
  338. - memcpy(dest->reps, p->reps, sizeof(p->reps));
  339. - memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
  340. -}
  341. -
  342. -void LzmaEnc_RestoreState(CLzmaEncHandle pp)
  343. -{
  344. - CLzmaEnc *dest = (CLzmaEnc *)pp;
  345. - const CSaveState *p = &dest->saveState;
  346. - int i;
  347. - dest->lenEnc = p->lenEnc;
  348. - dest->repLenEnc = p->repLenEnc;
  349. - dest->state = p->state;
  350. -
  351. - for (i = 0; i < kNumStates; i++)
  352. - {
  353. - memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
  354. - memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
  355. - }
  356. - for (i = 0; i < kNumLenToPosStates; i++)
  357. - memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
  358. - memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
  359. - memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
  360. - memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
  361. - memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
  362. - memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
  363. - memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
  364. - memcpy(dest->reps, p->reps, sizeof(p->reps));
  365. - memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb));
  366. -}
  367. -
  368. SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
  369. {
  370. CLzmaEnc *p = (CLzmaEnc *)pp;
  371. @@ -600,7 +548,7 @@ static void LitEnc_EncodeMatched(CRangeE
  372. while (symbol < 0x10000);
  373. }
  374. -void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
  375. +static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
  376. {
  377. UInt32 i;
  378. for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
  379. @@ -1676,7 +1624,7 @@ static void FillDistancesPrices(CLzmaEnc
  380. p->matchPriceCount = 0;
  381. }
  382. -void LzmaEnc_Construct(CLzmaEnc *p)
  383. +static void LzmaEnc_Construct(CLzmaEnc *p)
  384. {
  385. RangeEnc_Construct(&p->rc);
  386. MatchFinder_Construct(&p->matchFinderBase);
  387. @@ -1709,7 +1657,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc *
  388. return p;
  389. }
  390. -void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
  391. +static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
  392. {
  393. alloc->Free(alloc, p->litProbs);
  394. alloc->Free(alloc, p->saveState.litProbs);
  395. @@ -1717,7 +1665,7 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAl
  396. p->saveState.litProbs = 0;
  397. }
  398. -void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
  399. +static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
  400. {
  401. #ifndef _7ZIP_ST
  402. MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
  403. @@ -1947,7 +1895,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, U
  404. return SZ_OK;
  405. }
  406. -void LzmaEnc_Init(CLzmaEnc *p)
  407. +static void LzmaEnc_Init(CLzmaEnc *p)
  408. {
  409. UInt32 i;
  410. p->state = 0;
  411. @@ -2005,7 +1953,7 @@ void LzmaEnc_Init(CLzmaEnc *p)
  412. p->lpMask = (1 << p->lp) - 1;
  413. }
  414. -void LzmaEnc_InitPrices(CLzmaEnc *p)
  415. +static void LzmaEnc_InitPrices(CLzmaEnc *p)
  416. {
  417. if (!p->fastMode)
  418. {
  419. @@ -2037,26 +1985,6 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn
  420. return SZ_OK;
  421. }
  422. -static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream,
  423. - ISzAlloc *alloc, ISzAlloc *allocBig)
  424. -{
  425. - CLzmaEnc *p = (CLzmaEnc *)pp;
  426. - p->matchFinderBase.stream = inStream;
  427. - p->needInit = 1;
  428. - p->rc.outStream = outStream;
  429. - return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
  430. -}
  431. -
  432. -SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
  433. - ISeqInStream *inStream, UInt32 keepWindowSize,
  434. - ISzAlloc *alloc, ISzAlloc *allocBig)
  435. -{
  436. - CLzmaEnc *p = (CLzmaEnc *)pp;
  437. - p->matchFinderBase.stream = inStream;
  438. - p->needInit = 1;
  439. - return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
  440. -}
  441. -
  442. static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
  443. {
  444. p->matchFinderBase.directInput = 1;
  445. @@ -2064,7 +1992,7 @@ static void LzmaEnc_SetInputBuf(CLzmaEnc
  446. p->matchFinderBase.directInputRem = srcLen;
  447. }
  448. -SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
  449. +static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
  450. UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
  451. {
  452. CLzmaEnc *p = (CLzmaEnc *)pp;
  453. @@ -2074,7 +2002,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle p
  454. return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
  455. }
  456. -void LzmaEnc_Finish(CLzmaEncHandle pp)
  457. +static void LzmaEnc_Finish(CLzmaEncHandle pp)
  458. {
  459. #ifndef _7ZIP_ST
  460. CLzmaEnc *p = (CLzmaEnc *)pp;
  461. @@ -2107,53 +2035,6 @@ static size_t MyWrite(void *pp, const vo
  462. return size;
  463. }
  464. -
  465. -UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
  466. -{
  467. - const CLzmaEnc *p = (CLzmaEnc *)pp;
  468. - return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
  469. -}
  470. -
  471. -const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
  472. -{
  473. - const CLzmaEnc *p = (CLzmaEnc *)pp;
  474. - return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
  475. -}
  476. -
  477. -SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
  478. - Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
  479. -{
  480. - CLzmaEnc *p = (CLzmaEnc *)pp;
  481. - UInt64 nowPos64;
  482. - SRes res;
  483. - CSeqOutStreamBuf outStream;
  484. -
  485. - outStream.funcTable.Write = MyWrite;
  486. - outStream.data = dest;
  487. - outStream.rem = *destLen;
  488. - outStream.overflow = False;
  489. -
  490. - p->writeEndMark = False;
  491. - p->finished = False;
  492. - p->result = SZ_OK;
  493. -
  494. - if (reInit)
  495. - LzmaEnc_Init(p);
  496. - LzmaEnc_InitPrices(p);
  497. - nowPos64 = p->nowPos64;
  498. - RangeEnc_Init(&p->rc);
  499. - p->rc.outStream = &outStream.funcTable;
  500. -
  501. - res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize);
  502. -
  503. - *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
  504. - *destLen -= outStream.rem;
  505. - if (outStream.overflow)
  506. - return SZ_ERROR_OUTPUT_EOF;
  507. -
  508. - return res;
  509. -}
  510. -
  511. static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
  512. {
  513. SRes res = SZ_OK;
  514. @@ -2184,13 +2065,6 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p,
  515. return res;
  516. }
  517. -SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
  518. - ISzAlloc *alloc, ISzAlloc *allocBig)
  519. -{
  520. - RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig));
  521. - return LzmaEnc_Encode2((CLzmaEnc *)pp, progress);
  522. -}
  523. -
  524. SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
  525. {
  526. CLzmaEnc *p = (CLzmaEnc *)pp;
  527. @@ -2247,25 +2121,3 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp
  528. return SZ_ERROR_OUTPUT_EOF;
  529. return res;
  530. }
  531. -
  532. -SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
  533. - const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
  534. - ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
  535. -{
  536. - CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
  537. - SRes res;
  538. - if (p == 0)
  539. - return SZ_ERROR_MEM;
  540. -
  541. - res = LzmaEnc_SetProps(p, props);
  542. - if (res == SZ_OK)
  543. - {
  544. - res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
  545. - if (res == SZ_OK)
  546. - res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
  547. - writeEndMark, progress, alloc, allocBig);
  548. - }
  549. -
  550. - LzmaEnc_Destroy(p, alloc, allocBig);
  551. - return res;
  552. -}
  553. --- a/include/linux/lzma/LzFind.h
  554. +++ b/include/linux/lzma/LzFind.h
  555. @@ -55,11 +55,6 @@ typedef struct _CMatchFinder
  556. #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
  557. -int MatchFinder_NeedMove(CMatchFinder *p);
  558. -Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
  559. -void MatchFinder_MoveBlock(CMatchFinder *p);
  560. -void MatchFinder_ReadIfRequired(CMatchFinder *p);
  561. -
  562. void MatchFinder_Construct(CMatchFinder *p);
  563. /* Conditions:
  564. @@ -70,12 +65,6 @@ int MatchFinder_Create(CMatchFinder *p,
  565. UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
  566. ISzAlloc *alloc);
  567. void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
  568. -void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
  569. -void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
  570. -
  571. -UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
  572. - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
  573. - UInt32 *distances, UInt32 maxLen);
  574. /*
  575. Conditions:
  576. @@ -102,12 +91,6 @@ typedef struct _IMatchFinder
  577. void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
  578. -void MatchFinder_Init(CMatchFinder *p);
  579. -UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
  580. -UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
  581. -void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
  582. -void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
  583. -
  584. #ifdef __cplusplus
  585. }
  586. #endif
  587. --- a/lib/lzma/LzFind.c
  588. +++ b/lib/lzma/LzFind.c
  589. @@ -14,9 +14,15 @@
  590. #define kStartMaxLen 3
  591. +#if 0
  592. +#define DIRECT_INPUT p->directInput
  593. +#else
  594. +#define DIRECT_INPUT 1
  595. +#endif
  596. +
  597. static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
  598. {
  599. - if (!p->directInput)
  600. + if (!DIRECT_INPUT)
  601. {
  602. alloc->Free(alloc, p->bufferBase);
  603. p->bufferBase = 0;
  604. @@ -28,7 +34,7 @@ static void LzInWindow_Free(CMatchFinder
  605. static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
  606. {
  607. UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
  608. - if (p->directInput)
  609. + if (DIRECT_INPUT)
  610. {
  611. p->blockSize = blockSize;
  612. return 1;
  613. @@ -42,12 +48,12 @@ static int LzInWindow_Create(CMatchFinde
  614. return (p->bufferBase != 0);
  615. }
  616. -Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
  617. -Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
  618. +static Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
  619. +static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
  620. -UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
  621. +static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
  622. -void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
  623. +static void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
  624. {
  625. p->posLimit -= subValue;
  626. p->pos -= subValue;
  627. @@ -58,7 +64,7 @@ static void MatchFinder_ReadBlock(CMatch
  628. {
  629. if (p->streamEndWasReached || p->result != SZ_OK)
  630. return;
  631. - if (p->directInput)
  632. + if (DIRECT_INPUT)
  633. {
  634. UInt32 curSize = 0xFFFFFFFF - p->streamPos;
  635. if (curSize > p->directInputRem)
  636. @@ -89,7 +95,7 @@ static void MatchFinder_ReadBlock(CMatch
  637. }
  638. }
  639. -void MatchFinder_MoveBlock(CMatchFinder *p)
  640. +static void MatchFinder_MoveBlock(CMatchFinder *p)
  641. {
  642. memmove(p->bufferBase,
  643. p->buffer - p->keepSizeBefore,
  644. @@ -97,22 +103,14 @@ void MatchFinder_MoveBlock(CMatchFinder
  645. p->buffer = p->bufferBase + p->keepSizeBefore;
  646. }
  647. -int MatchFinder_NeedMove(CMatchFinder *p)
  648. +static int MatchFinder_NeedMove(CMatchFinder *p)
  649. {
  650. - if (p->directInput)
  651. + if (DIRECT_INPUT)
  652. return 0;
  653. /* if (p->streamEndWasReached) return 0; */
  654. return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
  655. }
  656. -void MatchFinder_ReadIfRequired(CMatchFinder *p)
  657. -{
  658. - if (p->streamEndWasReached)
  659. - return;
  660. - if (p->keepSizeAfter >= p->streamPos - p->pos)
  661. - MatchFinder_ReadBlock(p);
  662. -}
  663. -
  664. static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
  665. {
  666. if (MatchFinder_NeedMove(p))
  667. @@ -268,7 +266,7 @@ static void MatchFinder_SetLimits(CMatch
  668. p->posLimit = p->pos + limit;
  669. }
  670. -void MatchFinder_Init(CMatchFinder *p)
  671. +static void MatchFinder_Init(CMatchFinder *p)
  672. {
  673. UInt32 i;
  674. for (i = 0; i < p->hashSizeSum; i++)
  675. @@ -287,7 +285,7 @@ static UInt32 MatchFinder_GetSubValue(CM
  676. return (p->pos - p->historySize - 1) & kNormalizeMask;
  677. }
  678. -void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
  679. +static void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
  680. {
  681. UInt32 i;
  682. for (i = 0; i < numItems; i++)
  683. @@ -319,38 +317,7 @@ static void MatchFinder_CheckLimits(CMat
  684. MatchFinder_SetLimits(p);
  685. }
  686. -static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
  687. - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
  688. - UInt32 *distances, UInt32 maxLen)
  689. -{
  690. - son[_cyclicBufferPos] = curMatch;
  691. - for (;;)
  692. - {
  693. - UInt32 delta = pos - curMatch;
  694. - if (cutValue-- == 0 || delta >= _cyclicBufferSize)
  695. - return distances;
  696. - {
  697. - const Byte *pb = cur - delta;
  698. - curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
  699. - if (pb[maxLen] == cur[maxLen] && *pb == *cur)
  700. - {
  701. - UInt32 len = 0;
  702. - while (++len != lenLimit)
  703. - if (pb[len] != cur[len])
  704. - break;
  705. - if (maxLen < len)
  706. - {
  707. - *distances++ = maxLen = len;
  708. - *distances++ = delta - 1;
  709. - if (len == lenLimit)
  710. - return distances;
  711. - }
  712. - }
  713. - }
  714. - }
  715. -}
  716. -
  717. -UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
  718. +static UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
  719. UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
  720. UInt32 *distances, UInt32 maxLen)
  721. {
  722. @@ -460,10 +427,10 @@ static void SkipMatchesSpec(UInt32 lenLi
  723. p->buffer++; \
  724. if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
  725. -#define MOVE_POS_RET MOVE_POS return offset;
  726. -
  727. static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
  728. +#define MOVE_POS_RET MatchFinder_MovePos(p); return offset;
  729. +
  730. #define GET_MATCHES_HEADER2(minLen, ret_op) \
  731. UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
  732. lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
  733. @@ -479,62 +446,7 @@ static void MatchFinder_MovePos(CMatchFi
  734. distances + offset, maxLen) - distances); MOVE_POS_RET;
  735. #define SKIP_FOOTER \
  736. - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
  737. -
  738. -static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
  739. -{
  740. - UInt32 offset;
  741. - GET_MATCHES_HEADER(2)
  742. - HASH2_CALC;
  743. - curMatch = p->hash[hashValue];
  744. - p->hash[hashValue] = p->pos;
  745. - offset = 0;
  746. - GET_MATCHES_FOOTER(offset, 1)
  747. -}
  748. -
  749. -UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
  750. -{
  751. - UInt32 offset;
  752. - GET_MATCHES_HEADER(3)
  753. - HASH_ZIP_CALC;
  754. - curMatch = p->hash[hashValue];
  755. - p->hash[hashValue] = p->pos;
  756. - offset = 0;
  757. - GET_MATCHES_FOOTER(offset, 2)
  758. -}
  759. -
  760. -static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
  761. -{
  762. - UInt32 hash2Value, delta2, maxLen, offset;
  763. - GET_MATCHES_HEADER(3)
  764. -
  765. - HASH3_CALC;
  766. -
  767. - delta2 = p->pos - p->hash[hash2Value];
  768. - curMatch = p->hash[kFix3HashSize + hashValue];
  769. -
  770. - p->hash[hash2Value] =
  771. - p->hash[kFix3HashSize + hashValue] = p->pos;
  772. -
  773. -
  774. - maxLen = 2;
  775. - offset = 0;
  776. - if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
  777. - {
  778. - for (; maxLen != lenLimit; maxLen++)
  779. - if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
  780. - break;
  781. - distances[0] = maxLen;
  782. - distances[1] = delta2 - 1;
  783. - offset = 2;
  784. - if (maxLen == lenLimit)
  785. - {
  786. - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
  787. - MOVE_POS_RET;
  788. - }
  789. - }
  790. - GET_MATCHES_FOOTER(offset, maxLen)
  791. -}
  792. + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MatchFinder_MovePos(p);
  793. static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
  794. {
  795. @@ -583,108 +495,6 @@ static UInt32 Bt4_MatchFinder_GetMatches
  796. GET_MATCHES_FOOTER(offset, maxLen)
  797. }
  798. -static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
  799. -{
  800. - UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
  801. - GET_MATCHES_HEADER(4)
  802. -
  803. - HASH4_CALC;
  804. -
  805. - delta2 = p->pos - p->hash[ hash2Value];
  806. - delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
  807. - curMatch = p->hash[kFix4HashSize + hashValue];
  808. -
  809. - p->hash[ hash2Value] =
  810. - p->hash[kFix3HashSize + hash3Value] =
  811. - p->hash[kFix4HashSize + hashValue] = p->pos;
  812. -
  813. - maxLen = 1;
  814. - offset = 0;
  815. - if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
  816. - {
  817. - distances[0] = maxLen = 2;
  818. - distances[1] = delta2 - 1;
  819. - offset = 2;
  820. - }
  821. - if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
  822. - {
  823. - maxLen = 3;
  824. - distances[offset + 1] = delta3 - 1;
  825. - offset += 2;
  826. - delta2 = delta3;
  827. - }
  828. - if (offset != 0)
  829. - {
  830. - for (; maxLen != lenLimit; maxLen++)
  831. - if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
  832. - break;
  833. - distances[offset - 2] = maxLen;
  834. - if (maxLen == lenLimit)
  835. - {
  836. - p->son[p->cyclicBufferPos] = curMatch;
  837. - MOVE_POS_RET;
  838. - }
  839. - }
  840. - if (maxLen < 3)
  841. - maxLen = 3;
  842. - offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
  843. - distances + offset, maxLen) - (distances));
  844. - MOVE_POS_RET
  845. -}
  846. -
  847. -UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
  848. -{
  849. - UInt32 offset;
  850. - GET_MATCHES_HEADER(3)
  851. - HASH_ZIP_CALC;
  852. - curMatch = p->hash[hashValue];
  853. - p->hash[hashValue] = p->pos;
  854. - offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
  855. - distances, 2) - (distances));
  856. - MOVE_POS_RET
  857. -}
  858. -
  859. -static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
  860. -{
  861. - do
  862. - {
  863. - SKIP_HEADER(2)
  864. - HASH2_CALC;
  865. - curMatch = p->hash[hashValue];
  866. - p->hash[hashValue] = p->pos;
  867. - SKIP_FOOTER
  868. - }
  869. - while (--num != 0);
  870. -}
  871. -
  872. -void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
  873. -{
  874. - do
  875. - {
  876. - SKIP_HEADER(3)
  877. - HASH_ZIP_CALC;
  878. - curMatch = p->hash[hashValue];
  879. - p->hash[hashValue] = p->pos;
  880. - SKIP_FOOTER
  881. - }
  882. - while (--num != 0);
  883. -}
  884. -
  885. -static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
  886. -{
  887. - do
  888. - {
  889. - UInt32 hash2Value;
  890. - SKIP_HEADER(3)
  891. - HASH3_CALC;
  892. - curMatch = p->hash[kFix3HashSize + hashValue];
  893. - p->hash[hash2Value] =
  894. - p->hash[kFix3HashSize + hashValue] = p->pos;
  895. - SKIP_FOOTER
  896. - }
  897. - while (--num != 0);
  898. -}
  899. -
  900. static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
  901. {
  902. do
  903. @@ -701,61 +511,12 @@ static void Bt4_MatchFinder_Skip(CMatchF
  904. while (--num != 0);
  905. }
  906. -static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
  907. -{
  908. - do
  909. - {
  910. - UInt32 hash2Value, hash3Value;
  911. - SKIP_HEADER(4)
  912. - HASH4_CALC;
  913. - curMatch = p->hash[kFix4HashSize + hashValue];
  914. - p->hash[ hash2Value] =
  915. - p->hash[kFix3HashSize + hash3Value] =
  916. - p->hash[kFix4HashSize + hashValue] = p->pos;
  917. - p->son[p->cyclicBufferPos] = curMatch;
  918. - MOVE_POS
  919. - }
  920. - while (--num != 0);
  921. -}
  922. -
  923. -void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
  924. -{
  925. - do
  926. - {
  927. - SKIP_HEADER(3)
  928. - HASH_ZIP_CALC;
  929. - curMatch = p->hash[hashValue];
  930. - p->hash[hashValue] = p->pos;
  931. - p->son[p->cyclicBufferPos] = curMatch;
  932. - MOVE_POS
  933. - }
  934. - while (--num != 0);
  935. -}
  936. -
  937. void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
  938. {
  939. vTable->Init = (Mf_Init_Func)MatchFinder_Init;
  940. vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
  941. vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
  942. vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
  943. - if (!p->btMode)
  944. - {
  945. - vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
  946. - vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
  947. - }
  948. - else if (p->numHashBytes == 2)
  949. - {
  950. - vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
  951. - vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
  952. - }
  953. - else if (p->numHashBytes == 3)
  954. - {
  955. - vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
  956. - vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
  957. - }
  958. - else
  959. - {
  960. - vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
  961. - vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
  962. - }
  963. + vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
  964. + vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
  965. }