internal void MatchFinderMt_Destruct(ISzAlloc alloc) { mHashSync.MtSync_Destruct(); mBtSync.MtSync_Destruct(); alloc.FreeUInt32(alloc, mHashBuf); mHashBuf = null; }
public static CLzmaEnc LzmaEnc_Create(ISzAlloc alloc) { #if !DISABLE_TRACE if (!alloc.CheckAllocObject<CLzmaEnc>()) return null; #endif return new CLzmaEnc(); }
private void LzInWindow_Free(ISzAlloc alloc) { if (!mDirectInput) { alloc.FreeBytes(alloc, mBufferBase.mBuffer); mBufferBase = null; } }
private static uint[] AllocRefs(uint num, ISzAlloc alloc) { long sizeInBytes = (long)num * sizeof(uint); if (sizeInBytes / sizeof(uint) != num) { return(null); } return(alloc.AllocUInt32(alloc, num)); }
internal CMtCoder() // MtCoder_Construct { mAlloc = null; mThreads = new CMtThread[NUM_MT_CODER_THREADS_MAX]; for (int i = 0; i < mThreads.Length; i++) { mThreads[i] = new CMtThread(i, this); } CriticalSection_Init(out mCS); CriticalSection_Init(out mMtProgress.mCS); }
public SRes Lzma2Dec_Allocate(byte prop, ISzAlloc alloc) { byte[] props = new byte[LZMA_PROPS_SIZE]; SRes res; if ((res = Lzma2Dec_GetOldProps(prop, props)) != SZ_OK) { return(res); } return(mDecoder.LzmaDec_Allocate(props, LZMA_PROPS_SIZE, alloc)); }
public static bool Ppmd7_Alloc(CPpmd7 p, uint size, ISzAlloc alloc) { if (p.Base == null || p.Size != size) { Ppmd7_Free(p, alloc); p.AlignOffset = 4 - (size & 3); if ((p.Base = (byte *)alloc.Alloc(alloc, p.AlignOffset + size + UNIT_SIZE)) == null) { return(false); } p.Size = size; } return(true); }
/* ---------- One Call Interface ---------- */ /* LzmaEncode Return code: SZ_OK - OK SZ_ERROR_MEM - Memory allocation error SZ_ERROR_PARAM - Incorrect paramater SZ_ERROR_OUTPUT_EOF - output buffer overflow SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) */ public static SRes LzmaEncode(P<byte> dest, ref long destLen, P<byte> src, long srcLen, CLzmaEncProps props, P<byte> propsEncoded, ref long propsSize, bool writeEndMark, ICompressProgress progress, ISzAlloc alloc, ISzAlloc allocBig) { CLzmaEnc encoder = LzmaEnc_Create(alloc); if (encoder == null) return SZ_ERROR_MEM; SRes res; res = encoder.LzmaEnc_SetProps(props); if (res == SZ_OK) { res = encoder.LzmaEnc_WriteProperties(propsEncoded, ref propsSize); if (res == SZ_OK) res = encoder.LzmaEnc_MemEncode(dest, ref destLen, src, srcLen, writeEndMark, progress, alloc, allocBig); } encoder.LzmaEnc_Destroy(alloc, allocBig); return res; }
// keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) private bool LzInWindow_Create(uint keepSizeReserv, ISzAlloc alloc) { uint blockSize = mKeepSizeBefore + mKeepSizeAfter + keepSizeReserv; if (mDirectInput) { mBlockSize = blockSize; return(true); } if (mBufferBase == null || mBlockSize != blockSize) { LzInWindow_Free(alloc); mBlockSize = blockSize; mBufferBase = alloc.AllocBytes(alloc, (long)blockSize); } return(mBufferBase != null); }
// Lzma2Enc_Create public CLzma2Enc(ISzAlloc alloc, ISzAlloc allocBig) { Trace.AllocSmallObject("CLzma2Enc", alloc); mProps.Lzma2EncProps_Init(); mProps.Lzma2EncProps_Normalize(); mOutBuf = null; mAlloc = alloc; mAllocBig = allocBig; mCoders = new CLzma2EncInternal[NUM_MT_CODER_THREADS_MAX]; for (int i = 0; i < mCoders.Length; i++) { mCoders[i] = new CLzma2EncInternal(); mCoders[i].mEnc = null; } #if !_7ZIP_ST mMtCoder = new CMtCoder(); #endif }
public CLzma2Enc(ISzAlloc alloc, ISzAlloc allocBig) // Lzma2Enc_Create { Trace.AllocSmallObject("CLzma2Enc", alloc); mProps.Lzma2EncProps_Init(); mProps.Lzma2EncProps_Normalize(); mOutBuf = null; mAlloc = alloc; mAllocBig = allocBig; mCoders = new CLzma2EncInternal[NUM_MT_CODER_THREADS_MAX]; for (int i = 0; i < mCoders.Length; i++) { mCoders[i] = new CLzma2EncInternal(); mCoders[i].mEnc = null; } #if !_7ZIP_ST mMtCoder = new CMtCoder(); #endif }
/* finishMode: It has meaning only if the decoding reaches output limit (*destLen). LZMA_FINISH_ANY - use smallest number of input bytes LZMA_FINISH_END - read EndOfStream marker after decoding Returns: SZ_OK status: LZMA_STATUS_FINISHED_WITH_MARK LZMA_STATUS_NOT_FINISHED SZ_ERROR_DATA - Data error SZ_ERROR_MEM - Memory allocation error SZ_ERROR_UNSUPPORTED - Unsupported properties SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). */ public static SRes Lzma2Decode(P<byte> dest, ref long destLen, P<byte> src, ref long srcLen, byte prop, ELzmaFinishMode finishMode, out ELzmaStatus status, ISzAlloc alloc) { long outSize = destLen; long inSize = srcLen; destLen = 0; srcLen = 0; status = ELzmaStatus.LZMA_STATUS_NOT_SPECIFIED; CLzma2Dec p = new CLzma2Dec(); p.Lzma2Dec_Construct(); SRes res; if ((res = p.Lzma2Dec_AllocateProbs(prop, alloc)) != SZ_OK) return res; p.mDecoder.mDic = dest; p.mDecoder.mDicBufSize = outSize; p.Lzma2Dec_Init(); srcLen = inSize; res = p.Lzma2Dec_DecodeToDic(outSize, src, ref srcLen, finishMode, out status); destLen = p.mDecoder.mDicPos; if (res == SZ_OK && status == ELzmaStatus.LZMA_STATUS_NEEDS_MORE_INPUT) res = SZ_ERROR_INPUT_EOF; p.Lzma2Dec_FreeProbs(alloc); return res; }
public void LzmaDec_FreeProbs(ISzAlloc alloc) { alloc.FreeUInt16(alloc, mProbs); mProbs = null; }
private void MatchFinder_FreeThisClassMemory(ISzAlloc alloc) { alloc.FreeUInt32(alloc, mHash); mHash = null; }
internal void RangeEnc_Free(ISzAlloc alloc) { alloc.FreeBytes(alloc, mBufBase.mBuffer); mBufBase = null; }
public SRes LzmaDec_Allocate(P<byte> props, uint propsSize, ISzAlloc alloc) { CLzmaProps propNew = new CLzmaProps(); SRes res; if ((res = propNew.LzmaProps_Decode(props, propsSize)) != SZ_OK) return res; if ((res = LzmaDec_AllocateProbs2(propNew, alloc)) != SZ_OK) return res; long dicBufSize = propNew.mDicSize; if (mDic == null || dicBufSize != mDicBufSize) { LzmaDec_FreeDict(alloc); mDic = alloc.AllocBytes(alloc, dicBufSize); if (mDic == null) { LzmaDec_FreeProbs(alloc); return SZ_ERROR_MEM; } } mDicBufSize = dicBufSize; mProp = new CLzmaProps(propNew); return SZ_OK; }
internal SRes LzmaEnc_Prepare(ISeqOutStream outStream, ISeqInStream inStream, ISzAlloc alloc, ISzAlloc allocBig) { mMatchFinderBase.mStream = inStream; mNeedInit = true; mRC.mOutStream = outStream; return LzmaEnc_AllocAndInit(0, alloc, allocBig); }
internal SRes LzmaEnc_MemPrepare(P<byte> src, long srcLen, uint keepWindowSize, ISzAlloc alloc, ISzAlloc allocBig) { LzmaEnc_SetInputBuf(src, srcLen); mNeedInit = true; return LzmaEnc_AllocAndInit(keepWindowSize, alloc, allocBig); }
public SRes Lzma2Dec_AllocateProbs(byte prop, ISzAlloc alloc) { byte[] props = new byte[LZMA_PROPS_SIZE]; SRes res; if ((res = Lzma2Dec_GetOldProps(prop, props)) != SZ_OK) return res; return mDecoder.LzmaDec_AllocateProbs(props, LZMA_PROPS_SIZE, alloc); }
private SRes LzmaEnc_Alloc(uint keepWindowSize, ISzAlloc alloc, ISzAlloc allocBig) { if (!mRC.RangeEnc_Alloc(alloc)) return SZ_ERROR_MEM; bool btMode = mMatchFinderBase.mBtMode; #if !_7ZIP_ST mMtMode = (mMultiThread && !mFastMode && btMode); #endif int lclp = mLC + mLP; if (mLitProbs == null || mSaveState.mLitProbs == null || mLcLp != lclp) { LzmaEnc_FreeLits(alloc); mLitProbs = alloc.AllocUInt16(alloc, 0x300 << lclp); mSaveState.mLitProbs = alloc.AllocUInt16(alloc, 0x300 << lclp); if (mLitProbs == null || mSaveState.mLitProbs == null) { LzmaEnc_FreeLits(alloc); return SZ_ERROR_MEM; } mLcLp = lclp; } mMatchFinderBase.mBigHash = (mDictSize > kBigHashDicLimit); uint beforeSize = kNumOpts; if (beforeSize + mDictSize < keepWindowSize) beforeSize = keepWindowSize - mDictSize; #if !_7ZIP_ST if (mMtMode) { SRes res; if ((res = mMatchFinderMt.MatchFinderMt_Create(mDictSize, beforeSize, mNumFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) != SZ_OK) return res; mMatchFinderObj = mMatchFinderMt; mMatchFinderMt.MatchFinderMt_CreateVTable(out mMatchFinder); } else #endif { if (!mMatchFinderBase.MatchFinder_Create(mDictSize, beforeSize, mNumFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) return SZ_ERROR_MEM; mMatchFinderObj = mMatchFinderBase; MatchFinder_CreateVTable(mMatchFinderBase, out mMatchFinder); } return SZ_OK; }
private static uint[] AllocRefs(uint num, ISzAlloc alloc) { long sizeInBytes = (long)num * sizeof(uint); if (sizeInBytes / sizeof(uint) != num) return null; return alloc.AllocUInt32(alloc, num); }
internal void MatchFinder_Free(ISzAlloc alloc) { MatchFinder_FreeThisClassMemory(alloc); LzInWindow_Free(alloc); }
public static void Ppmd7_Free(CPpmd7 p, ISzAlloc alloc) { alloc.Free(alloc, (IntPtr)p.Base); p.Size = 0; p.Base = null; }
// MtCoder_Construct internal CMtCoder() { mAlloc = null; mThreads = new CMtThread[NUM_MT_CODER_THREADS_MAX]; for(int i = 0; i < mThreads.Length; i++) mThreads[i] = new CMtThread(i, this); CriticalSection_Init(out mCS); CriticalSection_Init(out mMtProgress.mCS); }
public void Lzma2Dec_FreeProbs(ISzAlloc alloc) { mDecoder.LzmaDec_FreeProbs(alloc); }
internal void LzmaEnc_FreeLits(ISzAlloc alloc) { alloc.FreeUInt16(alloc, mLitProbs); alloc.FreeUInt16(alloc, mSaveState.mLitProbs); mLitProbs = null; mSaveState.mLitProbs = null; }
// Conditions: // historySize <= 3 GB // keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB internal bool MatchFinder_Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter, ISzAlloc alloc) { if (historySize > kMaxHistorySize) { MatchFinder_Free(alloc); return false; } uint sizeReserv = historySize >> 1; if (historySize > ((uint)2 << 30)) sizeReserv = historySize >> 2; sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); mKeepSizeBefore = historySize + keepAddBufferBefore + 1; mKeepSizeAfter = matchMaxLen + keepAddBufferAfter; // we need one additional byte, since we use MoveBlock after pos++ and before dictionary using if (LzInWindow_Create(sizeReserv, alloc)) { uint newCyclicBufferSize = historySize + 1; uint hs; mMatchMaxLen = matchMaxLen; { mFixedHashSize = 0; if (mNumHashBytes == 2) { hs = (1 << 16) - 1; } else { hs = historySize - 1; hs |= (hs >> 1); hs |= (hs >> 2); hs |= (hs >> 4); hs |= (hs >> 8); hs >>= 1; hs |= 0xFFFF; // don't change it! It's required for Deflate if (hs > (1 << 24)) { if (mNumHashBytes == 3) hs = (1 << 24) - 1; else hs >>= 1; } } mHashMask = hs; hs++; if (mNumHashBytes > 2) mFixedHashSize += kHash2Size; if (mNumHashBytes > 3) mFixedHashSize += kHash3Size; if (mNumHashBytes > 4) mFixedHashSize += kHash4Size; hs += mFixedHashSize; } { uint prevSize = mHashSizeSum + mNumSons; mHistorySize = historySize; mHashSizeSum = hs; mCyclicBufferSize = newCyclicBufferSize; mNumSons = (mBtMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); uint newSize = mHashSizeSum + mNumSons; if (mHash != null && prevSize == newSize) return true; MatchFinder_FreeThisClassMemory(alloc); mHash = AllocRefs(newSize, alloc); if (mHash != null) { mSon = P.From(mHash, mHashSizeSum); return true; } } } MatchFinder_Free(alloc); return false; }
internal SRes LzmaEnc_AllocAndInit(uint keepWindowSize, ISzAlloc alloc, ISzAlloc allocBig) { { uint i; for (i = 0; i < (uint)kDicLogSizeMaxCompress; i++) if (mDictSize <= (1u << (int)i)) break; mDistTableSize = i * 2; } mFinished = false; mResult = SZ_OK; SRes res; if ((res = LzmaEnc_Alloc(keepWindowSize, alloc, allocBig)) != SZ_OK) return res; LzmaEnc_Init(); LzmaEnc_InitPrices(); mNowPos64 = 0; return SZ_OK; }
internal SRes MatchFinderMt_Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter, ISzAlloc alloc) { mLocalHistorySize = historySize; if (kMtBtBlockSize <= matchMaxLen * 4) { return(SZ_ERROR_PARAM); } if (mHashBuf == null) { mHashBuf = alloc.AllocUInt32(alloc, kHashBufferSize + kBtBufferSize); if (mHashBuf == null) { return(SZ_ERROR_MEM); } mBtBuf = P.From(mHashBuf, kHashBufferSize); } keepAddBufferBefore += (kHashBufferSize + kBtBufferSize); keepAddBufferAfter += kMtHashBlockSize; if (!base.MatchFinder_Create(historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc)) { return(SZ_ERROR_MEM); } SRes res; if ((res = mHashSync.MtSync_Create(HashThreadFunc, "LZMA Hash Thread", kMtHashNumBlocks)) != SZ_OK) { return(res); } if ((res = mBtSync.MtSync_Create(BtThreadFunc, "LZMA BT Thread", kMtBtNumBlocks)) != SZ_OK) { return(res); } return(SZ_OK); }
internal SRes LzmaEnc_PrepareForLzma2(ISeqInStream inStream, uint keepWindowSize, ISzAlloc alloc, ISzAlloc allocBig) { mMatchFinderBase.mStream = inStream; mNeedInit = true; return LzmaEnc_AllocAndInit(keepWindowSize, alloc, allocBig); }
internal bool RangeEnc_Alloc(ISzAlloc alloc) { if (mBufBase == null) { mBufBase = alloc.AllocBytes(alloc, kBufferSize); if (mBufBase == null) return false; mBufLim = mBufBase + kBufferSize; } return true; }
public void LzmaDec_Free(ISzAlloc alloc) { LzmaDec_FreeProbs(alloc); LzmaDec_FreeDict(alloc); }
public void Lzma2Dec_Free(ISzAlloc alloc) { mDecoder.LzmaDec_Free(alloc); }
public void LzmaEnc_Destroy(ISzAlloc alloc, ISzAlloc allocBig) { #if !_7ZIP_ST mMatchFinderMt.MatchFinderMt_Destruct(allocBig); #endif mMatchFinderBase.MatchFinder_Free(allocBig); LzmaEnc_FreeLits(alloc); mRC.RangeEnc_Free(alloc); alloc.FreeObject(alloc, this); }
/* * finishMode: * It has meaning only if the decoding reaches output limit (*destLen). * LZMA_FINISH_ANY - use smallest number of input bytes * LZMA_FINISH_END - read EndOfStream marker after decoding * * Returns: * SZ_OK * status: * LZMA_STATUS_FINISHED_WITH_MARK * LZMA_STATUS_NOT_FINISHED * SZ_ERROR_DATA - Data error * SZ_ERROR_MEM - Memory allocation error * SZ_ERROR_UNSUPPORTED - Unsupported properties * SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). */ public static SRes Lzma2Decode(P <byte> dest, ref long destLen, P <byte> src, ref long srcLen, byte prop, ELzmaFinishMode finishMode, out ELzmaStatus status, ISzAlloc alloc) { long outSize = destLen; long inSize = srcLen; destLen = 0; srcLen = 0; status = ELzmaStatus.LZMA_STATUS_NOT_SPECIFIED; CLzma2Dec p = new CLzma2Dec(); p.Lzma2Dec_Construct(); SRes res; if ((res = p.Lzma2Dec_AllocateProbs(prop, alloc)) != SZ_OK) { return(res); } p.mDecoder.mDic = dest; p.mDecoder.mDicBufSize = outSize; p.Lzma2Dec_Init(); srcLen = inSize; res = p.Lzma2Dec_DecodeToDic(outSize, src, ref srcLen, finishMode, out status); destLen = p.mDecoder.mDicPos; if (res == SZ_OK && status == ELzmaStatus.LZMA_STATUS_NEEDS_MORE_INPUT) { res = SZ_ERROR_INPUT_EOF; } p.Lzma2Dec_FreeProbs(alloc); return(res); }
public SRes LzmaEnc_Encode(ISeqOutStream outStream, ISeqInStream inStream, ICompressProgress progress, ISzAlloc alloc, ISzAlloc allocBig) { SRes res; if ((res = LzmaEnc_Prepare(outStream, inStream, alloc, allocBig)) != SZ_OK) return res; return LzmaEnc_Encode2(progress); }
/* ---------- Interfaces ---------- */ /* There are 3 levels of interfaces: 1) Dictionary Interface 2) Buffer Interface 3) One Call Interface You can select any of these interfaces, but don't mix functions from different groups for same object. */ /* There are two variants to allocate state for Dictionary Interface: 1) LzmaDec_Allocate / LzmaDec_Free 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs You can use variant 2, if you set dictionary buffer manually. For Buffer Interface you must always use variant 1. LzmaDec_Allocate* can return: SZ_OK SZ_ERROR_MEM - Memory allocation error SZ_ERROR_UNSUPPORTED - Unsupported properties */ public SRes LzmaDec_AllocateProbs(P<byte> props, uint propsSize, ISzAlloc alloc) { SRes res; CLzmaProps propNew = new CLzmaProps(); if ((res = propNew.LzmaProps_Decode(props, propsSize)) != SZ_OK) return res; if ((res = LzmaDec_AllocateProbs2(propNew, alloc)) != SZ_OK) return res; mProp = new CLzmaProps(propNew); return SZ_OK; }
public SRes LzmaEnc_MemEncode(P<byte> dest, ref long destLen, P<byte> src, long srcLen, bool writeEndMark, ICompressProgress progress, ISzAlloc alloc, ISzAlloc allocBig) { CSeqOutStreamBuf outStream = new CSeqOutStreamBuf(); LzmaEnc_SetInputBuf(src, srcLen); outStream.mData = dest; outStream.mRem = destLen; outStream.mOverflow = false; mWriteEndMark = writeEndMark; mRC.mOutStream = outStream; SRes res = LzmaEnc_MemPrepare(src, srcLen, 0, alloc, allocBig); if (res == SZ_OK) res = LzmaEnc_Encode2(progress); destLen -= outStream.mRem; if (outStream.mOverflow) return SZ_ERROR_OUTPUT_EOF; return res; }
// keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) private bool LzInWindow_Create(uint keepSizeReserv, ISzAlloc alloc) { uint blockSize = mKeepSizeBefore + mKeepSizeAfter + keepSizeReserv; if (mDirectInput) { mBlockSize = blockSize; return true; } if (mBufferBase == null || mBlockSize != blockSize) { LzInWindow_Free(alloc); mBlockSize = blockSize; mBufferBase = alloc.AllocBytes(alloc, (long)blockSize); } return mBufferBase != null; }
// Conditions: // historySize <= 3 GB // keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB internal bool MatchFinder_Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter, ISzAlloc alloc) { if (historySize > kMaxHistorySize) { MatchFinder_Free(alloc); return(false); } uint sizeReserv = historySize >> 1; if (historySize > ((uint)2 << 30)) { sizeReserv = historySize >> 2; } sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); mKeepSizeBefore = historySize + keepAddBufferBefore + 1; mKeepSizeAfter = matchMaxLen + keepAddBufferAfter; // we need one additional byte, since we use MoveBlock after pos++ and before dictionary using if (LzInWindow_Create(sizeReserv, alloc)) { uint newCyclicBufferSize = historySize + 1; uint hs; mMatchMaxLen = matchMaxLen; { mFixedHashSize = 0; if (mNumHashBytes == 2) { hs = (1 << 16) - 1; } else { hs = historySize - 1; hs |= (hs >> 1); hs |= (hs >> 2); hs |= (hs >> 4); hs |= (hs >> 8); hs >>= 1; hs |= 0xFFFF; // don't change it! It's required for Deflate if (hs > (1 << 24)) { if (mNumHashBytes == 3) { hs = (1 << 24) - 1; } else { hs >>= 1; } } } mHashMask = hs; hs++; if (mNumHashBytes > 2) { mFixedHashSize += kHash2Size; } if (mNumHashBytes > 3) { mFixedHashSize += kHash3Size; } if (mNumHashBytes > 4) { mFixedHashSize += kHash4Size; } hs += mFixedHashSize; } { uint prevSize = mHashSizeSum + mNumSons; mHistorySize = historySize; mHashSizeSum = hs; mCyclicBufferSize = newCyclicBufferSize; mNumSons = (mBtMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); uint newSize = mHashSizeSum + mNumSons; if (mHash != null && prevSize == newSize) { return(true); } MatchFinder_FreeThisClassMemory(alloc); mHash = AllocRefs(newSize, alloc); if (mHash != null) { mSon = P.From(mHash, mHashSizeSum); return(true); } } } MatchFinder_Free(alloc); return(false); }
internal SRes MatchFinderMt_Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter, ISzAlloc alloc) { mLocalHistorySize = historySize; if(kMtBtBlockSize <= matchMaxLen * 4) return SZ_ERROR_PARAM; if(mHashBuf == null) { mHashBuf = alloc.AllocUInt32(alloc, kHashBufferSize + kBtBufferSize); if(mHashBuf == null) return SZ_ERROR_MEM; mBtBuf = P.From(mHashBuf, kHashBufferSize); } keepAddBufferBefore += (kHashBufferSize + kBtBufferSize); keepAddBufferAfter += kMtHashBlockSize; if(!base.MatchFinder_Create(historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc)) return SZ_ERROR_MEM; SRes res; if((res = mHashSync.MtSync_Create(HashThreadFunc, "LZMA Hash Thread", kMtHashNumBlocks)) != SZ_OK) return res; if((res = mBtSync.MtSync_Create(BtThreadFunc, "LZMA BT Thread", kMtBtNumBlocks)) != SZ_OK) return res; return SZ_OK; }