diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-05-27 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:51 +0300 |
commit | 0b33f700a66fcf7f55f92b92e0b3e5c7014d769a (patch) | |
tree | d23aa39164e4e4f47767ea38832f34452f8aaa90 /CPP/7zip | |
parent | c574fc0f4bba94e693b0e22f730d355b75d4f4ce (diff) |
4.47 beta
Diffstat (limited to 'CPP/7zip')
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2Decoder.cpp | 20 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2Decoder.h | 7 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2Encoder.cpp | 21 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2Encoder.h | 14 | ||||
-rwxr-xr-x | CPP/7zip/MyVersion.h | 10 |
5 files changed, 38 insertions, 34 deletions
diff --git a/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp b/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp index 354ed03e..3f7dbc58 100755 --- a/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp +++ b/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp @@ -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; diff --git a/CPP/7zip/Compress/BZip2/BZip2Decoder.h b/CPP/7zip/Compress/BZip2/BZip2Decoder.h index d38ababe..9c965b49 100755 --- a/CPP/7zip/Compress/BZip2/BZip2Decoder.h +++ b/CPP/7zip/Compress/BZip2/BZip2Decoder.h @@ -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) {} diff --git a/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp b/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp index f1e53cd6..ac5f78e1 100755 --- a/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp +++ b/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp @@ -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()); } diff --git a/CPP/7zip/Compress/BZip2/BZip2Encoder.h b/CPP/7zip/Compress/BZip2/BZip2Encoder.h index eff93bc7..02d4cde3 100755 --- a/CPP/7zip/Compress/BZip2/BZip2Encoder.h +++ b/CPP/7zip/Compress/BZip2/BZip2Encoder.h @@ -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, diff --git a/CPP/7zip/MyVersion.h b/CPP/7zip/MyVersion.h index d0bf2759..722a2451 100755 --- a/CPP/7zip/MyVersion.h +++ b/CPP/7zip/MyVersion.h @@ -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 |