mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 02:07:06 -06:00
23.01
This commit is contained in:
@@ -18,14 +18,14 @@ namespace NExt {
|
||||
API_FUNC_IsArc IsArc_Ext(const Byte *p, size_t size);
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandlerCont::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
Int32 testMode, IArchiveExtractCallback *extractCallback)
|
||||
Z7_COM7F_IMF(CHandlerCont::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
Int32 testMode, IArchiveExtractCallback *extractCallback))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
bool allFilesMode = (numItems == (UInt32)(Int32)-1);
|
||||
const bool allFilesMode = (numItems == (UInt32)(Int32)-1);
|
||||
if (allFilesMode)
|
||||
{
|
||||
RINOK(GetNumberOfItems(&numItems));
|
||||
RINOK(GetNumberOfItems(&numItems))
|
||||
}
|
||||
if (numItems == 0)
|
||||
return S_OK;
|
||||
@@ -56,14 +56,14 @@ STDMETHODIMP CHandlerCont::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
{
|
||||
lps->InSize = totalSize;
|
||||
lps->OutSize = totalSize;
|
||||
RINOK(lps->SetCur());
|
||||
RINOK(lps->SetCur())
|
||||
CMyComPtr<ISequentialOutStream> outStream;
|
||||
Int32 askMode = testMode ?
|
||||
const Int32 askMode = testMode ?
|
||||
NExtract::NAskMode::kTest :
|
||||
NExtract::NAskMode::kExtract;
|
||||
Int32 index = allFilesMode ? i : indices[i];
|
||||
const UInt32 index = allFilesMode ? i : indices[i];
|
||||
|
||||
RINOK(extractCallback->GetStream(index, &outStream, askMode));
|
||||
RINOK(extractCallback->GetStream(index, &outStream, askMode))
|
||||
|
||||
UInt64 pos, size;
|
||||
int opRes = GetItem_ExtractInfo(index, pos, size);
|
||||
@@ -71,14 +71,14 @@ STDMETHODIMP CHandlerCont::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
if (!testMode && !outStream)
|
||||
continue;
|
||||
|
||||
RINOK(extractCallback->PrepareOperation(askMode));
|
||||
RINOK(extractCallback->PrepareOperation(askMode))
|
||||
|
||||
if (opRes == NExtract::NOperationResult::kOK)
|
||||
{
|
||||
RINOK(_stream->Seek(pos, STREAM_SEEK_SET, NULL));
|
||||
RINOK(InStream_SeekSet(_stream, pos))
|
||||
streamSpec->Init(size);
|
||||
|
||||
RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
|
||||
RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress))
|
||||
|
||||
opRes = NExtract::NOperationResult::kDataError;
|
||||
|
||||
@@ -89,14 +89,14 @@ STDMETHODIMP CHandlerCont::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
}
|
||||
|
||||
outStream.Release();
|
||||
RINOK(extractCallback->SetOperationResult(opRes));
|
||||
RINOK(extractCallback->SetOperationResult(opRes))
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandlerCont::GetStream(UInt32 index, ISequentialInStream **stream)
|
||||
Z7_COM7F_IMF(CHandlerCont::GetStream(UInt32 index, ISequentialInStream **stream))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
*stream = NULL;
|
||||
@@ -114,7 +114,7 @@ CHandlerImg::CHandlerImg()
|
||||
Clear_HandlerImg_Vars();
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandlerImg::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
|
||||
Z7_COM7F_IMF(CHandlerImg::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition))
|
||||
{
|
||||
switch (seekOrigin)
|
||||
{
|
||||
@@ -129,9 +129,9 @@ STDMETHODIMP CHandlerImg::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosit
|
||||
*newPosition = _virtPos;
|
||||
return HRESULT_WIN32_ERROR_NEGATIVE_SEEK;
|
||||
}
|
||||
_virtPos = offset;
|
||||
_virtPos = (UInt64)offset;
|
||||
if (newPosition)
|
||||
*newPosition = offset;
|
||||
*newPosition = (UInt64)offset;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -171,9 +171,9 @@ void CHandlerImg::Clear_HandlerImg_Vars()
|
||||
Reset_PosInArc();
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandlerImg::Open(IInStream *stream,
|
||||
Z7_COM7F_IMF(CHandlerImg::Open(IInStream *stream,
|
||||
const UInt64 * /* maxCheckStartPosition */,
|
||||
IArchiveOpenCallback * openCallback)
|
||||
IArchiveOpenCallback * openCallback))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
{
|
||||
@@ -209,31 +209,26 @@ STDMETHODIMP CHandlerImg::Open(IInStream *stream,
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandlerImg::GetNumberOfItems(UInt32 *numItems)
|
||||
Z7_COM7F_IMF(CHandlerImg::GetNumberOfItems(UInt32 *numItems))
|
||||
{
|
||||
*numItems = 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
class CHandlerImgProgress:
|
||||
public ICompressProgressInfo,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
Z7_CLASS_IMP_NOQIB_1(
|
||||
CHandlerImgProgress
|
||||
, ICompressProgressInfo
|
||||
)
|
||||
public:
|
||||
CHandlerImg &Handler;
|
||||
CMyComPtr<ICompressProgressInfo> _ratioProgress;
|
||||
|
||||
CHandlerImgProgress(CHandlerImg &handler) : Handler(handler) {}
|
||||
|
||||
// MY_UNKNOWN_IMP1(ICompressProgressInfo)
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
|
||||
};
|
||||
|
||||
|
||||
STDMETHODIMP CHandlerImgProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
|
||||
Z7_COM7F_IMF(CHandlerImgProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize))
|
||||
{
|
||||
UInt64 inSize2;
|
||||
if (Handler.Get_PackSizeProcessed(inSize2))
|
||||
@@ -242,8 +237,8 @@ STDMETHODIMP CHandlerImgProgress::SetRatioInfo(const UInt64 *inSize, const UInt6
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CHandlerImg::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
Int32 testMode, IArchiveExtractCallback *extractCallback)
|
||||
Z7_COM7F_IMF(CHandlerImg::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
Int32 testMode, IArchiveExtractCallback *extractCallback))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
if (numItems == 0)
|
||||
@@ -251,15 +246,15 @@ STDMETHODIMP CHandlerImg::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
if (numItems != (UInt32)(Int32)-1 && (numItems != 1 || indices[0] != 0))
|
||||
return E_INVALIDARG;
|
||||
|
||||
RINOK(extractCallback->SetTotal(_size));
|
||||
RINOK(extractCallback->SetTotal(_size))
|
||||
CMyComPtr<ISequentialOutStream> outStream;
|
||||
Int32 askMode = testMode ?
|
||||
const Int32 askMode = testMode ?
|
||||
NExtract::NAskMode::kTest :
|
||||
NExtract::NAskMode::kExtract;
|
||||
RINOK(extractCallback->GetStream(0, &outStream, askMode));
|
||||
RINOK(extractCallback->GetStream(0, &outStream, askMode))
|
||||
if (!testMode && !outStream)
|
||||
return S_OK;
|
||||
RINOK(extractCallback->PrepareOperation(askMode));
|
||||
RINOK(extractCallback->PrepareOperation(askMode))
|
||||
|
||||
int opRes = NExtract::NOperationResult::kDataError;
|
||||
|
||||
@@ -332,7 +327,7 @@ HRESULT ReadZeroTail(ISequentialInStream *stream, bool &areThereNonZeros, UInt64
|
||||
for (;;)
|
||||
{
|
||||
UInt32 size = 0;
|
||||
RINOK(stream->Read(buf, kBufSize, &size));
|
||||
RINOK(stream->Read(buf, kBufSize, &size))
|
||||
if (size == 0)
|
||||
return S_OK;
|
||||
for (UInt32 i = 0; i < size; i++)
|
||||
|
||||
Reference in New Issue
Block a user