summaryrefslogtreecommitdiff
path: root/core/fxcrt/bytestring.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-18 19:04:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-18 19:04:20 +0000
commit7439517516a0bb3833ee95ddb9d71051f981347c (patch)
tree85dd6db5c3955fe8aebe0278bf20bd9cc6ca0d0b /core/fxcrt/bytestring.h
parent51a41ea222eeb852be4f372165d2d9bc9094b2a4 (diff)
downloadpdfium-7439517516a0bb3833ee95ddb9d71051f981347c.tar.xz
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 <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/bytestring.h')
-rw-r--r--core/fxcrt/bytestring.h8
1 files changed, 5 insertions, 3 deletions
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<const char> AsSpan() const {
- return m_pData ? pdfium::span<const char>(m_pData->m_String,
- m_pData->m_nDataLength)
- : pdfium::span<const char>();
+ return pdfium::make_span(m_pData ? m_pData->m_String : nullptr,
+ GetLength());
+ }
+ pdfium::span<const uint8_t> AsRawSpan() const {
+ return pdfium::make_span(raw_str(), GetLength());
}
// Note: Any subsequent modification of |this| will invalidate iterators.