# HG changeset patch # User Mike Hommey # Date 1692250631 0 # Node ID 68ff4d3f7338248b4d67cf03aade5a73f8d396b2 # Parent 18db2934736dc8d16e5b5840ec0b170aef5c0c3b Bug 1849070 - Avoid using char_traits. r=spidermonkey-reviewers,anba It is not guaranteed to exist by the standard, and is actively being removed from libc++ in LLVM 18. Differential Revision: https://phabricator.services.mozilla.com/D186421 diff --git a/js/src/builtin/intl/Locale.cpp b/js/src/builtin/intl/Locale.cpp --- a/js/src/builtin/intl/Locale.cpp +++ b/js/src/builtin/intl/Locale.cpp @@ -796,18 +796,20 @@ static mozilla::Maybe Fi return mozilla::Some(IndexAndLength{size_t(beginType - extension), size_t(endType - beginType)}); } static inline auto FindUnicodeExtensionType(JSLinearString* unicodeExtension, UnicodeKey key) { JS::AutoCheckCannotGC nogc; return unicodeExtension->hasLatin1Chars() - ? FindUnicodeExtensionType(unicodeExtension->latin1Chars(nogc), - unicodeExtension->length(), key) + ? FindUnicodeExtensionType( + reinterpret_cast( + unicodeExtension->latin1Chars(nogc)), + unicodeExtension->length(), key) : FindUnicodeExtensionType(unicodeExtension->twoByteChars(nogc), unicodeExtension->length(), key); } // Return the sequence of types for the Unicode extension keyword specified by // key or undefined when the keyword isn't present. static bool GetUnicodeExtension(JSContext* cx, LocaleObject* locale, UnicodeKey key, MutableHandleValue value) { @@ -914,17 +916,19 @@ static BaseNamePartsResult BaseNameParts } return {language, script, region}; } static inline auto BaseNameParts(JSLinearString* baseName) { JS::AutoCheckCannotGC nogc; return baseName->hasLatin1Chars() - ? BaseNameParts(baseName->latin1Chars(nogc), baseName->length()) + ? BaseNameParts( + reinterpret_cast(baseName->latin1Chars(nogc)), + baseName->length()) : BaseNameParts(baseName->twoByteChars(nogc), baseName->length()); } // Intl.Locale.prototype.maximize () static bool Locale_maximize(JSContext* cx, const CallArgs& args) { MOZ_ASSERT(IsLocale(args.thisv())); // Step 3.