other-licenses/7zstub/src/7zip/Common/LSBFDecoder.cpp

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 // Stream/LSBFDecoder.cpp
     3 #include "StdAfx.h"
     5 #include "LSBFDecoder.h"
     7 namespace NStream {
     8 namespace NLSBF {
    10 Byte kInvertTable[256];
    12 class CInverterTableInitializer
    13 {
    14 public:
    15   CInverterTableInitializer()
    16   {
    17     for(int i = 0; i < 256; i++)
    18     {
    19       Byte b = Byte(i);
    20       Byte bInvert = 0;
    21       for(int j = 0; j < 8; j++)
    22       {
    23         bInvert <<= 1;
    24         if (b & 1)
    25           bInvert |= 1;
    26         b >>= 1;
    27       }
    28       kInvertTable[i] = bInvert;
    29     }
    30   }
    31 } g_InverterTableInitializer;
    34 }}

mercurial