other-licenses/7zstub/src/7zip/UI/Common/ArchiverInfo.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 // ArchiverInfo.h
     3 #ifndef __ARCHIVERINFO_H
     4 #define __ARCHIVERINFO_H
     6 #include "Common/String.h"
     7 #include "Common/Types.h"
     8 #include "Common/Buffer.h"
    10 struct CArchiverExtInfo
    11 {
    12   UString Ext;
    13   UString AddExt;
    14   CArchiverExtInfo() {}
    15   CArchiverExtInfo(const UString &ext): Ext(ext) {}
    16   CArchiverExtInfo(const UString &ext, const UString &addExt): Ext(ext), AddExt(addExt) {}
    17 };
    19 struct CArchiverInfo
    20 {
    21   #ifndef EXCLUDE_COM
    22   UString FilePath;
    23   CLSID ClassID;
    24   #endif
    25   UString Name;
    26   CObjectVector<CArchiverExtInfo> Extensions;
    27   #ifndef _SFX
    28   CByteBuffer StartSignature;
    29   CByteBuffer FinishSignature;
    30   bool Associate;
    31   #endif
    32   int FindExtension(const UString &ext) const
    33   {
    34     for (int i = 0; i < Extensions.Size(); i++)
    35       if (ext.CompareNoCase(Extensions[i].Ext) == 0)
    36         return i;
    37     return -1;
    38   }
    39   UString GetAllExtensions() const
    40   {
    41     UString s;
    42     for (int i = 0; i < Extensions.Size(); i++)
    43     {
    44       if (i > 0)
    45         s += ' ';
    46       s += Extensions[i].Ext;
    47     }
    48     return s;
    49   }
    50   const UString &GetMainExtension() const 
    51   { 
    52     return Extensions[0].Ext;
    53   }
    54   bool UpdateEnabled;
    55   bool KeepName;
    57   CArchiverInfo(): UpdateEnabled(false), KeepName(false)
    58   #ifndef _SFX
    59   ,Associate(true)
    60   #endif
    61   {}
    62 };
    64 void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers);
    66 #endif

mercurial