Remove static Create() helper methods from Strings.
Following the clang roll at 00da087ac31a2ef4630eeefc7e7cd2260df98f33,
unsafe buffer usage is enforced directly on constructors, so there
is no need to keep using these helper methods.
-- Make span() constructor similarly public.
Change-Id: Iad9bcdcb93cac996ac9adbd5504dc0ab8e4e9242
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/121150
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index b3a01fd..af1b3b0 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -521,7 +521,7 @@
len--;
}
});
- return UNSAFE_TODO(ByteString::Create(okeybuf, len));
+ return UNSAFE_TODO(ByteString(okeybuf, len));
}
bool CPDF_SecurityHandler::CheckOwnerPassword(const ByteString& password) {
@@ -585,8 +585,8 @@
FXSYS_memcpy(tempbuf, kDefaultPasscode, sizeof(kDefaultPasscode)));
CRYPT_ArcFourCryptBlock(tempbuf,
pdfium::make_span(m_EncryptKey).first(key_len));
- pEncryptDict->SetNewFor<CPDF_String>(
- "U", UNSAFE_TODO(ByteString::Create(tempbuf, 32)));
+ pEncryptDict->SetNewFor<CPDF_String>("U",
+ UNSAFE_TODO(ByteString(tempbuf, 32)));
} else {
CRYPT_md5_context md5 = CRYPT_MD5Start();
CRYPT_MD5Update(&md5, kDefaultPasscode);
@@ -608,8 +608,8 @@
}
CRYPT_MD5Generate(pdfium::make_span(digest).first(16u),
pdfium::make_span(digest).subspan(16u).data());
- pEncryptDict->SetNewFor<CPDF_String>(
- "U", UNSAFE_TODO(ByteString::Create(digest, 32)));
+ pEncryptDict->SetNewFor<CPDF_String>("U",
+ UNSAFE_TODO(ByteString(digest, 32)));
}
InitCryptoHandler();
@@ -638,8 +638,8 @@
CRYPT_SHA256Finish(&sha2, pdfium::make_span(digest1).first(32u));
}
UNSAFE_TODO(FXSYS_memcpy(digest1 + 32, digest, 16));
- pEncryptDict->SetNewFor<CPDF_String>(
- "U", UNSAFE_TODO(ByteString::Create(digest1, 48)));
+ pEncryptDict->SetNewFor<CPDF_String>("U",
+ UNSAFE_TODO(ByteString(digest1, 48)));
if (m_Revision >= 6) {
Revision6_Hash(password, UNSAFE_TODO(digest + 8), nullptr, digest1);
} else {
@@ -653,8 +653,8 @@
uint8_t iv[16] = {};
CRYPT_AESSetIV(&aes, iv);
CRYPT_AESEncrypt(&aes, digest1, m_EncryptKey.data(), m_EncryptKey.size());
- pEncryptDict->SetNewFor<CPDF_String>(
- "UE", UNSAFE_TODO(ByteString::Create(digest1, 32)));
+ pEncryptDict->SetNewFor<CPDF_String>("UE",
+ UNSAFE_TODO(ByteString(digest1, 32)));
}
void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict) {
@@ -687,8 +687,8 @@
uint8_t buf1[16];
CRYPT_AESEncrypt(&aes, buf1, buf, 16);
- pEncryptDict->SetNewFor<CPDF_String>(
- "Perms", UNSAFE_TODO(ByteString::Create(buf1, 16)));
+ pEncryptDict->SetNewFor<CPDF_String>("Perms",
+ UNSAFE_TODO(ByteString(buf1, 16)));
}
void CPDF_SecurityHandler::InitCryptoHandler() {
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
index b098ee6..4e1448c 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
@@ -39,7 +39,7 @@
template <size_t N>
ByteString ToByteString(const char (&array)[N]) {
// SAFETY: compiler correctly infers size.
- return UNSAFE_BUFFERS(ByteString::Create(array, N - 1));
+ return UNSAFE_BUFFERS(ByteString(array, N - 1));
}
} // namespace
diff --git a/core/fpdfdoc/cpdf_annotlist_unittest.cpp b/core/fpdfdoc/cpdf_annotlist_unittest.cpp
index 469f766..a59f959 100644
--- a/core/fpdfdoc/cpdf_annotlist_unittest.cpp
+++ b/core/fpdfdoc/cpdf_annotlist_unittest.cpp
@@ -58,7 +58,7 @@
ByteString MakeByteString(std::initializer_list<uint8_t> bytes) {
// SAFETY: compiler determines size of initializer_list.
- return UNSAFE_BUFFERS(ByteString::Create(std::data(bytes), std::size(bytes)));
+ return UNSAFE_BUFFERS(ByteString(std::data(bytes), std::size(bytes)));
}
ByteString GetRawContents(const CPDF_Annot* annotation) {
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 4bdbf1e..aae7dc1 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -115,7 +115,7 @@
return std::nullopt;
}
- return WideString::Create(lpszFullString, static_cast<size_t>(nLen));
+ return WideString(lpszFullString, static_cast<size_t>(nLen));
});
}
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index 70a8192..7274d76 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -91,7 +91,6 @@
return ret;
}
-// TODO(tsepez): should be UNSAFE_BUFFER_USAGE.
ByteString::ByteString(const char* pStr, size_t nLen) {
if (nLen) {
// SAFETY: caller ensures `pStr` points to at least `nLen` chars.
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index 54b29e8..633f311 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -29,14 +29,6 @@
[[nodiscard]] static ByteString Format(const char* pFormat, ...);
[[nodiscard]] static ByteString FormatV(const char* pFormat, va_list argList);
- // Make public when compiler enforces UNSAFE_BUFFER_USAGE on ctors.
- UNSAFE_BUFFER_USAGE static ByteString Create(const char* str, size_t len) {
- return UNSAFE_BUFFERS(ByteString(str, len));
- }
- UNSAFE_BUFFER_USAGE static ByteString Create(const uint8_t* str, size_t len) {
- return UNSAFE_BUFFERS(ByteString(str, len));
- }
-
ByteString() = default;
ByteString(const ByteString& other) = default;
@@ -45,6 +37,9 @@
~ByteString() = default;
+ UNSAFE_BUFFER_USAGE ByteString(const char* pStr, size_t len);
+ UNSAFE_BUFFER_USAGE ByteString(const uint8_t* pStr, size_t len);
+
// Make a one-character string from a char.
explicit ByteString(char ch);
@@ -104,10 +99,6 @@
uint32_t GetID() const { return AsStringView().GetID(); }
protected:
- // Make public when compiler enforces UNSAFE_BUFFER_USAGE on ctors.
- UNSAFE_BUFFER_USAGE ByteString(const char* pStr, size_t len);
- UNSAFE_BUFFER_USAGE ByteString(const uint8_t* pStr, size_t len);
-
intptr_t ReferenceCountForTesting() const;
friend class ByteString_Assign_Test;
diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
index c423622..e76a663 100644
--- a/core/fxcrt/bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -1900,7 +1900,7 @@
// Writing a ByteString with nulls but specifying its length treats it as
// a C++-style string.
// SAFETY: required for testing, manual length calculation based on above.
- str = UNSAFE_BUFFERS(ByteString::Create(stringWithNulls, 4));
+ str = UNSAFE_BUFFERS(ByteString(stringWithNulls, 4));
EXPECT_EQ(4u, str.GetLength());
stream.str("");
stream << str;
diff --git a/core/fxcrt/span.h b/core/fxcrt/span.h
index a330d62..107d704 100644
--- a/core/fxcrt/span.h
+++ b/core/fxcrt/span.h
@@ -206,6 +206,11 @@
// [span.cons], span constructors, copy, assignment, and destructor
constexpr span() noexcept = default;
+ UNSAFE_BUFFER_USAGE constexpr span(T* data, size_t size) noexcept
+ : data_(data), size_(size) {
+ DCHECK(data_ || size_ == 0);
+ }
+
// TODO(dcheng): Implement construction from a |begin| and |end| pointer.
template <size_t N>
constexpr span(T (&array)[N]) noexcept : span(array, N) {
@@ -332,14 +337,6 @@
}
private:
- // Move to public section once clang starts enforcing UNSAFE_BUFFERS on
- // constructors (https://github.com/llvm/llvm-project/issues/80482). Until
- // then, force calls into two-arg make_span() which enforces the unsafe
- // buffer usage checks.
- UNSAFE_BUFFER_USAGE constexpr span(T* data, size_t size) noexcept
- : data_(data), size_(size) {
- DCHECK(data_ || size_ == 0);
- }
template <typename U>
friend constexpr span<U> make_span(U* data, size_t size) noexcept;
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 65bac9a..708ceb0 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -392,7 +392,6 @@
return ret;
}
-// TODO(tsepez): should be UNSAFE_BUFFER_USAGE.
WideString::WideString(const wchar_t* pStr, size_t nLen) {
if (nLen) {
// SAFETY: caller ensures `pStr` points to al least `nLen` wchar_t.
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index 82832cb..2e7345b 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -32,12 +32,6 @@
[[nodiscard]] static WideString FormatV(const wchar_t* lpszFormat,
va_list argList);
- // Remove when UNSAFE_BUFFER_USAGE enforced on ctors.
- UNSAFE_BUFFER_USAGE static WideString Create(const wchar_t* pStr,
- size_t len) {
- return UNSAFE_BUFFERS(WideString(pStr, len));
- }
-
WideString() = default;
WideString(const WideString& other) = default;
@@ -46,6 +40,8 @@
~WideString() = default;
+ UNSAFE_BUFFER_USAGE WideString(const wchar_t* pStr, size_t len);
+
// Make a one-character string from one wide char.
explicit WideString(wchar_t ch);
@@ -134,9 +130,6 @@
WideString EncodeEntities() const;
protected:
- // Make public UNSAFE_BUFFER_USAGE enforced on ctors.
- UNSAFE_BUFFER_USAGE WideString(const wchar_t* pStr, size_t len);
-
intptr_t ReferenceCountForTesting() const;
friend class WideString_Assign_Test;
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index b6b50c2..1732052 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -1250,11 +1250,11 @@
WideString out;
} const utf16be_decode_cases[] = {
{"", L""},
- {UNSAFE_BUFFERS(ByteString::Create("\0a\0b\0c", 6)), L"abc"},
- {UNSAFE_BUFFERS(ByteString::Create("\0a\0b\0c\0\0\0d\0e\0f", 14)),
- UNSAFE_BUFFERS(WideString::Create(L"abc\0def", 7))},
- {UNSAFE_BUFFERS(ByteString::Create(" &", 2)), L"…"},
- {UNSAFE_BUFFERS(ByteString::Create("\xD8\x3C\xDF\xA8", 4)), L"🎨"},
+ {UNSAFE_BUFFERS(ByteString("\0a\0b\0c", 6)), L"abc"},
+ {UNSAFE_BUFFERS(ByteString("\0a\0b\0c\0\0\0d\0e\0f", 14)),
+ UNSAFE_BUFFERS(WideString(L"abc\0def", 7))},
+ {UNSAFE_BUFFERS(ByteString(" &", 2)), L"…"},
+ {UNSAFE_BUFFERS(ByteString("\xD8\x3C\xDF\xA8", 4)), L"🎨"},
};
UNSAFE_TODO({
for (size_t i = 0; i < std::size(utf16be_decode_cases); ++i) {
@@ -1273,11 +1273,11 @@
} const utf16le_decode_cases[] = {
// SAFETY: not required, control sizes for test.
{"", L""},
- {UNSAFE_BUFFERS(ByteString::Create("a\0b\0c\0", 6)), L"abc"},
- {UNSAFE_BUFFERS(ByteString::Create("a\0b\0c\0\0\0d\0e\0f\0", 14)),
- UNSAFE_BUFFERS(WideString::Create(L"abc\0def", 7))},
- {UNSAFE_BUFFERS(ByteString::Create("& ", 2)), L"…"},
- {UNSAFE_BUFFERS(ByteString::Create("\x3C\xD8\xA8\xDF", 4)), L"🎨"},
+ {UNSAFE_BUFFERS(ByteString("a\0b\0c\0", 6)), L"abc"},
+ {UNSAFE_BUFFERS(ByteString("a\0b\0c\0\0\0d\0e\0f\0", 14)),
+ UNSAFE_BUFFERS(WideString(L"abc\0def", 7))},
+ {UNSAFE_BUFFERS(ByteString("& ", 2)), L"…"},
+ {UNSAFE_BUFFERS(ByteString("\x3C\xD8\xA8\xDF", 4)), L"🎨"},
};
UNSAFE_TODO({
for (size_t i = 0; i < std::size(utf16le_decode_cases); ++i) {
@@ -1294,16 +1294,13 @@
WideString ws;
ByteString bs;
} const utf16le_encode_cases[] = {
- {L"", UNSAFE_TODO(ByteString::Create("\0\0", 2))},
- {L"abc", UNSAFE_TODO(ByteString::Create("a\0b\0c\0\0\0", 8))},
- {L"abcdef",
- UNSAFE_TODO(ByteString::Create("a\0b\0c\0d\0e\0f\0\0\0", 14))},
- {L"abc\0def", UNSAFE_TODO(ByteString::Create("a\0b\0c\0\0\0", 8))},
- {L"\xaabb\xccdd",
- UNSAFE_TODO(ByteString::Create("\xbb\xaa\xdd\xcc\0\0", 6))},
- {L"\x3132\x6162",
- UNSAFE_TODO(ByteString::Create("\x32\x31\x62\x61\0\0", 6))},
- {L"🎨", UNSAFE_TODO(ByteString::Create("\x3C\xD8\xA8\xDF\0\0", 6))},
+ {L"", UNSAFE_TODO(ByteString("\0\0", 2))},
+ {L"abc", UNSAFE_TODO(ByteString("a\0b\0c\0\0\0", 8))},
+ {L"abcdef", UNSAFE_TODO(ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14))},
+ {L"abc\0def", UNSAFE_TODO(ByteString("a\0b\0c\0\0\0", 8))},
+ {L"\xaabb\xccdd", UNSAFE_TODO(ByteString("\xbb\xaa\xdd\xcc\0\0", 6))},
+ {L"\x3132\x6162", UNSAFE_TODO(ByteString("\x32\x31\x62\x61\0\0", 6))},
+ {L"🎨", UNSAFE_TODO(ByteString("\x3C\xD8\xA8\xDF\0\0", 6))},
};
UNSAFE_TODO({
for (size_t i = 0; i < std::size(utf16le_encode_cases); ++i) {
@@ -1319,17 +1316,14 @@
WideString ws;
ByteString bs;
} const ucs2le_encode_cases[] = {
- {L"", UNSAFE_TODO(ByteString::Create("\0\0", 2))},
- {L"abc", UNSAFE_TODO(ByteString::Create("a\0b\0c\0\0\0", 8))},
- {L"abcdef",
- UNSAFE_TODO(ByteString::Create("a\0b\0c\0d\0e\0f\0\0\0", 14))},
- {L"abc\0def", UNSAFE_TODO(ByteString::Create("a\0b\0c\0\0\0", 8))},
- {L"\xaabb\xccdd",
- UNSAFE_TODO(ByteString::Create("\xbb\xaa\xdd\xcc\0\0", 6))},
- {L"\x3132\x6162",
- UNSAFE_TODO(ByteString::Create("\x32\x31\x62\x61\0\0", 6))},
+ {L"", UNSAFE_TODO(ByteString("\0\0", 2))},
+ {L"abc", UNSAFE_TODO(ByteString("a\0b\0c\0\0\0", 8))},
+ {L"abcdef", UNSAFE_TODO(ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14))},
+ {L"abc\0def", UNSAFE_TODO(ByteString("a\0b\0c\0\0\0", 8))},
+ {L"\xaabb\xccdd", UNSAFE_TODO(ByteString("\xbb\xaa\xdd\xcc\0\0", 6))},
+ {L"\x3132\x6162", UNSAFE_TODO(ByteString("\x32\x31\x62\x61\0\0", 6))},
#if defined(WCHAR_T_IS_32_BIT)
- {L"🎨", UNSAFE_TODO(ByteString::Create("\0\0", 2))},
+ {L"🎨", UNSAFE_TODO(ByteString("\0\0", 2))},
#endif
};
UNSAFE_TODO({
@@ -2017,7 +2011,7 @@
// Writing a WideString with nulls but specifying its length treats it as
// a C++-style string.
// SAFETY: known fixed-length string.
- str = UNSAFE_BUFFERS(WideString::Create(stringWithNulls, 4));
+ str = UNSAFE_BUFFERS(WideString(stringWithNulls, 4));
EXPECT_EQ(4u, str.GetLength());
stream.str("");
stream << str;
@@ -2071,7 +2065,7 @@
// Writing a WideString with nulls but specifying its length treats it as
// a C++-style string.
- str = UNSAFE_BUFFERS(WideString::Create(stringWithNulls, 4));
+ str = UNSAFE_BUFFERS(WideString(stringWithNulls, 4));
EXPECT_EQ(4u, str.GetLength());
stream.str(L"");
stream << str;
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.cpp b/fxbarcode/datamatrix/BC_C40Encoder.cpp
index 184bc54..3505cc7 100644
--- a/fxbarcode/datamatrix/BC_C40Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_C40Encoder.cpp
@@ -43,7 +43,7 @@
wchar_t cw[2];
cw[0] = static_cast<wchar_t>(v / 256);
cw[1] = static_cast<wchar_t>(v % 256);
- return UNSAFE_TODO(WideString::Create(cw, std::size(cw)));
+ return UNSAFE_TODO(WideString(cw, std::size(cw)));
}
} // namespace
diff --git a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
index b6036a8..4ac65e2 100644
--- a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
@@ -48,7 +48,7 @@
cw[1] = static_cast<wchar_t>((v >> 8) & 255);
cw[2] = static_cast<wchar_t>(v & 255);
// TODO(tsepez): stop putting binary data in strings.
- return UNSAFE_TODO(WideString::Create(cw, std::min(len, kBuflen)));
+ return UNSAFE_TODO(WideString(cw, std::min(len, kBuflen)));
}
bool HandleEOD(CBC_EncoderContext* context, const WideString& buffer) {
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
index e35bac9..e0fec8d 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
@@ -42,8 +42,8 @@
size_t i = 0;
for (const EncodeHighLevelCase& testcase : kEncodeHighLevelCases) {
WideStringView input(testcase.input);
- auto expected = UNSAFE_TODO(
- WideString::Create(testcase.expected, testcase.expected_length));
+ auto expected =
+ UNSAFE_TODO(WideString(testcase.expected, testcase.expected_length));
std::optional<WideString> result =
CBC_PDF417HighLevelEncoder::EncodeHighLevel(input);
ASSERT_TRUE(result.has_value());
@@ -91,8 +91,8 @@
CBC_PDF417HighLevelEncoder::EncodeBinary(
ByteStringView(testcase.input).unsigned_span(), testcase.offset,
testcase.count, testcase.startmode, &result);
- auto expected = UNSAFE_TODO(
- WideString::Create(testcase.expected, testcase.expected_length));
+ auto expected =
+ UNSAFE_TODO(WideString(testcase.expected, testcase.expected_length));
EXPECT_EQ(expected, result) << " for case number " << i;
++i;
}
@@ -151,8 +151,8 @@
size_t i = 0;
for (const EncodeNumericCase& testcase : kEncodeNumericCases) {
WideString input(testcase.input);
- auto expected = UNSAFE_TODO(
- WideString::Create(testcase.expected, testcase.expected_length));
+ auto expected =
+ UNSAFE_TODO(WideString(testcase.expected, testcase.expected_length));
WideString result;
CBC_PDF417HighLevelEncoder::EncodeNumeric(input, testcase.offset,
testcase.count, &result);
diff --git a/fxjs/cfx_globaldata.cpp b/fxjs/cfx_globaldata.cpp
index 27fcb4b..69bf0b2 100644
--- a/fxjs/cfx_globaldata.cpp
+++ b/fxjs/cfx_globaldata.cpp
@@ -308,7 +308,7 @@
break;
}
- ByteString sEntry = ByteString::Create(p, dwNameLen);
+ ByteString sEntry = ByteString(p, dwNameLen);
p += sizeof(char) * dwNameLen;
uint16_t wDataType = 0;
@@ -351,7 +351,7 @@
if (p + dwLength > buffer.end()) {
break;
}
- SetGlobalVariableString(sEntry, ByteString::Create(p, dwLength));
+ SetGlobalVariableString(sEntry, ByteString(p, dwLength));
SetGlobalVariablePersistent(sEntry, true);
p += sizeof(char) * dwLength;
} break;
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index dcb0d16..f935264 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -343,7 +343,7 @@
pRuntime->PutArrayElement(
StrArray, nIndex,
pRuntime->NewString(
- StrTrim(ByteString::Create(p, pTemp - p)).AsStringView()));
+ StrTrim(ByteString(p, pTemp - p)).AsStringView()));
nIndex++;
p = ++pTemp;
diff --git a/fxjs/fxv8.cpp b/fxjs/fxv8.cpp
index 7993b5c..fcf78e0 100644
--- a/fxjs/fxv8.cpp
+++ b/fxjs/fxv8.cpp
@@ -129,7 +129,7 @@
ByteString ToByteString(v8::Isolate* pIsolate, v8::Local<v8::String> pValue) {
v8::String::Utf8Value s(pIsolate, pValue);
// SAFETY: required from V8.
- return UNSAFE_BUFFERS(ByteString::Create(*s, s.length()));
+ return UNSAFE_BUFFERS(ByteString(*s, s.length()));
}
int ReentrantToInt32Helper(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue) {
diff --git a/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp b/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
index 47939fb..b0d7762 100644
--- a/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
@@ -762,8 +762,8 @@
const uint8_t test_string[] = {
0x4c, 0x6f, 0x77, 0x65, 0x72, 0x28, 0x22, 0xc3,
0x85, 0xc3, 0x85, 0xc3, 0x85, 0x22, 0x29}; // Lower("ÅÅÅ")
- Execute(UNSAFE_TODO(ByteString::Create(test_string, sizeof(test_string)))
- .AsStringView());
+ Execute(
+ UNSAFE_TODO(ByteString(test_string, sizeof(test_string))).AsStringView());
}
TEST_F(CFXJSE_FormCalcContextEmbedderTest, Ltrim) {
diff --git a/xfa/fgas/crt/cfgas_stringformatter.cpp b/xfa/fgas/crt/cfgas_stringformatter.cpp
index 2c2771b..6e36773 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter.cpp
@@ -885,12 +885,12 @@
bQuote = !bQuote;
} else if (spFormatString[index] == L'|' && !bQuote) {
wsPatterns.push_back(UNSAFE_TODO(
- WideString::Create(spFormatString.data() + token, index - token)));
+ WideString(spFormatString.data() + token, index - token)));
token = index + 1;
}
}
- wsPatterns.push_back(UNSAFE_TODO(
- WideString::Create(spFormatString.data() + token, index - token)));
+ wsPatterns.push_back(
+ UNSAFE_TODO(WideString(spFormatString.data() + token, index - token)));
return wsPatterns;
}