mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 04:07:08 -06:00
Update to 7-Zip Version 22.00
See: https://sourceforge.net/p/sevenzip/discussion/45797/thread/9c2d9061ce/
This commit is contained in:
@@ -98,8 +98,8 @@ THREAD_FUNC_RET_TYPE CThreadInfo::ThreadFunc()
|
||||
bool needLeave = true;
|
||||
try
|
||||
{
|
||||
UInt32 blockSize = Encoder->ReadRleBlock(m_Block);
|
||||
m_PackSize = Encoder->m_InStream.GetProcessedSize();
|
||||
const UInt32 blockSize = Encoder->ReadRleBlock(m_Block);
|
||||
m_UnpackSize = Encoder->m_InStream.GetProcessedSize();
|
||||
m_BlockIndex = Encoder->NextBlockIndex;
|
||||
if (++Encoder->NextBlockIndex == Encoder->NumThreads)
|
||||
Encoder->NextBlockIndex = 0;
|
||||
@@ -222,7 +222,8 @@ UInt32 CEncoder::ReadRleBlock(Byte *buffer)
|
||||
Byte prevByte;
|
||||
if (m_InStream.ReadByte(prevByte))
|
||||
{
|
||||
UInt32 blockSize = _props.BlockSizeMult * kBlockSizeStep - 1;
|
||||
NumBlocks++;
|
||||
const UInt32 blockSize = _props.BlockSizeMult * kBlockSizeStep - 1;
|
||||
unsigned numReps = 1;
|
||||
buffer[i++] = prevByte;
|
||||
while (i < blockSize) // "- 1" to support RLE
|
||||
@@ -722,8 +723,8 @@ HRESULT CThreadInfo::EncodeBlock3(UInt32 blockSize)
|
||||
|
||||
if (Encoder->Progress)
|
||||
{
|
||||
UInt64 unpackSize = Encoder->m_OutStream.GetProcessedSize();
|
||||
res = Encoder->Progress->SetRatioInfo(&m_PackSize, &unpackSize);
|
||||
const UInt64 packSize = Encoder->m_OutStream.GetProcessedSize();
|
||||
res = Encoder->Progress->SetRatioInfo(&m_UnpackSize, &packSize);
|
||||
}
|
||||
|
||||
Encoder->ThreadsInfo[blockIndex].CanWriteEvent.Set();
|
||||
@@ -744,6 +745,7 @@ void CEncoder::WriteBytes(const Byte *data, UInt32 sizeInBits, Byte lastByte)
|
||||
HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
|
||||
const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
|
||||
{
|
||||
NumBlocks = 0;
|
||||
#ifndef _7ZIP_ST
|
||||
Progress = progress;
|
||||
RINOK(Create());
|
||||
@@ -831,9 +833,9 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
RINOK(ti.EncodeBlock3(blockSize));
|
||||
if (progress)
|
||||
{
|
||||
UInt64 packSize = m_InStream.GetProcessedSize();
|
||||
UInt64 unpackSize = m_OutStream.GetProcessedSize();
|
||||
RINOK(progress->SetRatioInfo(&packSize, &unpackSize));
|
||||
const UInt64 unpackSize = m_InStream.GetProcessedSize();
|
||||
const UInt64 packSize = m_OutStream.GetProcessedSize();
|
||||
RINOK(progress->SetRatioInfo(&unpackSize, &packSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -845,7 +847,10 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
|
||||
WriteByte(kFinSig5);
|
||||
|
||||
WriteCrc(CombinedCrc.GetDigest());
|
||||
return Flush();
|
||||
RINOK(Flush());
|
||||
if (!m_InStream.WasFinished())
|
||||
return E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
|
||||
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
// it's not member of this thread. We just need one event per thread
|
||||
NWindows::NSynchronization::CAutoResetEvent CanWriteEvent;
|
||||
|
||||
UInt64 m_PackSize;
|
||||
UInt64 m_UnpackSize;
|
||||
|
||||
Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
|
||||
HRESULT Create();
|
||||
@@ -195,6 +195,10 @@ public:
|
||||
CThreadInfo ThreadsInfo;
|
||||
#endif
|
||||
|
||||
UInt64 NumBlocks;
|
||||
|
||||
UInt64 GetInProcessedSize() const { return m_InStream.GetProcessedSize(); }
|
||||
|
||||
UInt32 ReadRleBlock(Byte *buf);
|
||||
void WriteBytes(const Byte *data, UInt32 sizeInBits, Byte lastByte);
|
||||
|
||||
|
||||
@@ -155,6 +155,10 @@ public:
|
||||
MY_FORCE_INLINE
|
||||
bool ReadAlignedByte_FromBuf(Byte &b)
|
||||
{
|
||||
if (this->_stream.NumExtraBytes != 0)
|
||||
if (this->_stream.NumExtraBytes >= 4
|
||||
|| kNumBigValueBits - this->_bitPos <= (this->_stream.NumExtraBytes << 3))
|
||||
return false;
|
||||
if (this->_bitPos == kNumBigValueBits)
|
||||
return this->_stream.ReadByte_FromBuf(b);
|
||||
b = (Byte)(_normalValue & 0xFF);
|
||||
|
||||
@@ -426,7 +426,6 @@ STDMETHODIMP CCoder::ReadUnusedFromInBuf(void *data, UInt32 size, UInt32 *proces
|
||||
{
|
||||
AlignToByte();
|
||||
UInt32 i = 0;
|
||||
if (!m_InBitStream.ExtraBitsWereRead())
|
||||
{
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
|
||||
@@ -9,14 +9,15 @@
|
||||
|
||||
#include "LzmaEncoder.h"
|
||||
|
||||
#include "../../Common/IntToString.h"
|
||||
#include "../../Windows/TimeUtils.h"
|
||||
|
||||
// #define LOG_LZMA_THREADS
|
||||
|
||||
#ifdef LOG_LZMA_THREADS
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../../Common/IntToString.h"
|
||||
#include "../../Windows/TimeUtils.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
void LzmaEnc_GetLzThreads(CLzmaEncHandle pp, HANDLE lz_threads[2]);
|
||||
EXTERN_C_END
|
||||
|
||||
Reference in New Issue
Block a user