Bug 1799250 - Don't use extractOrCopyRawBuffer in Locale.cpp; r=anba

Differential Revision: https://phabricator.services.mozilla.com/D161471
This commit is contained in:
Dan Minor 2022-11-08 17:41:49 +00:00
Родитель 1d1700c1ef
Коммит d6d0fb6210
1 изменённых файлов: 4 добавлений и 10 удалений

Просмотреть файл

@ -547,11 +547,8 @@ Result<Ok, Locale::CanonicalizationError> Locale::CanonicalizeUnicodeExtension(
// We can keep the previous extension when canonicalization didn't modify it.
if (static_cast<Span<const char>>(sb) != extension) {
// Null-terminate the new string and replace the previous extension.
if (!sb.append('\0')) {
return Err(CanonicalizationError::OutOfMemory);
}
UniqueChars canonical(sb.extractOrCopyRawBuffer());
// Otherwise replace the previous extension with the canonical extension.
UniqueChars canonical = DuplicateStringToUniqueChars(sb);
if (!canonical) {
return Err(CanonicalizationError::OutOfMemory);
}
@ -729,11 +726,8 @@ Locale::CanonicalizeTransformExtension(UniqueChars& aTransformExtension) {
// We can keep the previous extension when canonicalization didn't modify it.
if (static_cast<Span<const char>>(sb) != extension) {
// Null-terminate the new string and replace the previous extension.
if (!sb.append('\0')) {
return Err(CanonicalizationError::OutOfMemory);
}
UniqueChars canonical(sb.extractOrCopyRawBuffer());
// Otherwise replace the previous extension with the canonical extension.
UniqueChars canonical = DuplicateStringToUniqueChars(sb);
if (!canonical) {
return Err(CanonicalizationError::OutOfMemory);
}