From 835d49d1534405075d75068635894ead17af56b8 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 18 Jul 2018 19:28:59 +0000 Subject: Add pdfium::span::as_bytes() and as_writable_bytes(). Picks up some enhancements from base/span.h. In turn, also adds the size_bytes() helper. Differs from base version in that it works around C++14 enable_if_t<>, and avoids the dynamic_extent template specialization tricks. Use it in a few places where appropriate. Change-Id: I86f72cf0023f2d4317a7afa351fddee601c8f86c Reviewed-on: https://pdfium-review.googlesource.com/38251 Reviewed-by: Daniel Cheng Commit-Queue: Tom Sepez --- core/fxcrt/bytestring_unittest.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'core/fxcrt') 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(reinterpret_cast("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 span5(reinterpret_cast("hello"), - 5); + pdfium::span span5( + pdfium::as_bytes(pdfium::make_span("hello", 5))); EXPECT_EQ(byte_string_c.span(), span5); } -- cgit v1.2.3