summaryrefslogtreecommitdiff
path: root/core/fxcrt/widestring_unittest.cpp
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_unittest.cpp
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_unittest.cpp')
-rw-r--r--core/fxcrt/widestring_unittest.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 48d5c7f8f5..ec0a55fc1e 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -817,20 +817,21 @@ TEST(WideString, Reserve) {
}
TEST(WideString, GetBuffer) {
+ WideString str1;
{
- WideString str;
- wchar_t* buffer = str.GetBuffer(12);
- wcscpy(buffer, L"clams");
- str.ReleaseBuffer(str.GetStringLength());
- EXPECT_EQ(L"clams", str);
+ pdfium::span<wchar_t> buffer = str1.GetBuffer(12);
+ wcscpy(buffer.data(), L"clams");
}
+ str1.ReleaseBuffer(str1.GetStringLength());
+ EXPECT_EQ(L"clams", str1);
+
+ WideString str2(L"cl");
{
- WideString str(L"cl");
- wchar_t* buffer = str.GetBuffer(12);
- wcscpy(buffer + 2, L"ams");
- str.ReleaseBuffer(str.GetStringLength());
- EXPECT_EQ(L"clams", str);
+ pdfium::span<wchar_t> buffer = str2.GetBuffer(12);
+ wcscpy(buffer.data() + 2, L"ams");
}
+ str2.ReleaseBuffer(str2.GetStringLength());
+ EXPECT_EQ(L"clams", str2);
}
TEST(WideString, ReleaseBuffer) {