summaryrefslogtreecommitdiff
path: root/core/fxcrt/widestring.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-17 16:41:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-17 16:41:28 +0000
commitb7973bb5a0ad2f83a71362d601a928964559004a (patch)
tree74acc13d4e542b668f727c323a1ccc97461ec55f /core/fxcrt/widestring.h
parent8cfcb7da37352b22517892e6eabcedb77676cdf7 (diff)
downloadpdfium-b7973bb5a0ad2f83a71362d601a928964559004a.tar.xz
Reland "Return pdfium::span<wchar_t> 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 <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring.h')
-rw-r--r--core/fxcrt/widestring.h7
1 files changed, 5 insertions, 2 deletions
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<wchar_t> GetBuffer(size_t len);
void ReleaseBuffer(size_t len);
int GetInteger() const;