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 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* Implements the C99 <inttypes.h> interface, minus the SCN* format macros. */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef mozilla_IntegerPrintfMacros_h_ |
michael@0 | 9 | #define mozilla_IntegerPrintfMacros_h_ |
michael@0 | 10 | |
michael@0 | 11 | /* |
michael@0 | 12 | * MSVC++ doesn't include <inttypes.h>, even in versions shipping <stdint.h>, so |
michael@0 | 13 | * we have to reimplement it there. Note: <inttypes.h> #includes <stdint.h>. |
michael@0 | 14 | * |
michael@0 | 15 | * Note that this header DOES NOT implement <inttypes.h>'s scanf macros. MSVC's |
michael@0 | 16 | * scanf doesn't have sufficient format specifier support to implement them |
michael@0 | 17 | * (specifically, to implement scanning into an 8-bit location). |
michael@0 | 18 | * |
michael@0 | 19 | * http://stackoverflow.com/questions/3036396/scanfd-char-char-as-int-format-string |
michael@0 | 20 | * |
michael@0 | 21 | * Moreover, scanf is a footgun: if the input number exceeds the bounds of the |
michael@0 | 22 | * target type, behavior is undefined (in the compiler sense: that is, this code |
michael@0 | 23 | * could overwrite your hard drive with zeroes): |
michael@0 | 24 | * |
michael@0 | 25 | * uint8_t u; |
michael@0 | 26 | * sscanf("256", "%" SCNu8, &u); // BAD |
michael@0 | 27 | * |
michael@0 | 28 | * This header will sometimes provide SCN* macros, by dint of being implemented |
michael@0 | 29 | * using <inttypes.h>. But for these reasons, *never* use them! |
michael@0 | 30 | */ |
michael@0 | 31 | |
michael@0 | 32 | #if defined(MOZ_CUSTOM_INTTYPES_H) |
michael@0 | 33 | # include MOZ_CUSTOM_INTTYPES_H |
michael@0 | 34 | #elif defined(_MSC_VER) |
michael@0 | 35 | # include "mozilla/MSIntTypes.h" |
michael@0 | 36 | #else |
michael@0 | 37 | # include <inttypes.h> |
michael@0 | 38 | #endif |
michael@0 | 39 | |
michael@0 | 40 | #endif /* mozilla_IntegerPrintfMacros_h_ */ |