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