mirror of
https://github.com/Xevion/easy7zip.git
synced 2026-01-31 12:24:08 -06:00
9.34
This commit is contained in:
committed by
Kornel Lesiński
parent
83f8ddcc5b
commit
f08f4dcc3c
Executable → Regular
+26
-30
@@ -18,6 +18,9 @@ namespace NCompress {
|
||||
namespace NDeflate {
|
||||
namespace NDecoder {
|
||||
|
||||
const int kLenIdFinished = -1;
|
||||
const int kLenIdNeedInit = -2;
|
||||
|
||||
class CCoder:
|
||||
public ICompressCoder,
|
||||
public ICompressGetInStreamProcessedSize,
|
||||
@@ -29,6 +32,7 @@ class CCoder:
|
||||
public CMyUnknownImp
|
||||
{
|
||||
CLzOutWindow m_OutWindowStream;
|
||||
CMyComPtr<ISequentialInStream> m_InStreamRef;
|
||||
NBitl::CDecoder<CInBuffer> m_InBitStream;
|
||||
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kFixedMainTableSize> m_MainDecoder;
|
||||
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kFixedDistTableSize> m_DistDecoder;
|
||||
@@ -36,22 +40,23 @@ class CCoder:
|
||||
|
||||
UInt32 m_StoredBlockSize;
|
||||
|
||||
UInt32 _numDistLevels;
|
||||
bool m_FinalBlock;
|
||||
bool m_StoredMode;
|
||||
UInt32 _numDistLevels;
|
||||
|
||||
|
||||
bool _deflateNSIS;
|
||||
bool _deflate64Mode;
|
||||
bool _keepHistory;
|
||||
bool _needFinishInput;
|
||||
|
||||
bool _needInitInStream;
|
||||
bool _needReadTable;
|
||||
Int32 _remainLen;
|
||||
UInt32 _rep0;
|
||||
bool _needReadTable;
|
||||
|
||||
UInt32 ReadBits(int numBits);
|
||||
UInt32 ReadBits(unsigned numBits);
|
||||
|
||||
bool DeCodeLevelTable(Byte *values, int numSymbols);
|
||||
bool DeCodeLevelTable(Byte *values, unsigned numSymbols);
|
||||
bool ReadTables();
|
||||
|
||||
HRESULT Flush() { return m_OutWindowStream.Flush(); }
|
||||
@@ -65,12 +70,11 @@ class CCoder:
|
||||
{
|
||||
if (NeedFlush)
|
||||
_coder->Flush();
|
||||
_coder->ReleaseOutStream();
|
||||
}
|
||||
};
|
||||
friend class CCoderReleaser;
|
||||
|
||||
HRESULT CodeSpec(UInt32 curSize);
|
||||
HRESULT CodeSpec(UInt32 curSize, bool finishInputStream);
|
||||
public:
|
||||
bool ZlibMode;
|
||||
Byte ZlibFooter[4];
|
||||
@@ -78,12 +82,11 @@ public:
|
||||
CCoder(bool deflate64Mode, bool deflateNSIS = false);
|
||||
virtual ~CCoder() {};
|
||||
|
||||
void SetKeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
|
||||
void Set_KeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
|
||||
void Set_NeedFinishInput(bool needFinishInput) { _needFinishInput = needFinishInput; }
|
||||
|
||||
void ReleaseOutStream()
|
||||
{
|
||||
m_OutWindowStream.ReleaseStream();
|
||||
}
|
||||
bool IsFinished() const { return _remainLen == kLenIdFinished;; }
|
||||
bool IsFinalBlock() const { return m_FinalBlock; }
|
||||
|
||||
HRESULT CodeReal(ISequentialOutStream *outStream,
|
||||
const UInt64 *outSize, ICompressProgressInfo *progress);
|
||||
@@ -126,31 +129,24 @@ public:
|
||||
}
|
||||
|
||||
void AlignToByte() { m_InBitStream.AlignToByte(); }
|
||||
Byte ReadByte() { return (Byte)m_InBitStream.ReadBits(8); }
|
||||
Byte ReadAlignedByte();
|
||||
UInt32 ReadAligned_UInt16() // aligned for Byte range
|
||||
{
|
||||
UInt32 v = m_InBitStream.ReadAlignedByte();
|
||||
return v | ((UInt32)m_InBitStream.ReadAlignedByte() << 8);
|
||||
}
|
||||
bool InputEofError() const { return m_InBitStream.ExtraBitsWereRead(); }
|
||||
|
||||
UInt64 GetStreamSize() const { return m_InBitStream.GetStreamSize(); }
|
||||
UInt64 GetInputProcessedSize() const { return m_InBitStream.GetProcessedSize(); }
|
||||
|
||||
// IGetInStreamProcessedSize
|
||||
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
|
||||
};
|
||||
|
||||
class CCOMCoder : public CCoder
|
||||
{
|
||||
public:
|
||||
CCOMCoder(): CCoder(false) {}
|
||||
};
|
||||
|
||||
class CNsisCOMCoder : public CCoder
|
||||
{
|
||||
public:
|
||||
CNsisCOMCoder(): CCoder(false, true) {}
|
||||
};
|
||||
|
||||
class CCOMCoder64 : public CCoder
|
||||
{
|
||||
public:
|
||||
CCOMCoder64(): CCoder(true) {}
|
||||
};
|
||||
class CCOMCoder : public CCoder { public: CCOMCoder(): CCoder(false) {} };
|
||||
class CNsisCOMCoder : public CCoder { public: CNsisCOMCoder(): CCoder(false, true) {} };
|
||||
class CCOMCoder64 : public CCoder { public: CCOMCoder64(): CCoder(true) {} };
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user