mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 01:15:00 -06:00
zstd-x64.dll!NCompress::NZSTD::CDecoder::CodeSpec(ISequentialInStream * inStream=0x000000001e6a2190, ISequentialOutStream * outStream=0x000000001e6b9460, ICompressProgressInfo * progress=0x0000000000000000) Line 130 C++
zstd-x64.dll!NCompress::NZSTD::CDecoder::Code(ISequentialInStream * inStream=0x000000001e6a2190, ISequentialOutStream * outStream=0x000000001e6b9460, const unsigned __int64 * __formal=0x000000001e8a2d00, const unsigned __int64 * outSize=0x000000001e5eb3b0, ICompressProgressInfo * progress=0x0000000000000000) Line 177 C++
7z.dll!NCoderMixer2::CCoderMT::Code(ICompressProgressInfo * progress=0x0000000000000000) Line 903 C++
7z.dll!NCoderMixer2::CMixerMT::Code(ISequentialInStream * const * inStreams=0x000000001e8a2d20, ISequentialOutStream * const * outStreams=0x00000000219bf910, ICompressProgressInfo * progress=0x0000000000000000, bool & dataAfterEnd_Error=false) Line 1083 C++
7z.dll!NArchive::N7z::CDecoder::Decode(const CExternalCodecs * __externalCodecs=0x000000001e599aa0, IInStream * inStream=0x000000001e8c6300, unsigned __int64 startPos=32, const NArchive::N7z::CFolders & folders={...}, unsigned int folderIndex=0, const unsigned __int64 * unpackSize=0x0000000000000000, ISequentialOutStream * outStream=0x000000001e6b9460, ICompressProgressInfo * compressProgress=0x0000000000000000, ISequentialInStream * * inStreamMainRes=0x0000000000000000, bool & dataAfterEnd_Error=false, ICryptoGetTextPassword * getTextPassword=0x000000001e6882b0, bool & isEncrypted=true, bool & passwordIsDefined=true, UString & password={...}, bool mtMode=false, unsigned int numThreads=1, unsigned __int64 memUsage=0) Line 555 C++
7z.dll!NArchive::N7z::CThreadDecoder::Execute() Line 1493 C++
7z.dll!CoderThread(void * p=0x000000001f1cbe90) Line 16 C++
Other 7z threads are:
7z.dll!Handle_WaitObject(void * h=0x0000000000000868) Line 32 C
7z.dll!NWindows::NSynchronization::CBaseEvent::Lock() Line 47 C++
7z.dll!CStreamBinder::Read(void * data=0x000000001e9b53ea, unsigned int size=115206, unsigned int * processedSize=0x000000001f1cb310) Line 95 C++
7z.dll!CBinderInStream::Read(void * data=0x000000001e9b53ea, unsigned int size=115206, unsigned int * processedSize=0x000000001f1cb310) Line 22 C++
7z.dll!COffsetOutStream::Write(const void * data=0x000000001e9b53ea, unsigned int size=115206, unsigned int * processedSize=0x000000001f1cb310) Line 19 C++
7z.dll!CSequentialInStreamSizeCount2::Read(void * data=0x000000001e9b53ea, unsigned int size=115206, unsigned int * processedSize=0x000000001f1cb350) Line 10 C++
zstd-x64.dll!ReadStream(ISequentialInStream * stream=0x000000001e7b4010, void * data=0x000000001e9b53ea, unsigned __int64 * processedSize=0x000000001f1cb3b8) Line 17 C++
zstd-x64.dll!NCompress::NZSTD::CEncoder::Code(ISequentialInStream * inStream=0x000000001e7b4010, ISequentialOutStream * outStream=0x000000001e8e0dc0, const unsigned __int64 * __formal=0x0000000000000000, const unsigned __int64 * __formal=0x0000000000000000, ICompressProgressInfo * progress=0x000000001b6df8d0) Line 329 C++
7z.dll!NCoderMixer2::CCoderMT::Code(ICompressProgressInfo * progress=0x000000001b6df8d0) Line 903 C++
7z.dll!NCoderMixer2::CMixerMT::Code(ISequentialInStream * const * inStreams=0x000000001f1cb750, ISequentialOutStream * const * outStreams=0x000000001e599bc0, ICompressProgressInfo * progress=0x000000001b6df8d0, bool & dataAfterEnd_Error=false) Line 1083 C++
7z.dll!NArchive::N7z::CEncoder::Encode(const CExternalCodecs * __externalCodecs=0x000000001e599aa0, ISequentialInStream * inStream=0x000000001e7b3f10, const unsigned __int64 * inSizeForReduce=0x000000001f1cb960, NArchive::N7z::CFolder & folderItem={...}, CRecordVector<unsigned __int64> & coderUnpackSizes={...}, unsigned __int64 & unpackSize=17468, ISequentialOutStream * outStream=0x000000001e8bcdd0, CRecordVector<unsigned __int64> & packSizes={...}, ICompressProgressInfo * compressProgress=0x000000001b6df8d0) Line 454 C++
7z.dll!NArchive::N7z::Update(const CExternalCodecs * __externalCodecs=0x000000001e599aa0, IInStream * inStream=0x000000001e8c6300, const NArchive::N7z::CDbEx * db=0x000000001e5998a8, const CObjectVector<NArchive::N7z::CUpdateItem> & updateItems={...}, NArchive::N7z::COutArchive & archive={...}, NArchive::N7z::CArchiveDatabaseOut & newDatabase={...}, ISequentialOutStream * seqOutStream=0x000000001e8bcdd0, IArchiveUpdateCallback * updateCallback=0x000000001f1cc980, const NArchive::N7z::CUpdateOptions & options={...}, ICryptoGetTextPassword * getDecoderPassword=0x000000001f1cc958) Line 2178 C++
7z.dll!NArchive::N7z::CHandler::UpdateItems(ISequentialOutStream * outStream=0x000000001e8bcdd0, unsigned int numItems=10, IArchiveUpdateCallback * updateCallback=0x000000001f1cc980) Line 658 C++
And:
7z.dll!Handle_WaitObject(void * h=0x0000000000000880) Line 32 C
7z.dll!NWindows::NSynchronization::CBaseEvent::Lock() Line 47 C++
7z.dll!CStreamBinder::Read(void * data=0x0000000020650000, unsigned int size=1048576, unsigned int * processedSize=0x000000002084f6d0) Line 95 C++
7z.dll!CBinderInStream::Read(void * data=0x0000000020650000, unsigned int size=1048576, unsigned int * processedSize=0x000000002084f6d0) Line 22 C++
7z.dll!ReadStream(ISequentialInStream * stream=0x000000001e8e0de0, void * data=0x0000000020650000, unsigned __int64 * processedSize=0x000000002084f758) Line 17 C++
7z.dll!CFilterCoder::Code(ISequentialInStream * inStream=0x000000001e8e0de0, ISequentialOutStream * outStream=0x000000001e55da30, const unsigned __int64 * __formal=0x0000000000000000, const unsigned __int64 * outSize=0x0000000000000000, ICompressProgressInfo * progress=0x0000000000000000) Line 83 C++
7z.dll!NCoderMixer2::CCoderMT::Code(ICompressProgressInfo * progress=0x0000000000000000) Line 903 C++
7z.dll!NCoderMixer2::CCoderMT::Execute() Line 867 C++
7z.dll!CoderThread(void * p=0x000000001e5eb510) Line 16 C++
205 lines
4.2 KiB
C++
205 lines
4.2 KiB
C++
// (C) 2016 - 2018 Tino Reichardt
|
|
|
|
#define DEBUG 0
|
|
|
|
#if DEBUG
|
|
#include <stdio.h>
|
|
#endif
|
|
|
|
#include "StdAfx.h"
|
|
#include "ZstdDecoder.h"
|
|
|
|
namespace NCompress {
|
|
namespace NZSTD {
|
|
|
|
CDecoder::CDecoder():
|
|
_ctx(NULL),
|
|
_srcBuf(NULL),
|
|
_dstBuf(NULL),
|
|
_srcBufSize(ZSTD_DStreamInSize()),
|
|
_dstBufSize(ZSTD_DStreamOutSize()),
|
|
_processedIn(0),
|
|
_processedOut(0)
|
|
{
|
|
_props.clear();
|
|
}
|
|
|
|
CDecoder::~CDecoder()
|
|
{
|
|
if (_ctx) {
|
|
ZSTD_freeDCtx(_ctx);
|
|
MyFree(_srcBuf);
|
|
MyFree(_dstBuf);
|
|
}
|
|
}
|
|
|
|
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size)
|
|
{
|
|
DProps *pProps = (DProps *)prop;
|
|
|
|
#if DEBUG
|
|
printf("prop size =%u\n", size);
|
|
fflush(stdout);
|
|
#endif
|
|
|
|
switch (size) {
|
|
case 3:
|
|
memcpy(&_props, pProps, 3);
|
|
return S_OK;
|
|
case 5:
|
|
memcpy(&_props, pProps, 5);
|
|
return S_OK;
|
|
default:
|
|
return E_NOTIMPL;
|
|
}
|
|
}
|
|
|
|
HRESULT CDecoder::SetOutStreamSizeResume(const UInt64 * /*outSize*/)
|
|
{
|
|
_processedOut = 0;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 * outSize)
|
|
{
|
|
_processedIn = 0;
|
|
RINOK(SetOutStreamSizeResume(outSize));
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
|
|
ISequentialOutStream * outStream, ICompressProgressInfo * progress)
|
|
{
|
|
size_t srcBufLen, result;
|
|
ZSTD_inBuffer zIn;
|
|
ZSTD_outBuffer zOut;
|
|
|
|
/* 1) create context */
|
|
if (!_ctx) {
|
|
_ctx = ZSTD_createDCtx();
|
|
if (!_ctx)
|
|
return E_OUTOFMEMORY;
|
|
|
|
_srcBuf = MyAlloc(_srcBufSize);
|
|
if (!_srcBuf)
|
|
return E_OUTOFMEMORY;
|
|
|
|
_dstBuf = MyAlloc(_dstBufSize);
|
|
if (!_dstBuf)
|
|
return E_OUTOFMEMORY;
|
|
} else {
|
|
ZSTD_resetDStream(_ctx);
|
|
}
|
|
|
|
zOut.dst = _dstBuf;
|
|
srcBufLen = _srcBufSize;
|
|
|
|
/* read first input block */
|
|
RINOK(ReadStream(inStream, _srcBuf, &srcBufLen));
|
|
_processedIn += srcBufLen;
|
|
|
|
zIn.src = _srcBuf;
|
|
zIn.size = srcBufLen;
|
|
zIn.pos = 0;
|
|
|
|
/* Main decompression Loop */
|
|
for (;;) {
|
|
for (;;) {
|
|
/* decompress loop */
|
|
zOut.size = _dstBufSize;
|
|
zOut.pos = 0;
|
|
|
|
result = ZSTD_decompressStream(_ctx, &zOut, &zIn);
|
|
if (ZSTD_isError(result))
|
|
return E_FAIL;
|
|
|
|
#if DEBUG
|
|
printf("res = %u\n", (unsigned)result);
|
|
printf("zIn.size = %u\n", (unsigned)zIn.size);
|
|
printf("zIn.pos = %u\n", (unsigned)zIn.pos);
|
|
printf("zOut.size = %u\n", (unsigned)zOut.size);
|
|
printf("zOut.pos = %u\n", (unsigned)zOut.pos);
|
|
printf("---------------------\n");
|
|
fflush(stdout);
|
|
#endif
|
|
|
|
/* write decompressed result */
|
|
if (zOut.pos) {
|
|
RINOK(WriteStream(outStream, _dstBuf, zOut.pos));
|
|
_processedOut += zOut.pos;
|
|
if (progress)
|
|
{
|
|
RINOK(progress->SetRatioInfo(&_processedIn, &_processedOut));
|
|
}
|
|
}
|
|
|
|
/* finished with buffer */
|
|
if (zIn.pos == zIn.size)
|
|
break;
|
|
|
|
/* end of frame */
|
|
if (result == 0) {
|
|
result = ZSTD_resetDStream(_ctx);
|
|
if (ZSTD_isError(result))
|
|
return E_FAIL;
|
|
|
|
/* end of frame, but more data */
|
|
if (zIn.pos < zIn.size)
|
|
continue;
|
|
|
|
/* read next input, or eof */
|
|
break;
|
|
}
|
|
} /* for() decompress */
|
|
|
|
/* read next input */
|
|
srcBufLen = _srcBufSize;
|
|
RINOK(ReadStream(inStream, _srcBuf, &srcBufLen));
|
|
_processedIn += srcBufLen;
|
|
#if DEBUG
|
|
printf("READ = %u\n", (unsigned)srcBufLen);
|
|
#endif
|
|
|
|
/* finished */
|
|
if (srcBufLen == 0)
|
|
return S_OK;
|
|
|
|
zIn.size = srcBufLen;
|
|
zIn.pos = 0;
|
|
}
|
|
}
|
|
|
|
STDMETHODIMP CDecoder::Code(ISequentialInStream * inStream, ISequentialOutStream * outStream,
|
|
const UInt64 * /*inSize */, const UInt64 *outSize, ICompressProgressInfo * progress)
|
|
{
|
|
SetOutStreamSize(outSize);
|
|
return CodeSpec(inStream, outStream, progress);
|
|
}
|
|
|
|
#ifndef NO_READ_FROM_CODER
|
|
STDMETHODIMP CDecoder::SetInStream(ISequentialInStream * inStream)
|
|
{
|
|
_inStream = inStream;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CDecoder::ReleaseInStream()
|
|
{
|
|
_inStream.Release();
|
|
return S_OK;
|
|
}
|
|
#endif
|
|
|
|
STDMETHODIMP CDecoder::SetNumberOfThreads(UInt32 /* numThreads */)
|
|
{
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT CDecoder::CodeResume(ISequentialOutStream * outStream, const UInt64 * outSize, ICompressProgressInfo * progress)
|
|
{
|
|
RINOK(SetOutStreamSizeResume(outSize));
|
|
return CodeSpec(_inStream, outStream, progress);
|
|
}
|
|
|
|
}}
|