mfbt/double-conversion/add-mfbt-api-markers.patch

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.

michael@0 1 diff --git a/mfbt/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion.h
michael@0 2 index f98edae..c62b16b 100644
michael@0 3 --- a/mfbt/double-conversion/double-conversion.h
michael@0 4 +++ b/mfbt/double-conversion/double-conversion.h
michael@0 5 @@ -28,6 +28,7 @@
michael@0 6 #ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
michael@0 7 #define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
michael@0 8
michael@0 9 +#include "mozilla/Types.h"
michael@0 10 #include "utils.h"
michael@0 11
michael@0 12 namespace double_conversion {
michael@0 13 @@ -129,7 +130,7 @@ class DoubleToStringConverter {
michael@0 14 }
michael@0 15
michael@0 16 // Returns a converter following the EcmaScript specification.
michael@0 17 - static const DoubleToStringConverter& EcmaScriptConverter();
michael@0 18 + static MFBT_API const DoubleToStringConverter& EcmaScriptConverter();
michael@0 19
michael@0 20 // Computes the shortest string of digits that correctly represent the input
michael@0 21 // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high
michael@0 22 @@ -197,7 +198,7 @@ class DoubleToStringConverter {
michael@0 23 // The last two conditions imply that the result will never contain more than
michael@0 24 // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters
michael@0 25 // (one additional character for the sign, and one for the decimal point).
michael@0 26 - bool ToFixed(double value,
michael@0 27 + MFBT_API bool ToFixed(double value,
michael@0 28 int requested_digits,
michael@0 29 StringBuilder* result_builder) const;
michael@0 30
michael@0 31 @@ -229,7 +230,7 @@ class DoubleToStringConverter {
michael@0 32 // kMaxExponentialDigits + 8 characters (the sign, the digit before the
michael@0 33 // decimal point, the decimal point, the exponent character, the
michael@0 34 // exponent's sign, and at most 3 exponent digits).
michael@0 35 - bool ToExponential(double value,
michael@0 36 + MFBT_API bool ToExponential(double value,
michael@0 37 int requested_digits,
michael@0 38 StringBuilder* result_builder) const;
michael@0 39
michael@0 40 @@ -267,7 +268,7 @@ class DoubleToStringConverter {
michael@0 41 // The last condition implies that the result will never contain more than
michael@0 42 // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
michael@0 43 // exponent character, the exponent's sign, and at most 3 exponent digits).
michael@0 44 - bool ToPrecision(double value,
michael@0 45 + MFBT_API bool ToPrecision(double value,
michael@0 46 int precision,
michael@0 47 StringBuilder* result_builder) const;
michael@0 48
michael@0 49 @@ -292,7 +293,7 @@ class DoubleToStringConverter {
michael@0 50 // kBase10MaximalLength.
michael@0 51 // Note that DoubleToAscii null-terminates its input. So the given buffer
michael@0 52 // should be at least kBase10MaximalLength + 1 characters long.
michael@0 53 - static const int kBase10MaximalLength = 17;
michael@0 54 + static const MFBT_DATA int kBase10MaximalLength = 17;
michael@0 55
michael@0 56 // Converts the given double 'v' to ascii. 'v' must not be NaN, +Infinity, or
michael@0 57 // -Infinity. In SHORTEST_SINGLE-mode this restriction also applies to 'v'
michael@0 58 @@ -332,7 +333,7 @@ class DoubleToStringConverter {
michael@0 59 // terminating null-character when computing the maximal output size.
michael@0 60 // The given length is only used in debug mode to ensure the buffer is big
michael@0 61 // enough.
michael@0 62 - static void DoubleToAscii(double v,
michael@0 63 + static MFBT_API void DoubleToAscii(double v,
michael@0 64 DtoaMode mode,
michael@0 65 int requested_digits,
michael@0 66 char* buffer,
michael@0 67 @@ -343,7 +344,7 @@ class DoubleToStringConverter {
michael@0 68
michael@0 69 private:
michael@0 70 // Implementation for ToShortest and ToShortestSingle.
michael@0 71 - bool ToShortestIeeeNumber(double value,
michael@0 72 + MFBT_API bool ToShortestIeeeNumber(double value,
michael@0 73 StringBuilder* result_builder,
michael@0 74 DtoaMode mode) const;
michael@0 75
michael@0 76 @@ -351,15 +352,15 @@ class DoubleToStringConverter {
michael@0 77 // corresponding string using the configured infinity/nan-symbol.
michael@0 78 // If either of them is NULL or the value is not special then the
michael@0 79 // function returns false.
michael@0 80 - bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
michael@0 81 + MFBT_API bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
michael@0 82 // Constructs an exponential representation (i.e. 1.234e56).
michael@0 83 // The given exponent assumes a decimal point after the first decimal digit.
michael@0 84 - void CreateExponentialRepresentation(const char* decimal_digits,
michael@0 85 + MFBT_API void CreateExponentialRepresentation(const char* decimal_digits,
michael@0 86 int length,
michael@0 87 int exponent,
michael@0 88 StringBuilder* result_builder) const;
michael@0 89 // Creates a decimal representation (i.e 1234.5678).
michael@0 90 - void CreateDecimalRepresentation(const char* decimal_digits,
michael@0 91 + MFBT_API void CreateDecimalRepresentation(const char* decimal_digits,
michael@0 92 int length,
michael@0 93 int decimal_point,
michael@0 94 int digits_after_point,

mercurial