Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 |