mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
a807279eb6
Updates the ICU patch "double-conversion.diff" to only use the in-tree copy of double-conversion when building Firefox/SpiderMonkey. Standalone ICU builds instead use the ICU copy of double-conversion. Standalone ICU builds happen when running "intl/icu_sources_data.py" and when converting the in-tree little-endian ICU data file to the big-endian format. `JS_HAS_INTL_API` is used to detect how ICU is built: When building ICU as part of Firefox/SpiderMonkey, `JS_HAS_INTL_API` is guaranteed to be set, whereas in standalone ICU builds `JS_HAS_INTL_API` isn't defined. After applying the updated "double-conversion.diff" patch, ICU was reimported to restore the previously deleted double-conversion sources files from ICU. Depends on D190791 Differential Revision: https://phabricator.services.mozilla.com/D190792
152 lines
4.2 KiB
Diff
152 lines
4.2 KiB
Diff
diff --git a/intl/icu/source/i18n/number_decimalquantity.cpp b/intl/icu/source/i18n/number_decimalquantity.cpp
|
|
--- a/intl/icu/source/i18n/number_decimalquantity.cpp
|
|
+++ b/intl/icu/source/i18n/number_decimalquantity.cpp
|
|
@@ -11,28 +11,37 @@
|
|
#include <stdlib.h>
|
|
|
|
#include "unicode/plurrule.h"
|
|
#include "cmemory.h"
|
|
#include "number_decnum.h"
|
|
#include "putilimp.h"
|
|
#include "number_decimalquantity.h"
|
|
#include "number_roundingutils.h"
|
|
+#ifdef JS_HAS_INTL_API
|
|
+#include "double-conversion/double-conversion.h"
|
|
+#else
|
|
#include "double-conversion.h"
|
|
+#endif
|
|
#include "charstr.h"
|
|
#include "number_utils.h"
|
|
#include "uassert.h"
|
|
#include "util.h"
|
|
|
|
using namespace icu;
|
|
using namespace icu::number;
|
|
using namespace icu::number::impl;
|
|
|
|
+#ifdef JS_HAS_INTL_API
|
|
+using double_conversion::DoubleToStringConverter;
|
|
+using double_conversion::StringToDoubleConverter;
|
|
+#else
|
|
using icu::double_conversion::DoubleToStringConverter;
|
|
using icu::double_conversion::StringToDoubleConverter;
|
|
+#endif
|
|
|
|
namespace {
|
|
|
|
int8_t NEGATIVE_FLAG = 1;
|
|
int8_t INFINITY_FLAG = 2;
|
|
int8_t NAN_FLAG = 4;
|
|
|
|
/** Helper function for safe subtraction (no overflow). */
|
|
diff --git a/intl/icu/source/i18n/number_rounding.cpp b/intl/icu/source/i18n/number_rounding.cpp
|
|
--- a/intl/icu/source/i18n/number_rounding.cpp
|
|
+++ b/intl/icu/source/i18n/number_rounding.cpp
|
|
@@ -5,17 +5,21 @@
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
#include "charstr.h"
|
|
#include "uassert.h"
|
|
#include "unicode/numberformatter.h"
|
|
#include "number_types.h"
|
|
#include "number_decimalquantity.h"
|
|
+#ifdef JS_HAS_INTL_API
|
|
+#include "double-conversion/double-conversion.h"
|
|
+#else
|
|
#include "double-conversion.h"
|
|
+#endif
|
|
#include "number_roundingutils.h"
|
|
#include "number_skeletons.h"
|
|
#include "number_decnum.h"
|
|
#include "putilimp.h"
|
|
#include "string_segment.h"
|
|
|
|
using namespace icu;
|
|
using namespace icu::number;
|
|
diff --git a/intl/icu/source/i18n/number_utils.cpp b/intl/icu/source/i18n/number_utils.cpp
|
|
--- a/intl/icu/source/i18n/number_utils.cpp
|
|
+++ b/intl/icu/source/i18n/number_utils.cpp
|
|
@@ -12,26 +12,34 @@
|
|
#include <stdlib.h>
|
|
#include <cmath>
|
|
#include "number_decnum.h"
|
|
#include "number_types.h"
|
|
#include "number_utils.h"
|
|
#include "charstr.h"
|
|
#include "decContext.h"
|
|
#include "decNumber.h"
|
|
+#ifdef JS_HAS_INTL_API
|
|
+#include "double-conversion/double-conversion.h"
|
|
+#else
|
|
#include "double-conversion.h"
|
|
+#endif
|
|
#include "fphdlimp.h"
|
|
#include "uresimp.h"
|
|
#include "ureslocs.h"
|
|
|
|
using namespace icu;
|
|
using namespace icu::number;
|
|
using namespace icu::number::impl;
|
|
|
|
+#ifdef JS_HAS_INTL_API
|
|
+using double_conversion::DoubleToStringConverter;
|
|
+#else
|
|
using icu::double_conversion::DoubleToStringConverter;
|
|
+#endif
|
|
|
|
|
|
namespace {
|
|
|
|
const char16_t*
|
|
doGetPattern(UResourceBundle* res, const char* nsName, const char* patternKey, UErrorCode& publicStatus,
|
|
UErrorCode& localStatus) {
|
|
// Construct the path into the resource bundle
|
|
diff --git a/intl/icu/source/i18n/units_converter.cpp b/intl/icu/source/i18n/units_converter.cpp
|
|
--- a/intl/icu/source/i18n/units_converter.cpp
|
|
+++ b/intl/icu/source/i18n/units_converter.cpp
|
|
@@ -2,17 +2,21 @@
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
#include "charstr.h"
|
|
#include "cmemory.h"
|
|
+#ifdef JS_HAS_INTL_API
|
|
+#include "double-conversion/string-to-double.h"
|
|
+#else
|
|
#include "double-conversion-string-to-double.h"
|
|
+#endif
|
|
#include "measunit_impl.h"
|
|
#include "putilimp.h"
|
|
#include "uassert.h"
|
|
#include "unicode/errorcode.h"
|
|
#include "unicode/localpointer.h"
|
|
#include "unicode/stringpiece.h"
|
|
#include "units_converter.h"
|
|
#include <algorithm>
|
|
@@ -101,17 +105,21 @@ void U_I18N_API Factor::substituteConsta
|
|
this->constantExponents[i] = 0;
|
|
}
|
|
}
|
|
|
|
namespace {
|
|
|
|
/* Helpers */
|
|
|
|
+#ifdef JS_HAS_INTL_API
|
|
+using double_conversion::StringToDoubleConverter;
|
|
+#else
|
|
using icu::double_conversion::StringToDoubleConverter;
|
|
+#endif
|
|
|
|
// TODO: Make this a shared-utility function.
|
|
// Returns `double` from a scientific number(i.e. "1", "2.01" or "3.09E+4")
|
|
double strToDouble(StringPiece strNum, UErrorCode &status) {
|
|
// We are processing well-formed input, so we don't need any special options to
|
|
// StringToDoubleConverter.
|
|
StringToDoubleConverter converter(0, 0, 0, "", "");
|
|
int32_t count;
|