Tue, 06 Jan 2015 21:39:09 +0100
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 | // 7zFolderOutStream.h |
michael@0 | 2 | |
michael@0 | 3 | #ifndef __7Z_FOLDEROUTSTREAM_H |
michael@0 | 4 | #define __7Z_FOLDEROUTSTREAM_H |
michael@0 | 5 | |
michael@0 | 6 | #include "7zIn.h" |
michael@0 | 7 | |
michael@0 | 8 | #include "../../IStream.h" |
michael@0 | 9 | #include "../IArchive.h" |
michael@0 | 10 | #include "../Common/OutStreamWithCRC.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace NArchive { |
michael@0 | 13 | namespace N7z { |
michael@0 | 14 | |
michael@0 | 15 | class CFolderOutStream: |
michael@0 | 16 | public ISequentialOutStream, |
michael@0 | 17 | public CMyUnknownImp |
michael@0 | 18 | { |
michael@0 | 19 | public: |
michael@0 | 20 | MY_UNKNOWN_IMP |
michael@0 | 21 | |
michael@0 | 22 | CFolderOutStream(); |
michael@0 | 23 | |
michael@0 | 24 | STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); |
michael@0 | 25 | private: |
michael@0 | 26 | |
michael@0 | 27 | COutStreamWithCRC *_outStreamWithHashSpec; |
michael@0 | 28 | CMyComPtr<ISequentialOutStream> _outStreamWithHash; |
michael@0 | 29 | const CArchiveDatabaseEx *_archiveDatabase; |
michael@0 | 30 | const CBoolVector *_extractStatuses; |
michael@0 | 31 | UInt32 _startIndex; |
michael@0 | 32 | UInt32 _ref2Offset; |
michael@0 | 33 | int _currentIndex; |
michael@0 | 34 | // UInt64 _currentDataPos; |
michael@0 | 35 | CMyComPtr<IArchiveExtractCallback> _extractCallback; |
michael@0 | 36 | bool _testMode; |
michael@0 | 37 | |
michael@0 | 38 | bool _fileIsOpen; |
michael@0 | 39 | UInt64 _filePos; |
michael@0 | 40 | |
michael@0 | 41 | HRESULT OpenFile(); |
michael@0 | 42 | HRESULT WriteEmptyFiles(); |
michael@0 | 43 | public: |
michael@0 | 44 | HRESULT Init( |
michael@0 | 45 | const CArchiveDatabaseEx *archiveDatabase, |
michael@0 | 46 | UInt32 ref2Offset, |
michael@0 | 47 | UInt32 startIndex, |
michael@0 | 48 | const CBoolVector *extractStatuses, |
michael@0 | 49 | IArchiveExtractCallback *extractCallback, |
michael@0 | 50 | bool testMode); |
michael@0 | 51 | HRESULT FlushCorrupted(Int32 resultEOperationResult); |
michael@0 | 52 | HRESULT WasWritingFinished(); |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | }} |
michael@0 | 56 | |
michael@0 | 57 | #endif |