Bug 1849070 - Avoid using char_traits<unsigned char>. r=spidermonkey-reviewers,anba
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 17 Aug 2023 05:37:11 +0000 (23 months ago)
changeset 675450 68ff4d3f7338248b4d67cf03aade5a73f8d396b2
parent 675449 18db2934736dc8d16e5b5840ec0b170aef5c0c3b
child 675451 b18da04ec31bc97351735f7642b775c1dd432927
push id41111
push usercsabou@mozilla.com
push dateThu, 17 Aug 2023 15:01:15 +0000 (23 months ago)
treeherdermozilla-central@a6c91cd0d909 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspidermonkey-reviewers, anba
bugs1849070
milestone118.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1849070 - Avoid using char_traits<unsigned char>. 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
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<IndexAndLength> 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<const char*>(
+                       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<const char*>(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.