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.

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

mercurial