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

mercurial