mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 23:14:54 -06:00
9.04 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
8874e4fbc9
commit
829409452d
@@ -2,10 +2,7 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../../../C/Alloc.h"
|
||||
}
|
||||
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
@@ -35,16 +32,18 @@ STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
|
||||
TotalSize = 0;
|
||||
for (;;)
|
||||
{
|
||||
UInt32 realProcessedSize;
|
||||
UInt32 size = kBufferSize;
|
||||
if (outSize != 0)
|
||||
if (size > *outSize - TotalSize)
|
||||
size = (UInt32)(*outSize - TotalSize);
|
||||
RINOK(inStream->Read(_buffer, size, &realProcessedSize));
|
||||
if (realProcessedSize == 0)
|
||||
RINOK(inStream->Read(_buffer, size, &size));
|
||||
if (size == 0)
|
||||
break;
|
||||
RINOK(WriteStream(outStream, _buffer, realProcessedSize));
|
||||
TotalSize += realProcessedSize;
|
||||
if (outStream)
|
||||
{
|
||||
RINOK(WriteStream(outStream, _buffer, size));
|
||||
}
|
||||
TotalSize += size;
|
||||
if (progress != NULL)
|
||||
{
|
||||
RINOK(progress->SetRatioInfo(&TotalSize, &TotalSize));
|
||||
@@ -59,4 +58,10 @@ STDMETHODIMP CCopyCoder::GetInStreamProcessedSize(UInt64 *value)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CopyStream(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress)
|
||||
{
|
||||
CMyComPtr<ICompressCoder> copyCoder = new NCompress::CCopyCoder;
|
||||
return copyCoder->Code(inStream, outStream, NULL, NULL, progress);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user