diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.cpp | 5 | ||||
-rw-r--r-- | core/fxcrt/bytestring_unittest.cpp | 7 |
2 files changed, 5 insertions, 7 deletions
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index 82d84ab705..9ccca121ad 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -500,9 +500,8 @@ ByteString PDF_EncodeText(const wchar_t* pString, int len) { size_t dest_index = 0; size_t encLen = len * 2 + 2; { - pdfium::span<char> cspan = result.GetBuffer(encLen); - auto dest_buf = pdfium::make_span(reinterpret_cast<uint8_t*>(cspan.data()), - cspan.size()); + pdfium::span<uint8_t> dest_buf = + pdfium::as_writable_bytes(result.GetBuffer(encLen)); dest_buf[dest_index++] = 0xfe; dest_buf[dest_index++] = 0xff; for (int j = 0; j < len; ++j) { diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp index fb5fc0d996..7095a1b799 100644 --- a/core/fxcrt/bytestring_unittest.cpp +++ b/core/fxcrt/bytestring_unittest.cpp @@ -1060,8 +1060,7 @@ TEST(ByteStringView, NotNull) { ByteStringView string3("abc"); ByteStringView string6("abcdef"); ByteStringView alternate_string3("abcdef", 3); - ByteStringView span_string4( - pdfium::span<const uint8_t>(reinterpret_cast<const uint8_t*>("abcd"), 4)); + ByteStringView span_string4(pdfium::as_bytes(pdfium::make_span("abcd", 4))); ByteStringView embedded_nul_string7("abc\0def", 7); ByteStringView illegal_string7("abcdef", 7); @@ -1355,8 +1354,8 @@ TEST(ByteStringView, OperatorEQ) { EXPECT_FALSE(c_string2 == byte_string_c); EXPECT_FALSE(c_string3 == byte_string_c); - pdfium::span<const uint8_t> span5(reinterpret_cast<const uint8_t*>("hello"), - 5); + pdfium::span<const uint8_t> span5( + pdfium::as_bytes(pdfium::make_span("hello", 5))); EXPECT_EQ(byte_string_c.span(), span5); } |