other-licenses/7zstub/src/7zip/FileManager/FormatUtils.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 // FormatUtils.cpp
     3 #include "StdAfx.h"
     5 #include "FormatUtils.h"
     6 #include "Common/IntToString.h"
     7 #include "Windows/ResourceString.h"
     9 #ifdef LANG
    10 #include "LangUtils.h"
    11 #endif
    13 UString NumberToString(UInt64 number)
    14 {
    15   wchar_t numberString[32];
    16   ConvertUInt64ToString(number, numberString);
    17   return numberString;
    18 }
    20 UString MyFormatNew(const UString &format, const UString &argument)
    21 {
    22   UString result = format;
    23   result.Replace(L"{0}", argument);
    24   return result;
    25 }
    27 UString MyFormatNew(UINT resourceID, 
    28     #ifdef LANG
    29     UInt32 langID, 
    30     #endif
    31     const UString &argument)
    32 {
    33   return MyFormatNew(
    34     #ifdef LANG
    35     LangString(resourceID, langID), 
    36     #else
    37     NWindows::MyLoadStringW(resourceID), 
    38     #endif
    39     argument);
    40 }

mercurial