diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-07-18 19:28:59 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-18 19:28:59 +0000 |
commit | 835d49d1534405075d75068635894ead17af56b8 (patch) | |
tree | 5e07765a1bf9e9136a1248b283a3af43c66b175a /core/fpdfapi | |
parent | f22b4e2f6682fe26113c591a01139a8b5fa4e3bf (diff) | |
download | pdfium-835d49d1534405075d75068635894ead17af56b8.tar.xz |
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 <dcheng@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.cpp | 5 |
1 files changed, 2 insertions, 3 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) { |