Files
easy7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp
Igor Pavlov 7038848692 4.49 beta
2016-05-28 00:15:52 +01:00

25 lines
551 B
C++
Executable File

// OutStreamWithSha1.cpp
#include "StdAfx.h"
#include "OutStreamWithSha1.h"
STDMETHODIMP COutStreamWithSha1::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 realProcessedSize;
HRESULT result;
if(!_stream)
{
realProcessedSize = size;
result = S_OK;
}
else
result = _stream->Write(data, size, &realProcessedSize);
if (_calculate)
_sha.Update((const Byte *)data, realProcessedSize);
_size += realProcessedSize;
if(processedSize != NULL)
*processedSize = realProcessedSize;
return result;
}