| 1 |
diff --git a/double-conversion/double-to-string.h b/double-conversion/double-to-string.h |
| 2 |
--- a/double-conversion/double-to-string.h |
| 3 |
+++ b/double-conversion/double-to-string.h |
| 4 |
@@ -23,16 +23,17 @@ |
| 5 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 6 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 7 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 8 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 9 |
|
| 10 |
#ifndef DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ |
| 11 |
#define DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ |
| 12 |
|
| 13 |
+#include "mozilla/Types.h" |
| 14 |
#include "utils.h" |
| 15 |
|
| 16 |
namespace double_conversion { |
| 17 |
|
| 18 |
class DoubleToStringConverter { |
| 19 |
public: |
| 20 |
// When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint |
| 21 |
// or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the |
| 22 |
@@ -192,17 +193,17 @@ class DoubleToStringConverter { |
| 23 |
// |
| 24 |
// Flags: UNIQUE_ZERO and EMIT_POSITIVE_EXPONENT_SIGN. |
| 25 |
// Special values: "Infinity" and "NaN". |
| 26 |
// Lower case 'e' for exponential values. |
| 27 |
// decimal_in_shortest_low: -6 |
| 28 |
// decimal_in_shortest_high: 21 |
| 29 |
// max_leading_padding_zeroes_in_precision_mode: 6 |
| 30 |
// max_trailing_padding_zeroes_in_precision_mode: 0 |
| 31 |
- static const DoubleToStringConverter& EcmaScriptConverter(); |
| 32 |
+ static MFBT_API const DoubleToStringConverter& EcmaScriptConverter(); |
| 33 |
|
| 34 |
// Computes the shortest string of digits that correctly represent the input |
| 35 |
// number. Depending on decimal_in_shortest_low and decimal_in_shortest_high |
| 36 |
// (see constructor) it then either returns a decimal representation, or an |
| 37 |
// exponential representation. |
| 38 |
// Example with decimal_in_shortest_low = -6, |
| 39 |
// decimal_in_shortest_high = 21, |
| 40 |
// EMIT_POSITIVE_EXPONENT_SIGN activated, and |
| 41 |
@@ -277,17 +278,17 @@ class DoubleToStringConverter { |
| 42 |
// been provided to the constructor, |
| 43 |
// - 'value' > 10^kMaxFixedDigitsBeforePoint, or |
| 44 |
// - 'requested_digits' > kMaxFixedDigitsAfterPoint. |
| 45 |
// The last two conditions imply that the result for non-special values never |
| 46 |
// contains more than |
| 47 |
// 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters |
| 48 |
// (one additional character for the sign, and one for the decimal point). |
| 49 |
// In addition, the buffer must be able to hold the trailing '\0' character. |
| 50 |
- bool ToFixed(double value, |
| 51 |
+ MFBT_API bool ToFixed(double value, |
| 52 |
int requested_digits, |
| 53 |
StringBuilder* result_builder) const; |
| 54 |
|
| 55 |
// Computes a representation in exponential format with requested_digits |
| 56 |
// after the decimal point. The last emitted digit is rounded. |
| 57 |
// If requested_digits equals -1, then the shortest exponential representation |
| 58 |
// is computed. |
| 59 |
// |
| 60 |
@@ -311,17 +312,17 @@ class DoubleToStringConverter { |
| 61 |
// been provided to the constructor, |
| 62 |
// - 'requested_digits' > kMaxExponentialDigits. |
| 63 |
// |
| 64 |
// The last condition implies that the result never contains more than |
| 65 |
// kMaxExponentialDigits + 8 characters (the sign, the digit before the |
| 66 |
// decimal point, the decimal point, the exponent character, the |
| 67 |
// exponent's sign, and at most 3 exponent digits). |
| 68 |
// In addition, the buffer must be able to hold the trailing '\0' character. |
| 69 |
- bool ToExponential(double value, |
| 70 |
+ MFBT_API bool ToExponential(double value, |
| 71 |
int requested_digits, |
| 72 |
StringBuilder* result_builder) const; |
| 73 |
|
| 74 |
|
| 75 |
// Computes 'precision' leading digits of the given 'value' and returns them |
| 76 |
// either in exponential or decimal format, depending on |
| 77 |
// max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the |
| 78 |
// constructor). |
| 79 |
@@ -352,17 +353,17 @@ class DoubleToStringConverter { |
| 80 |
// been provided to the constructor, |
| 81 |
// - precision < kMinPericisionDigits |
| 82 |
// - precision > kMaxPrecisionDigits |
| 83 |
// |
| 84 |
// The last condition implies that the result never contains more than |
| 85 |
// kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the |
| 86 |
// exponent character, the exponent's sign, and at most 3 exponent digits). |
| 87 |
// In addition, the buffer must be able to hold the trailing '\0' character. |
| 88 |
- bool ToPrecision(double value, |
| 89 |
+ MFBT_API bool ToPrecision(double value, |
| 90 |
int precision, |
| 91 |
StringBuilder* result_builder) const; |
| 92 |
|
| 93 |
enum DtoaMode { |
| 94 |
// Produce the shortest correct representation. |
| 95 |
// For example the output of 0.299999999999999988897 is (the less accurate |
| 96 |
// but correct) 0.3. |
| 97 |
SHORTEST, |
| 98 |
@@ -414,44 +415,44 @@ class DoubleToStringConverter { |
| 99 |
// DoubleToAscii expects the given buffer to be big enough to hold all |
| 100 |
// digits and a terminating null-character. In SHORTEST-mode it expects a |
| 101 |
// buffer of at least kBase10MaximalLength + 1. In all other modes the |
| 102 |
// requested_digits parameter and the padding-zeroes limit the size of the |
| 103 |
// output. Don't forget the decimal point, the exponent character and the |
| 104 |
// terminating null-character when computing the maximal output size. |
| 105 |
// The given length is only used in debug mode to ensure the buffer is big |
| 106 |
// enough. |
| 107 |
- static void DoubleToAscii(double v, |
| 108 |
+ static MFBT_API void DoubleToAscii(double v, |
| 109 |
DtoaMode mode, |
| 110 |
int requested_digits, |
| 111 |
char* buffer, |
| 112 |
int buffer_length, |
| 113 |
bool* sign, |
| 114 |
int* length, |
| 115 |
int* point); |
| 116 |
|
| 117 |
private: |
| 118 |
// Implementation for ToShortest and ToShortestSingle. |
| 119 |
- bool ToShortestIeeeNumber(double value, |
| 120 |
+ MFBT_API bool ToShortestIeeeNumber(double value, |
| 121 |
StringBuilder* result_builder, |
| 122 |
DtoaMode mode) const; |
| 123 |
|
| 124 |
// If the value is a special value (NaN or Infinity) constructs the |
| 125 |
// corresponding string using the configured infinity/nan-symbol. |
| 126 |
// If either of them is NULL or the value is not special then the |
| 127 |
// function returns false. |
| 128 |
- bool HandleSpecialValues(double value, StringBuilder* result_builder) const; |
| 129 |
+ MFBT_API bool HandleSpecialValues(double value, StringBuilder* result_builder) const; |
| 130 |
// Constructs an exponential representation (i.e. 1.234e56). |
| 131 |
// The given exponent assumes a decimal point after the first decimal digit. |
| 132 |
- void CreateExponentialRepresentation(const char* decimal_digits, |
| 133 |
+ MFBT_API void CreateExponentialRepresentation(const char* decimal_digits, |
| 134 |
int length, |
| 135 |
int exponent, |
| 136 |
StringBuilder* result_builder) const; |
| 137 |
// Creates a decimal representation (i.e 1234.5678). |
| 138 |
- void CreateDecimalRepresentation(const char* decimal_digits, |
| 139 |
+ MFBT_API void CreateDecimalRepresentation(const char* decimal_digits, |
| 140 |
int length, |
| 141 |
int decimal_point, |
| 142 |
int digits_after_point, |
| 143 |
StringBuilder* result_builder) const; |
| 144 |
|
| 145 |
const int flags_; |
| 146 |
const char* const infinity_symbol_; |
| 147 |
const char* const nan_symbol_; |
| 148 |
diff --git a/double-conversion/string-to-double.h b/double-conversion/string-to-double.h |
| 149 |
--- a/double-conversion/string-to-double.h |
| 150 |
+++ b/double-conversion/string-to-double.h |
| 151 |
@@ -23,16 +23,17 @@ |
| 152 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 153 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 154 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 155 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 156 |
|
| 157 |
#ifndef DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_ |
| 158 |
#define DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_ |
| 159 |
|
| 160 |
+#include "mozilla/Types.h" |
| 161 |
#include "utils.h" |
| 162 |
|
| 163 |
namespace double_conversion { |
| 164 |
|
| 165 |
class StringToDoubleConverter { |
| 166 |
public: |
| 167 |
// Enumeration for allowing octals and ignoring junk when converting |
| 168 |
// strings to numbers. |
| 169 |
@@ -178,34 +179,34 @@ class StringToDoubleConverter { |
| 170 |
separator_(separator) { |
| 171 |
} |
| 172 |
|
| 173 |
// Performs the conversion. |
| 174 |
// The output parameter 'processed_characters_count' is set to the number |
| 175 |
// of characters that have been processed to read the number. |
| 176 |
// Spaces than are processed with ALLOW_{LEADING|TRAILING}_SPACES are included |
| 177 |
// in the 'processed_characters_count'. Trailing junk is never included. |
| 178 |
- double StringToDouble(const char* buffer, |
| 179 |
+ MFBT_API double StringToDouble(const char* buffer, |
| 180 |
int length, |
| 181 |
int* processed_characters_count) const; |
| 182 |
|
| 183 |
// Same as StringToDouble above but for 16 bit characters. |
| 184 |
- double StringToDouble(const uc16* buffer, |
| 185 |
+ MFBT_API double StringToDouble(const uc16* buffer, |
| 186 |
int length, |
| 187 |
int* processed_characters_count) const; |
| 188 |
|
| 189 |
// Same as StringToDouble but reads a float. |
| 190 |
// Note that this is not equivalent to static_cast<float>(StringToDouble(...)) |
| 191 |
// due to potential double-rounding. |
| 192 |
- float StringToFloat(const char* buffer, |
| 193 |
+ MFBT_API float StringToFloat(const char* buffer, |
| 194 |
int length, |
| 195 |
int* processed_characters_count) const; |
| 196 |
|
| 197 |
// Same as StringToFloat above but for 16 bit characters. |
| 198 |
- float StringToFloat(const uc16* buffer, |
| 199 |
+ MFBT_API float StringToFloat(const uc16* buffer, |
| 200 |
int length, |
| 201 |
int* processed_characters_count) const; |
| 202 |
|
| 203 |
// Same as StringToDouble for T = double, and StringToFloat for T = float. |
| 204 |
template <typename T> |
| 205 |
T StringTo(const char* buffer, |
| 206 |
int length, |
| 207 |
int* processed_characters_count) const; |