mirror of
https://github.com/Xevion/easy7zip.git
synced 2026-01-31 22:24:08 -06:00
23.01
This commit is contained in:
@@ -46,7 +46,7 @@ void CThreadInfo::Free()
|
||||
m_Block = NULL;
|
||||
}
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
|
||||
static THREAD_FUNC_DECL MFThread(void *threadCoderInfo)
|
||||
{
|
||||
@@ -146,14 +146,14 @@ CEncoder::CEncoder()
|
||||
{
|
||||
_props.Normalize(-1);
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
ThreadsInfo = NULL;
|
||||
m_NumThreadsPrev = 0;
|
||||
NumThreads = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
CEncoder::~CEncoder()
|
||||
{
|
||||
Free();
|
||||
@@ -558,8 +558,8 @@ void CThreadInfo::EncodeBlock(const Byte *block, UInt32 blockSize)
|
||||
{
|
||||
UInt32 groupSize = 0;
|
||||
UInt32 groupIndex = 0;
|
||||
const Byte *lens = 0;
|
||||
const UInt32 *codes = 0;
|
||||
const Byte *lens = NULL;
|
||||
const UInt32 *codes = NULL;
|
||||
UInt32 mtfPos = 0;
|
||||
do
|
||||
{
|
||||
@@ -706,7 +706,7 @@ HRESULT CThreadInfo::EncodeBlock3(UInt32 blockSize)
|
||||
|
||||
EncodeBlock2(m_Block, blockSize, Encoder->_props.NumPasses);
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
if (Encoder->MtMode)
|
||||
Encoder->ThreadsInfo[m_BlockIndex].CanWriteEvent.Lock();
|
||||
#endif
|
||||
@@ -714,7 +714,7 @@ HRESULT CThreadInfo::EncodeBlock3(UInt32 blockSize)
|
||||
Encoder->CombinedCrc.Update(m_CRCs[i]);
|
||||
Encoder->WriteBytes(m_TempArray, outStreamTemp.GetPos(), outStreamTemp.GetCurByte());
|
||||
HRESULT res = S_OK;
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
if (Encoder->MtMode)
|
||||
{
|
||||
UInt32 blockIndex = m_BlockIndex + 1;
|
||||
@@ -746,13 +746,13 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
|
||||
{
|
||||
NumBlocks = 0;
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
Progress = progress;
|
||||
RINOK(Create());
|
||||
RINOK(Create())
|
||||
for (UInt32 t = 0; t < NumThreads; t++)
|
||||
#endif
|
||||
{
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
CThreadInfo &ti = ThreadsInfo[t];
|
||||
if (MtMode)
|
||||
{
|
||||
@@ -787,7 +787,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
m_OutStream.Init();
|
||||
|
||||
CombinedCrc.Init();
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
NextBlockIndex = 0;
|
||||
StreamWasFinished = false;
|
||||
CloseThreads = false;
|
||||
@@ -799,7 +799,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
WriteByte(kArSig2);
|
||||
WriteByte((Byte)(kArSig3 + _props.BlockSizeMult));
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
|
||||
if (MtMode)
|
||||
{
|
||||
@@ -814,7 +814,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
for (t = 0; t < NumThreads; t++)
|
||||
ThreadsInfo[t].WaitingWasStartedEvent.Lock();
|
||||
CanStartWaitingEvent.Reset();
|
||||
RINOK(Result);
|
||||
RINOK(Result)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -822,7 +822,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
for (;;)
|
||||
{
|
||||
CThreadInfo &ti =
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
ThreadsInfo[0];
|
||||
#else
|
||||
ThreadsInfo;
|
||||
@@ -830,12 +830,12 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
UInt32 blockSize = ReadRleBlock(ti.m_Block);
|
||||
if (blockSize == 0)
|
||||
break;
|
||||
RINOK(ti.EncodeBlock3(blockSize));
|
||||
RINOK(ti.EncodeBlock3(blockSize))
|
||||
if (progress)
|
||||
{
|
||||
const UInt64 unpackSize = m_InStream.GetProcessedSize();
|
||||
const UInt64 packSize = m_OutStream.GetProcessedSize();
|
||||
RINOK(progress->SetRatioInfo(&unpackSize, &packSize));
|
||||
RINOK(progress->SetRatioInfo(&unpackSize, &packSize))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -847,14 +847,14 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
WriteByte(kFinSig5);
|
||||
|
||||
WriteCrc(CombinedCrc.GetDigest());
|
||||
RINOK(Flush());
|
||||
RINOK(Flush())
|
||||
if (!m_InStream.WasFinished())
|
||||
return E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
|
||||
Z7_COM7F_IMF(CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress))
|
||||
{
|
||||
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
|
||||
catch(const CInBufferException &e) { return e.ErrorCode; }
|
||||
@@ -862,7 +862,7 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream
|
||||
catch(...) { return S_FALSE; }
|
||||
}
|
||||
|
||||
HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *coderProps, UInt32 numProps)
|
||||
Z7_COM7F_IMF(CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *coderProps, UInt32 numProps))
|
||||
{
|
||||
int level = -1;
|
||||
CEncProps props;
|
||||
@@ -892,7 +892,7 @@ HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *c
|
||||
case NCoderPropID::kLevel: level = (int)v; break;
|
||||
case NCoderPropID::kNumThreads:
|
||||
{
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
SetNumberOfThreads(v);
|
||||
#endif
|
||||
break;
|
||||
@@ -905,8 +905,8 @@ HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *c
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
STDMETHODIMP CEncoder::SetNumberOfThreads(UInt32 numThreads)
|
||||
#ifndef Z7_ST
|
||||
Z7_COM7F_IMF(CEncoder::SetNumberOfThreads(UInt32 numThreads))
|
||||
{
|
||||
const UInt32 kNumThreadsMax = 64;
|
||||
if (numThreads < 1) numThreads = 1;
|
||||
|
||||
Reference in New Issue
Block a user