diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2016-10-05 03:00:00 +0300 |
---|---|---|
committer | Kornel LesinĚski <kornel@geekhood.net> | 2016-12-08 15:13:50 +0300 |
commit | 603abd5528c97346e9448c0ff47949f818fe558c (patch) | |
tree | 6603230f4eab118fc83554731dc86e30578ccff9 /CPP/7zip/Compress | |
parent | 232ce7957441b06193c4cbdc1bc9e71436fadfdb (diff) |
16.0416.04
Diffstat (limited to 'CPP/7zip/Compress')
-rw-r--r-- | CPP/7zip/Compress/Rar2Decoder.cpp | 14 | ||||
-rw-r--r-- | CPP/7zip/Compress/Rar2Decoder.h | 21 |
2 files changed, 23 insertions, 12 deletions
diff --git a/CPP/7zip/Compress/Rar2Decoder.cpp b/CPP/7zip/Compress/Rar2Decoder.cpp index b3f2b4b3..db67433a 100644 --- a/CPP/7zip/Compress/Rar2Decoder.cpp +++ b/CPP/7zip/Compress/Rar2Decoder.cpp @@ -80,7 +80,8 @@ static const UInt32 kHistorySize = 1 << 20; static const UInt32 kWindowReservSize = (1 << 22) + 256; CDecoder::CDecoder(): - m_IsSolid(false) + m_IsSolid(false), + m_TablesOK(false) { } @@ -100,6 +101,8 @@ UInt32 CDecoder::ReadBits(unsigned numBits) { return m_InBitStream.ReadBits(numB bool CDecoder::ReadTables(void) { + m_TablesOK = false; + Byte levelLevels[kLevelTableSize]; Byte newLevels[kMaxTableSize]; m_AudioMode = (ReadBits(1) == 1); @@ -170,6 +173,9 @@ bool CDecoder::ReadTables(void) } memcpy(m_LastLevels, newLevels, kMaxTableSize); + + m_TablesOK = true; + return true; } @@ -340,10 +346,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * return S_FALSE; return S_OK; } - if (!ReadTables()) - return S_FALSE; + ReadTables(); } + if (!m_TablesOK) + return S_FALSE; + UInt64 startPos = m_OutWindowStream.GetProcessedSize(); while (pos < unPackSize) { diff --git a/CPP/7zip/Compress/Rar2Decoder.h b/CPP/7zip/Compress/Rar2Decoder.h index 3a0535cc..0d8142b5 100644 --- a/CPP/7zip/Compress/Rar2Decoder.h +++ b/CPP/7zip/Compress/Rar2Decoder.h @@ -119,26 +119,29 @@ class CDecoder : { CLzOutWindow m_OutWindowStream; CBitDecoder m_InBitStream; + + UInt32 m_RepDistPtr; + UInt32 m_RepDists[kNumRepDists]; + + UInt32 m_LastLength; + + bool m_IsSolid; + bool m_TablesOK; + bool m_AudioMode; + NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder; NHuffman::CDecoder<kNumHuffmanBits, kDistTableSize> m_DistDecoder; NHuffman::CDecoder<kNumHuffmanBits, kLenTableSize> m_LenDecoder; NHuffman::CDecoder<kNumHuffmanBits, kMMTableSize> m_MMDecoders[NMultimedia::kNumChanelsMax]; NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder; - bool m_AudioMode; + UInt64 m_PackSize; - NMultimedia::CFilter2 m_MmFilter; unsigned m_NumChannels; + NMultimedia::CFilter2 m_MmFilter; - UInt32 m_RepDists[kNumRepDists]; - UInt32 m_RepDistPtr; - - UInt32 m_LastLength; - Byte m_LastLevels[kMaxTableSize]; - UInt64 m_PackSize; - bool m_IsSolid; void InitStructures(); UInt32 ReadBits(unsigned numBits); |