1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// XzDecoder.h
#ifndef ZIP7_INC_XZ_DECODER_H
#define ZIP7_INC_XZ_DECODER_H
#include "../../../C/Xz.h"
#include "../../Common/MyCom.h"
#include "../ICoder.h"
namespace NCompress {
namespace NXz {
struct CDecoder
{
CXzDecMtHandle xz;
int _tryMt;
UInt32 _numThreads;
UInt64 _memUsage;
SRes MainDecodeSRes; // it's not HRESULT
bool MainDecodeSRes_wasUsed;
CXzStatInfo Stat;
CDecoder():
xz(NULL),
_tryMt(True),
_numThreads(1),
_memUsage((UInt64)(sizeof(size_t)) << 28),
MainDecodeSRes(SZ_OK),
MainDecodeSRes_wasUsed(false)
{}
~CDecoder()
{
if (xz)
XzDecMt_Destroy(xz);
}
/* Decode() can return S_OK, if there is data after good xz streams, and that data is not new xz stream.
check also (Stat.DataAfterEnd) flag */
HRESULT Decode(ISequentialInStream *seqInStream, ISequentialOutStream *outStream,
const UInt64 *outSizeLimit, bool finishStream, ICompressProgressInfo *compressProgress);
};
class CComDecoder Z7_final:
public ICompressCoder,
public ICompressSetFinishMode,
public ICompressGetInStreamProcessedSize,
#ifndef Z7_ST
public ICompressSetCoderMt,
public ICompressSetMemLimit,
#endif
public CMyUnknownImp,
public CDecoder
{
Z7_COM_QI_BEGIN2(ICompressCoder)
Z7_COM_QI_ENTRY(ICompressSetFinishMode)
Z7_COM_QI_ENTRY(ICompressGetInStreamProcessedSize)
#ifndef Z7_ST
Z7_COM_QI_ENTRY(ICompressSetCoderMt)
Z7_COM_QI_ENTRY(ICompressSetMemLimit)
#endif
Z7_COM_QI_END
Z7_COM_ADDREF_RELEASE
Z7_IFACE_COM7_IMP(ICompressCoder)
Z7_IFACE_COM7_IMP(ICompressSetFinishMode)
Z7_IFACE_COM7_IMP(ICompressGetInStreamProcessedSize)
#ifndef Z7_ST
Z7_IFACE_COM7_IMP(ICompressSetCoderMt)
Z7_IFACE_COM7_IMP(ICompressSetMemLimit)
#endif
bool _finishStream;
public:
CComDecoder(): _finishStream(false) {}
};
}}
#endif
|