This commit is contained in:
Igor Pavlov
2022-06-23 11:43:16 +01:00
committed by Kornel
parent c3529a41f5
commit ec44a8a070
1248 changed files with 15242 additions and 2443 deletions

0
CPP/7zip/Compress/BZip2Const.h Normal file → Executable file
View File

0
CPP/7zip/Compress/BZip2Crc.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/BZip2Crc.h Normal file → Executable file
View File

0
CPP/7zip/Compress/BZip2Decoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/BZip2Decoder.h Normal file → Executable file
View File

23
CPP/7zip/Compress/BZip2Encoder.cpp Normal file → Executable file
View File

@@ -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,

6
CPP/7zip/Compress/BZip2Encoder.h Normal file → Executable file
View File

@@ -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);

0
CPP/7zip/Compress/BZip2Register.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Bcj2Coder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Bcj2Coder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Bcj2Register.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/BcjCoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/BcjCoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/BcjRegister.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/BitlDecoder.cpp Normal file → Executable file
View File

4
CPP/7zip/Compress/BitlDecoder.h Normal file → Executable file
View File

@@ -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);

0
CPP/7zip/Compress/BitlEncoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/BitmDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/BitmEncoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/BranchMisc.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/BranchMisc.h Normal file → Executable file
View File

0
CPP/7zip/Compress/BranchRegister.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/ByteSwap.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Codec.def Normal file → Executable file
View File

0
CPP/7zip/Compress/CodecExports.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/CopyCoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/CopyCoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/CopyRegister.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Deflate64Register.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/DeflateConst.h Normal file → Executable file
View File

1
CPP/7zip/Compress/DeflateDecoder.cpp Normal file → Executable file
View File

@@ -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++)
{

0
CPP/7zip/Compress/DeflateDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/DeflateEncoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/DeflateEncoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/DeflateRegister.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/DeltaFilter.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/DllExports2Compress.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/DllExportsCompress.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/HuffmanDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/ImplodeDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/ImplodeDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/ImplodeHuffmanDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/LzOutWindow.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/LzOutWindow.h Normal file → Executable file
View File

0
CPP/7zip/Compress/LzfseDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/LzfseDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/LzhDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/LzhDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Lzma2Decoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Lzma2Decoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Lzma2Encoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Lzma2Encoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Lzma2Register.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/LzmaDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/LzmaDecoder.h Normal file → Executable file
View File

7
CPP/7zip/Compress/LzmaEncoder.cpp Normal file → Executable file
View File

@@ -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

0
CPP/7zip/Compress/LzmaEncoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/LzmaRegister.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/LzmsDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/LzmsDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Lzx.h Normal file → Executable file
View File

0
CPP/7zip/Compress/LzxDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/LzxDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Mtf8.h Normal file → Executable file
View File

0
CPP/7zip/Compress/PpmdDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/PpmdDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/PpmdEncoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/PpmdEncoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/PpmdRegister.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/PpmdZip.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/PpmdZip.h Normal file → Executable file
View File

0
CPP/7zip/Compress/QuantumDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/QuantumDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar1Decoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar1Decoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar2Decoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar2Decoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar3Decoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar3Decoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar3Vm.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar3Vm.h Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar5Decoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/Rar5Decoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/RarCodecsRegister.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/ShrinkDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/ShrinkDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/StdAfx.h Normal file → Executable file
View File

0
CPP/7zip/Compress/XpressDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/XpressDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/XzDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/XzDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/XzEncoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/XzEncoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/ZDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/ZDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/ZlibDecoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/ZlibDecoder.h Normal file → Executable file
View File

0
CPP/7zip/Compress/ZlibEncoder.cpp Normal file → Executable file
View File

0
CPP/7zip/Compress/ZlibEncoder.h Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More