From 7439517516a0bb3833ee95ddb9d71051f981347c Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 18 Apr 2018 19:04:20 +0000 Subject: Add AsRawSpan() to ByteString. Also tidy AsSpan() for Byte/Wide strings. Change-Id: I1853d31a59bc7f46de81295cde2e1062b91badec Reviewed-on: https://pdfium-review.googlesource.com/30911 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- core/fxcrt/bytestring.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'core/fxcrt/bytestring.h') diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h index 247238573d..99b87b1d4c 100644 --- a/core/fxcrt/bytestring.h +++ b/core/fxcrt/bytestring.h @@ -87,9 +87,11 @@ class ByteString { // Explicit conversion to span. // Note: Any subsequent modification of |this| will invalidate the result. pdfium::span AsSpan() const { - return m_pData ? pdfium::span(m_pData->m_String, - m_pData->m_nDataLength) - : pdfium::span(); + return pdfium::make_span(m_pData ? m_pData->m_String : nullptr, + GetLength()); + } + pdfium::span AsRawSpan() const { + return pdfium::make_span(raw_str(), GetLength()); } // Note: Any subsequent modification of |this| will invalidate iterators. -- cgit v1.2.3