diff options
Diffstat (limited to 'CPP/7zip/Compress/BZip2Decoder.h')
-rw-r--r-- | CPP/7zip/Compress/BZip2Decoder.h | 105 |
1 files changed, 46 insertions, 59 deletions
diff --git a/CPP/7zip/Compress/BZip2Decoder.h b/CPP/7zip/Compress/BZip2Decoder.h index 8fe4ef1..a8ef700 100644 --- a/CPP/7zip/Compress/BZip2Decoder.h +++ b/CPP/7zip/Compress/BZip2Decoder.h | |||
@@ -1,14 +1,14 @@ | |||
1 | // Compress/BZip2Decoder.h | 1 | // Compress/BZip2Decoder.h |
2 | 2 | ||
3 | #ifndef __COMPRESS_BZIP2_DECODER_H | 3 | #ifndef ZIP7_INC_COMPRESS_BZIP2_DECODER_H |
4 | #define __COMPRESS_BZIP2_DECODER_H | 4 | #define ZIP7_INC_COMPRESS_BZIP2_DECODER_H |
5 | 5 | ||
6 | #include "../../Common/MyCom.h" | 6 | #include "../../Common/MyCom.h" |
7 | 7 | ||
8 | // #define NO_READ_FROM_CODER | 8 | // #define Z7_NO_READ_FROM_CODER |
9 | // #define _7ZIP_ST | 9 | // #define Z7_ST |
10 | 10 | ||
11 | #ifndef _7ZIP_ST | 11 | #ifndef Z7_ST |
12 | #include "../../Windows/Synchronization.h" | 12 | #include "../../Windows/Synchronization.h" |
13 | #include "../../Windows/Thread.h" | 13 | #include "../../Windows/Thread.h" |
14 | #endif | 14 | #endif |
@@ -134,7 +134,7 @@ public: | |||
134 | 134 | ||
135 | ISequentialInStream *InStream; | 135 | ISequentialInStream *InStream; |
136 | 136 | ||
137 | #ifndef NO_READ_FROM_CODER | 137 | #ifndef Z7_NO_READ_FROM_CODER |
138 | CMyComPtr<ISequentialInStream> InStreamRef; | 138 | CMyComPtr<ISequentialInStream> InStreamRef; |
139 | #endif | 139 | #endif |
140 | 140 | ||
@@ -194,24 +194,51 @@ public: | |||
194 | 194 | ||
195 | 195 | ||
196 | 196 | ||
197 | class CDecoder : | 197 | class CDecoder: |
198 | public ICompressCoder, | 198 | public ICompressCoder, |
199 | public ICompressSetFinishMode, | 199 | public ICompressSetFinishMode, |
200 | public ICompressGetInStreamProcessedSize, | 200 | public ICompressGetInStreamProcessedSize, |
201 | public ICompressReadUnusedFromInBuf, | 201 | public ICompressReadUnusedFromInBuf, |
202 | 202 | #ifndef Z7_NO_READ_FROM_CODER | |
203 | #ifndef NO_READ_FROM_CODER | ||
204 | public ICompressSetInStream, | 203 | public ICompressSetInStream, |
205 | public ICompressSetOutStreamSize, | 204 | public ICompressSetOutStreamSize, |
206 | public ISequentialInStream, | 205 | public ISequentialInStream, |
207 | #endif | 206 | #endif |
208 | 207 | #ifndef Z7_ST | |
209 | #ifndef _7ZIP_ST | ||
210 | public ICompressSetCoderMt, | 208 | public ICompressSetCoderMt, |
211 | #endif | 209 | #endif |
212 | |||
213 | public CMyUnknownImp | 210 | public CMyUnknownImp |
214 | { | 211 | { |
212 | Z7_COM_QI_BEGIN2(ICompressCoder) | ||
213 | Z7_COM_QI_ENTRY(ICompressSetFinishMode) | ||
214 | Z7_COM_QI_ENTRY(ICompressGetInStreamProcessedSize) | ||
215 | Z7_COM_QI_ENTRY(ICompressReadUnusedFromInBuf) | ||
216 | #ifndef Z7_NO_READ_FROM_CODER | ||
217 | Z7_COM_QI_ENTRY(ICompressSetInStream) | ||
218 | Z7_COM_QI_ENTRY(ICompressSetOutStreamSize) | ||
219 | Z7_COM_QI_ENTRY(ISequentialInStream) | ||
220 | #endif | ||
221 | #ifndef Z7_ST | ||
222 | Z7_COM_QI_ENTRY(ICompressSetCoderMt) | ||
223 | #endif | ||
224 | Z7_COM_QI_END | ||
225 | Z7_COM_ADDREF_RELEASE | ||
226 | |||
227 | Z7_IFACE_COM7_IMP(ICompressCoder) | ||
228 | Z7_IFACE_COM7_IMP(ICompressSetFinishMode) | ||
229 | Z7_IFACE_COM7_IMP(ICompressGetInStreamProcessedSize) | ||
230 | Z7_IFACE_COM7_IMP(ICompressReadUnusedFromInBuf) | ||
231 | #ifndef Z7_NO_READ_FROM_CODER | ||
232 | Z7_IFACE_COM7_IMP(ICompressSetInStream) | ||
233 | Z7_IFACE_COM7_IMP(ICompressSetOutStreamSize) | ||
234 | Z7_IFACE_COM7_IMP_NONFINAL(ISequentialInStream) | ||
235 | #endif | ||
236 | public: | ||
237 | #ifndef Z7_ST | ||
238 | Z7_IFACE_COM7_IMP(ICompressSetCoderMt) | ||
239 | #endif | ||
240 | |||
241 | private: | ||
215 | Byte *_outBuf; | 242 | Byte *_outBuf; |
216 | size_t _outPos; | 243 | size_t _outPos; |
217 | UInt64 _outWritten; | 244 | UInt64 _outWritten; |
@@ -235,7 +262,7 @@ public: | |||
235 | CSpecState _spec; | 262 | CSpecState _spec; |
236 | UInt32 *_counters; | 263 | UInt32 *_counters; |
237 | 264 | ||
238 | #ifndef _7ZIP_ST | 265 | #ifndef Z7_ST |
239 | 266 | ||
240 | struct CBlock | 267 | struct CBlock |
241 | { | 268 | { |
@@ -339,60 +366,20 @@ public: | |||
339 | HRESULT DecodeBlock(const CBlockProps &props); | 366 | HRESULT DecodeBlock(const CBlockProps &props); |
340 | HRESULT DecodeStreams(ICompressProgressInfo *progress); | 367 | HRESULT DecodeStreams(ICompressProgressInfo *progress); |
341 | 368 | ||
342 | MY_QUERYINTERFACE_BEGIN2(ICompressCoder) | ||
343 | MY_QUERYINTERFACE_ENTRY(ICompressSetFinishMode) | ||
344 | MY_QUERYINTERFACE_ENTRY(ICompressGetInStreamProcessedSize) | ||
345 | MY_QUERYINTERFACE_ENTRY(ICompressReadUnusedFromInBuf) | ||
346 | |||
347 | #ifndef NO_READ_FROM_CODER | ||
348 | MY_QUERYINTERFACE_ENTRY(ICompressSetInStream) | ||
349 | MY_QUERYINTERFACE_ENTRY(ICompressSetOutStreamSize) | ||
350 | MY_QUERYINTERFACE_ENTRY(ISequentialInStream) | ||
351 | #endif | ||
352 | |||
353 | #ifndef _7ZIP_ST | ||
354 | MY_QUERYINTERFACE_ENTRY(ICompressSetCoderMt) | ||
355 | #endif | ||
356 | |||
357 | MY_QUERYINTERFACE_END | ||
358 | MY_ADDREF_RELEASE | ||
359 | |||
360 | |||
361 | STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, | ||
362 | const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); | ||
363 | |||
364 | STDMETHOD(SetFinishMode)(UInt32 finishMode); | ||
365 | STDMETHOD(GetInStreamProcessedSize)(UInt64 *value); | ||
366 | STDMETHOD(ReadUnusedFromInBuf)(void *data, UInt32 size, UInt32 *processedSize); | ||
367 | |||
368 | UInt64 GetNumStreams() const { return Base.NumStreams; } | 369 | UInt64 GetNumStreams() const { return Base.NumStreams; } |
369 | UInt64 GetNumBlocks() const { return Base.NumBlocks; } | 370 | UInt64 GetNumBlocks() const { return Base.NumBlocks; } |
370 | 371 | ||
371 | #ifndef NO_READ_FROM_CODER | ||
372 | |||
373 | STDMETHOD(SetInStream)(ISequentialInStream *inStream); | ||
374 | STDMETHOD(ReleaseInStream)(); | ||
375 | STDMETHOD(SetOutStreamSize)(const UInt64 *outSize); | ||
376 | STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); | ||
377 | |||
378 | #endif | ||
379 | |||
380 | #ifndef _7ZIP_ST | ||
381 | STDMETHOD(SetNumberOfThreads)(UInt32 numThreads); | ||
382 | #endif | ||
383 | |||
384 | CDecoder(); | 372 | CDecoder(); |
385 | ~CDecoder(); | 373 | virtual ~CDecoder(); |
386 | }; | 374 | }; |
387 | 375 | ||
388 | 376 | ||
389 | 377 | ||
390 | #ifndef NO_READ_FROM_CODER | 378 | #ifndef Z7_NO_READ_FROM_CODER |
391 | 379 | ||
392 | class CNsisDecoder : public CDecoder | 380 | class CNsisDecoder Z7_final: public CDecoder |
393 | { | 381 | { |
394 | public: | 382 | Z7_IFACE_COM7_IMP(ISequentialInStream) |
395 | STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); | ||
396 | }; | 383 | }; |
397 | 384 | ||
398 | #endif | 385 | #endif |