1 // Rar1Decoder.h 2 // According to unRAR license, this code may not be used to develop 3 // a program that creates RAR archives 4 5 #ifndef ZIP7_INC_COMPRESS_RAR1_DECODER_H 6 #define ZIP7_INC_COMPRESS_RAR1_DECODER_H 7 8 #include "../../Common/MyCom.h" 9 10 #include "../ICoder.h" 11 12 #include "../Common/InBuffer.h" 13 14 #include "BitmDecoder.h" 15 #include "LzOutWindow.h" 16 17 namespace NCompress { 18 namespace NRar1 { 19 20 const unsigned kNumRepDists = 4; 21 22 Z7_CLASS_IMP_COM_2( 23 CDecoder 24 , ICompressCoder 25 , ICompressSetDecoderProperties2 26 ) 27 bool _isSolid; 28 bool _solidAllowed; 29 bool StMode; 30 31 CLzOutWindow m_OutWindowStream; 32 NBitm::CDecoder<CInBuffer> m_InBitStream; 33 34 UInt64 m_UnpackSize; 35 36 UInt32 LastDist; 37 UInt32 LastLength; 38 39 UInt32 m_RepDistPtr; 40 UInt32 m_RepDists[kNumRepDists]; 41 42 int FlagsCnt; 43 UInt32 FlagBuf, AvrPlc, AvrPlcB, AvrLn1, AvrLn2, AvrLn3; 44 unsigned Buf60, NumHuf, LCount; 45 UInt32 Nhfb, Nlzb, MaxDist3; 46 47 UInt32 ChSet[256], ChSetA[256], ChSetB[256], ChSetC[256]; 48 UInt32 Place[256], PlaceA[256], PlaceB[256], PlaceC[256]; 49 UInt32 NToPl[256], NToPlB[256], NToPlC[256]; 50 51 UInt32 ReadBits(unsigned numBits); 52 HRESULT CopyBlock(UInt32 distance, UInt32 len); 53 UInt32 DecodeNum(const Byte *numTab); 54 HRESULT ShortLZ(); 55 HRESULT LongLZ(); 56 HRESULT HuffDecode(); 57 void GetFlagsBuf(); 58 void CorrHuff(UInt32 *CharSet, UInt32 *NumToPlace); 59 void OldUnpWriteBuf(); 60 61 HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream, 62 const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); 63 64 public: 65 CDecoder(); 66 }; 67 68 }} 69 70 #endif 71