Imported Upstream version 9.20
[platform/upstream/7zip.git] / CPP / 7zip / Archive / Common / OutStreamWithCRC.cpp
1 // OutStreamWithCRC.cpp\r
2 \r
3 #include "StdAfx.h"\r
4 \r
5 #include "OutStreamWithCRC.h"\r
6 \r
7 STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize)\r
8 {\r
9   HRESULT result = S_OK;\r
10   if (_stream)\r
11     result = _stream->Write(data, size, &size);\r
12   if (_calculate)\r
13     _crc = CrcUpdate(_crc, data, size);\r
14   _size += size;\r
15   if (processedSize != NULL)\r
16     *processedSize = size;\r
17   return result;\r
18 }\r