mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 09:14:58 -06:00
4.47 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
c574fc0f4b
commit
0b33f700a6
@@ -420,8 +420,6 @@ static UInt32 NO_INLINE DecodeBlock2Rand(const UInt32 *tt, UInt32 blockSize, UIn
|
||||
|
||||
#ifdef COMPRESS_BZIP2_MT
|
||||
|
||||
static THREAD_FUNC_DECL MFThread(void *p) { ((CState *)p)->ThreadFunc(); return 0; }
|
||||
|
||||
CDecoder::CDecoder():
|
||||
m_States(0)
|
||||
{
|
||||
@@ -439,7 +437,7 @@ HRes CDecoder::Create()
|
||||
RINOK(CanProcessEvent.CreateIfNotCreated());
|
||||
RINOK(CanStartWaitingEvent.CreateIfNotCreated());
|
||||
if (m_States != 0 && m_NumThreadsPrev == NumThreads)
|
||||
return true;
|
||||
return S_OK;
|
||||
Free();
|
||||
MtMode = (NumThreads > 1);
|
||||
m_NumThreadsPrev = NumThreads;
|
||||
@@ -450,14 +448,13 @@ HRes CDecoder::Create()
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
catch(...) { return E_OUTOFMEMORY; }
|
||||
#ifdef COMPRESS_BZIP2_MT
|
||||
for (UInt32 t = 0; t < NumThreads; t++)
|
||||
{
|
||||
CState &ti = m_States[t];
|
||||
ti.Decoder = this;
|
||||
if (MtMode)
|
||||
{
|
||||
HRes res = ti.Thread.Create(MFThread, &ti);
|
||||
HRes res = ti.Create();
|
||||
if (res != S_OK)
|
||||
{
|
||||
NumThreads = t;
|
||||
@@ -466,7 +463,6 @@ HRes CDecoder::Create()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -528,7 +524,6 @@ HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress)
|
||||
CState &s = m_States[t];
|
||||
if (!s.Alloc())
|
||||
return E_OUTOFMEMORY;
|
||||
RINOK(s.Create());
|
||||
s.StreamWasFinishedEvent.Reset();
|
||||
s.WaitingWasStartedEvent.Reset();
|
||||
s.CanWriteEvent.Reset();
|
||||
@@ -649,6 +644,17 @@ STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value)
|
||||
}
|
||||
|
||||
#ifdef COMPRESS_BZIP2_MT
|
||||
|
||||
static THREAD_FUNC_DECL MFThread(void *p) { ((CState *)p)->ThreadFunc(); return 0; }
|
||||
|
||||
HRes CState::Create()
|
||||
{
|
||||
RINOK(StreamWasFinishedEvent.CreateIfNotCreated());
|
||||
RINOK(WaitingWasStartedEvent.CreateIfNotCreated());
|
||||
RINOK(CanWriteEvent.CreateIfNotCreated());
|
||||
return Thread.Create(MFThread, this);
|
||||
}
|
||||
|
||||
void CState::FinishStream()
|
||||
{
|
||||
Decoder->StreamWasFinished1 = true;
|
||||
|
||||
@@ -50,15 +50,10 @@ struct CState
|
||||
|
||||
Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
|
||||
|
||||
HRes Create();
|
||||
void FinishStream();
|
||||
void ThreadFunc();
|
||||
|
||||
HRes Create()
|
||||
{
|
||||
RINOK(StreamWasFinishedEvent.CreateIfNotCreated());
|
||||
RINOK(WaitingWasStartedEvent.CreateIfNotCreated());
|
||||
return CanWriteEvent.CreateIfNotCreated();
|
||||
}
|
||||
#endif
|
||||
|
||||
CState(): Counters(0) {}
|
||||
|
||||
@@ -55,6 +55,20 @@ void CThreadInfo::Free()
|
||||
}
|
||||
|
||||
#ifdef COMPRESS_BZIP2_MT
|
||||
|
||||
static THREAD_FUNC_DECL MFThread(void *threadCoderInfo)
|
||||
{
|
||||
return ((CThreadInfo *)threadCoderInfo)->ThreadFunc();
|
||||
}
|
||||
|
||||
HRes CThreadInfo::Create()
|
||||
{
|
||||
RINOK(StreamWasFinishedEvent.Create());
|
||||
RINOK(WaitingWasStartedEvent.Create());
|
||||
RINOK(CanWriteEvent.Create());
|
||||
return Thread.Create(MFThread, this);
|
||||
}
|
||||
|
||||
void CThreadInfo::FinishStream(bool needLeave)
|
||||
{
|
||||
Encoder->StreamWasFinished = true;
|
||||
@@ -111,10 +125,6 @@ DWORD CThreadInfo::ThreadFunc()
|
||||
}
|
||||
}
|
||||
|
||||
static THREAD_FUNC_DECL MFThread(void *threadCoderInfo)
|
||||
{
|
||||
return ((CThreadInfo *)threadCoderInfo)->ThreadFunc();
|
||||
}
|
||||
#endif
|
||||
|
||||
CEncoder::CEncoder():
|
||||
@@ -157,7 +167,7 @@ HRes CEncoder::Create()
|
||||
ti.Encoder = this;
|
||||
if (MtMode)
|
||||
{
|
||||
HRes res = ti.Thread.Create(MFThread, &ti);
|
||||
HRes res = ti.Create();
|
||||
if (res != S_OK)
|
||||
{
|
||||
NumThreads = t;
|
||||
@@ -735,7 +745,6 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
|
||||
|
||||
if (!ti.Alloc())
|
||||
return E_OUTOFMEMORY;
|
||||
RINOK(ti.Create());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -105,8 +105,6 @@ private:
|
||||
|
||||
int m_BlockIndex;
|
||||
|
||||
void FinishStream(bool needLeave);
|
||||
|
||||
void WriteBits2(UInt32 value, UInt32 numBits);
|
||||
void WriteByte2(Byte b);
|
||||
void WriteBit2(bool v);
|
||||
@@ -130,12 +128,9 @@ public:
|
||||
UInt64 m_PackSize;
|
||||
|
||||
Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
|
||||
HRes Create()
|
||||
{
|
||||
RINOK(StreamWasFinishedEvent.Create());
|
||||
RINOK(WaitingWasStartedEvent.Create());
|
||||
return CanWriteEvent.Create();
|
||||
}
|
||||
HRes Create();
|
||||
void FinishStream(bool needLeave);
|
||||
DWORD ThreadFunc();
|
||||
#endif
|
||||
|
||||
CThreadInfo(): m_BlockSorterIndex(0), m_Block(0) {}
|
||||
@@ -144,7 +139,6 @@ public:
|
||||
void Free();
|
||||
|
||||
HRESULT EncodeBlock3(UInt32 blockSize);
|
||||
DWORD ThreadFunc();
|
||||
};
|
||||
|
||||
class CEncoder :
|
||||
@@ -230,7 +224,7 @@ public:
|
||||
#ifdef COMPRESS_BZIP2_MT
|
||||
MY_UNKNOWN_IMP2(ICompressSetCoderMt, ICompressSetCoderProperties)
|
||||
#else
|
||||
MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
|
||||
MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
|
||||
#endif
|
||||
|
||||
HRESULT CodeReal(ISequentialInStream *inStream,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#define MY_VER_MAJOR 4
|
||||
#define MY_VER_MINOR 46
|
||||
#define MY_VER_BUILD 2
|
||||
#define MY_VERSION "4.46 beta"
|
||||
#define MY_7ZIP_VERSION "7-Zip 4.46 beta"
|
||||
#define MY_DATE "2007-05-25"
|
||||
#define MY_VER_MINOR 47
|
||||
#define MY_VER_BUILD 0
|
||||
#define MY_VERSION "4.47 beta"
|
||||
#define MY_7ZIP_VERSION "7-Zip 4.47 beta"
|
||||
#define MY_DATE "2007-05-27"
|
||||
#define MY_COPYRIGHT "Copyright (c) 1999-2007 Igor Pavlov"
|
||||
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
|
||||
|
||||
Reference in New Issue
Block a user