Mercurial > vba-linux
diff src/win32/7zip/7z/CPP/7zip/Compress/Rar1Decoder.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Compress/Rar1Decoder.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,88 @@ 1.4 +// Rar1Decoder.h 1.5 +// According to unRAR license, this code may not be used to develop 1.6 +// a program that creates RAR archives 1.7 + 1.8 +#ifndef __COMPRESS_RAR1_DECODER_H 1.9 +#define __COMPRESS_RAR1_DECODER_H 1.10 + 1.11 +#include "../../Common/MyCom.h" 1.12 + 1.13 +#include "../ICoder.h" 1.14 + 1.15 +#include "../Common/InBuffer.h" 1.16 + 1.17 +#include "BitmDecoder.h" 1.18 +#include "HuffmanDecoder.h" 1.19 +#include "LzOutWindow.h" 1.20 + 1.21 +namespace NCompress { 1.22 +namespace NRar1 { 1.23 + 1.24 +const UInt32 kNumRepDists = 4; 1.25 + 1.26 +typedef NBitm::CDecoder<CInBuffer> CBitDecoder; 1.27 + 1.28 +class CDecoder : 1.29 + public ICompressCoder, 1.30 + public ICompressSetDecoderProperties2, 1.31 + public CMyUnknownImp 1.32 +{ 1.33 +public: 1.34 + CLzOutWindow m_OutWindowStream; 1.35 + CBitDecoder m_InBitStream; 1.36 + 1.37 + UInt32 m_RepDists[kNumRepDists]; 1.38 + UInt32 m_RepDistPtr; 1.39 + 1.40 + UInt32 LastDist; 1.41 + UInt32 LastLength; 1.42 + 1.43 + Int64 m_UnpackSize; 1.44 + bool m_IsSolid; 1.45 + 1.46 + UInt32 ReadBits(int numBits); 1.47 + HRESULT CopyBlock(UInt32 distance, UInt32 len); 1.48 + 1.49 + UInt32 DecodeNum(const UInt32 *posTab); 1.50 + HRESULT ShortLZ(); 1.51 + HRESULT LongLZ(); 1.52 + HRESULT HuffDecode(); 1.53 + void GetFlagsBuf(); 1.54 + void InitData(); 1.55 + void InitHuff(); 1.56 + void CorrHuff(UInt32 *CharSet, UInt32 *NumToPlace); 1.57 + void OldUnpWriteBuf(); 1.58 + 1.59 + UInt32 ChSet[256],ChSetA[256],ChSetB[256],ChSetC[256]; 1.60 + UInt32 Place[256],PlaceA[256],PlaceB[256],PlaceC[256]; 1.61 + UInt32 NToPl[256],NToPlB[256],NToPlC[256]; 1.62 + UInt32 FlagBuf,AvrPlc,AvrPlcB,AvrLn1,AvrLn2,AvrLn3; 1.63 + int Buf60,NumHuf,StMode,LCount,FlagsCnt; 1.64 + UInt32 Nhfb,Nlzb,MaxDist3; 1.65 + 1.66 + void InitStructures(); 1.67 + 1.68 + HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream, 1.69 + const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); 1.70 + 1.71 +public: 1.72 + CDecoder(); 1.73 + 1.74 + MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2) 1.75 + 1.76 + void ReleaseStreams() 1.77 + { 1.78 + m_OutWindowStream.ReleaseStream(); 1.79 + m_InBitStream.ReleaseStream(); 1.80 + } 1.81 + 1.82 + STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, 1.83 + const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); 1.84 + 1.85 + STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); 1.86 + 1.87 +}; 1.88 + 1.89 +}} 1.90 + 1.91 +#endif