other-licenses/7zstub/src/7zip/Archive/Common/OutStreamWithCRC.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 // OutStreamWithCRC.h
     3 #ifndef __OUTSTREAMWITHCRC_H
     4 #define __OUTSTREAMWITHCRC_H
     6 #include "../../../Common/CRC.h"
     7 #include "../../../Common/MyCom.h"
     8 #include "../../IStream.h"
    10 class COutStreamWithCRC: 
    11   public ISequentialOutStream,
    12   public CMyUnknownImp
    13 {
    14 public:
    15   MY_UNKNOWN_IMP
    17   STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
    18 private:
    19   CCRC _crc;
    20   CMyComPtr<ISequentialOutStream> _stream;
    21 public:
    22   void Init(ISequentialOutStream *stream)
    23   {
    24     _stream = stream;
    25     _crc.Init();
    26   }
    27   void ReleaseStream() { _stream.Release(); }
    28   UInt32 GetCRC() const { return _crc.GetDigest(); }
    29   void InitCRC() { _crc.Init(); }
    31 };
    33 #endif

mercurial