diff options
Diffstat (limited to 'CPP/7zip/Archive/Common/OutStreamWithCRC.cpp')
-rwxr-xr-x | CPP/7zip/Archive/Common/OutStreamWithCRC.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp b/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp new file mode 100755 index 00000000..7ac3f123 --- /dev/null +++ b/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp @@ -0,0 +1,24 @@ +// OutStreamWithCRC.cpp + +#include "StdAfx.h" + +#include "OutStreamWithCRC.h" + +STDMETHODIMP COutStreamWithCRC::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 (_calculateCrc) + _crc.Update(data, realProcessedSize); + _size += realProcessedSize; + if(processedSize != NULL) + *processedSize = realProcessedSize; + return result; +} |