OutStreamWithCRC.cpp 545 B

123456789101112131415161718192021222324
  1. // OutStreamWithCRC.cpp
  2. #include "StdAfx.h"
  3. #include "OutStreamWithCRC.h"
  4. STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize)
  5. {
  6. UInt32 realProcessedSize;
  7. HRESULT result;
  8. if(!_stream)
  9. {
  10. realProcessedSize = size;
  11. result = S_OK;
  12. }
  13. else
  14. result = _stream->Write(data, size, &realProcessedSize);
  15. if (_calculate)
  16. _crc = CrcUpdate(_crc, data, realProcessedSize);
  17. _size += realProcessedSize;
  18. if(processedSize != NULL)
  19. *processedSize = realProcessedSize;
  20. return result;
  21. }