misc/libphysfs/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp
changeset 13904 99b265e0d1d0
parent 13903 5f819b90d479
child 13905 b172a5d40eee
equal deleted inserted replaced
13903:5f819b90d479 13904:99b265e0d1d0
     1 // OutStreamWithCRC.cpp
       
     2 
       
     3 #include "StdAfx.h"
       
     4 
       
     5 #include "OutStreamWithCRC.h"
       
     6 
       
     7 STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize)
       
     8 {
       
     9   UInt32 realProcessedSize;
       
    10   HRESULT result;
       
    11   if(!_stream)
       
    12   {
       
    13     realProcessedSize = size;
       
    14     result = S_OK;
       
    15   }
       
    16   else
       
    17     result = _stream->Write(data, size, &realProcessedSize);
       
    18   if (_calculate)
       
    19     _crc = CrcUpdate(_crc, data, realProcessedSize);
       
    20   _size += realProcessedSize;
       
    21   if(processedSize != NULL)
       
    22     *processedSize = realProcessedSize;
       
    23   return result;
       
    24 }