From b7973bb5a0ad2f83a71362d601a928964559004a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 17 Apr 2018 16:41:28 +0000 Subject: Reland "Return pdfium::span from WideString::GetBuffer()."" This reverts commit 0d32b8fda53e02c1036d39f7290d4f59f2b58ca4. Restore behaviour on trunk. TBR: dsinclair@chromium.org Change-Id: Ia867f09ae9d2885595c4d9b300a058431dfd84f2 Reviewed-on: https://pdfium-review.googlesource.com/30811 Reviewed-by: Tom Sepez Commit-Queue: Tom Sepez --- core/fxcrt/widestring.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/fxcrt/widestring.h') diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h index cefdfabcd0..b668b0292c 100644 --- a/core/fxcrt/widestring.h +++ b/core/fxcrt/widestring.h @@ -17,7 +17,7 @@ #include "core/fxcrt/string_data_template.h" #include "core/fxcrt/string_view_template.h" #include "third_party/base/optional.h" - +#include "third_party/base/span.h" namespace fxcrt { @@ -171,7 +171,10 @@ class WideString { void TrimRight(const WideStringView& targets); void Reserve(size_t len); - wchar_t* GetBuffer(size_t len); + + // Note: any modification of the string (including ReleaseBuffer()) may + // invalidate the span, which must not outlive its buffer. + pdfium::span GetBuffer(size_t len); void ReleaseBuffer(size_t len); int GetInteger() const; -- cgit v1.2.3