Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Unified Diff: core/src/fpdfdoc/doc_bookmark.cpp

Issue 1130053003: Support arrays in nonstd::unique_ptr<>. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/base/nonstd_unique_ptr.h » ('j') | third_party/base/nonstd_unique_ptr.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_bookmark.cpp
diff --git a/core/src/fpdfdoc/doc_bookmark.cpp b/core/src/fpdfdoc/doc_bookmark.cpp
index 6ba98e655dff5e55a6ce575046a89f3ad560170e..10ef07e93e98bd2fb92c6e0103bd4fc2d99b1d93 100644
--- a/core/src/fpdfdoc/doc_bookmark.cpp
+++ b/core/src/fpdfdoc/doc_bookmark.cpp
@@ -63,14 +63,12 @@ CFX_WideString CPDF_Bookmark::GetTitle() const
if (!len) {
return CFX_WideString();
}
- nonstd::unique_ptr<std::vector<FX_WCHAR> > vec;
- vec.reset(new std::vector<FX_WCHAR>(len));
- FX_WCHAR* buf = &vec->front();
+ nonstd::unique_ptr<FX_WCHAR[]> buf(new FX_WCHAR[len]);
for (int i = 0; i < len; i++) {
FX_WCHAR w = title[i];
buf[i] = w > 0x20 ? w : 0x20;
}
- return CFX_WideString(buf, len);
+ return CFX_WideString(buf.get(), len);
}
CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const
{
« no previous file with comments | « no previous file | third_party/base/nonstd_unique_ptr.h » ('j') | third_party/base/nonstd_unique_ptr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698