mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 18:07:07 -06:00
18.03
This commit is contained in:
@@ -12,57 +12,36 @@
|
||||
namespace NCompress {
|
||||
namespace NXz {
|
||||
|
||||
struct CXzUnpackerCPP
|
||||
struct CDecoder
|
||||
{
|
||||
Byte *InBuf;
|
||||
Byte *OutBuf;
|
||||
CXzUnpacker p;
|
||||
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)
|
||||
{}
|
||||
|
||||
CXzUnpackerCPP();
|
||||
~CXzUnpackerCPP();
|
||||
};
|
||||
|
||||
|
||||
struct CStatInfo
|
||||
{
|
||||
UInt64 InSize;
|
||||
UInt64 OutSize;
|
||||
UInt64 PhySize;
|
||||
|
||||
UInt64 NumStreams;
|
||||
UInt64 NumBlocks;
|
||||
|
||||
bool UnpackSize_Defined;
|
||||
|
||||
bool NumStreams_Defined;
|
||||
bool NumBlocks_Defined;
|
||||
|
||||
bool IsArc;
|
||||
bool UnexpectedEnd;
|
||||
bool DataAfterEnd;
|
||||
bool Unsupported;
|
||||
bool HeadersError;
|
||||
bool DataError;
|
||||
bool CrcError;
|
||||
|
||||
CStatInfo() { Clear(); }
|
||||
|
||||
void Clear();
|
||||
};
|
||||
|
||||
|
||||
struct CDecoder: public CStatInfo
|
||||
{
|
||||
CXzUnpackerCPP xzu;
|
||||
SRes DecodeRes; // it's not HRESULT
|
||||
|
||||
CDecoder(): DecodeRes(SZ_OK) {}
|
||||
~CDecoder()
|
||||
{
|
||||
if (xz)
|
||||
XzDecMt_Destroy(xz);
|
||||
}
|
||||
|
||||
/* Decode() can return ERROR code only if there is progress or stream error.
|
||||
Decode() returns S_OK in case of xz decoding error, but DecodeRes and CStatInfo contain error information */
|
||||
HRESULT Decode(ISequentialInStream *seqInStream, ISequentialOutStream *outStream,
|
||||
const UInt64 *outSizeLimit, bool finishStream, ICompressProgressInfo *compressProgress);
|
||||
Int32 Get_Extract_OperationResult() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -70,21 +49,41 @@ class CComDecoder:
|
||||
public ICompressCoder,
|
||||
public ICompressSetFinishMode,
|
||||
public ICompressGetInStreamProcessedSize,
|
||||
public CMyUnknownImp
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
public ICompressSetCoderMt,
|
||||
public ICompressSetMemLimit,
|
||||
#endif
|
||||
|
||||
public CMyUnknownImp,
|
||||
public CDecoder
|
||||
{
|
||||
CDecoder _decoder;
|
||||
bool _finishStream;
|
||||
|
||||
public:
|
||||
MY_UNKNOWN_IMP2(
|
||||
ICompressSetFinishMode,
|
||||
ICompressGetInStreamProcessedSize)
|
||||
MY_QUERYINTERFACE_BEGIN2(ICompressCoder)
|
||||
|
||||
MY_QUERYINTERFACE_ENTRY(ICompressSetFinishMode)
|
||||
MY_QUERYINTERFACE_ENTRY(ICompressGetInStreamProcessedSize)
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
MY_QUERYINTERFACE_ENTRY(ICompressSetCoderMt)
|
||||
MY_QUERYINTERFACE_ENTRY(ICompressSetMemLimit)
|
||||
#endif
|
||||
|
||||
MY_QUERYINTERFACE_END
|
||||
MY_ADDREF_RELEASE
|
||||
|
||||
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
|
||||
STDMETHOD(SetFinishMode)(UInt32 finishMode);
|
||||
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
STDMETHOD(SetNumberOfThreads)(UInt32 numThreads);
|
||||
STDMETHOD(SetMemLimit)(UInt64 memUsage);
|
||||
#endif
|
||||
|
||||
CComDecoder(): _finishStream(false) {}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user