From 21031ad28a73f0633e720997d310440c5bc31ec5 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 6 May 2015 17:29:29 -0700 Subject: Support arrays in nonstd::unique_ptr<>. This mimics the std:: behaviour. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1130053003 --- core/include/fxcrt/fx_basic.h | 26 -------------------------- core/src/fpdfdoc/doc_bookmark.cpp | 6 ++---- 2 files changed, 2 insertions(+), 30 deletions(-) (limited to 'core') diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 275653ef9e..bd53d9e7a4 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -773,32 +773,6 @@ private: DataType m_Data[FixedSize]; DataType* m_pData; }; -template -class CFX_TempBuf -{ -public: - CFX_TempBuf(int size) - { - m_pData = FX_Alloc(DataType, size); - } - ~CFX_TempBuf() - { - if (m_pData) { - FX_Free(m_pData); - } - } - DataType& operator[](int i) - { - FXSYS_assert(m_pData != NULL); - return m_pData[i]; - } - operator DataType*() - { - return m_pData; - } -private: - DataType* m_pData; -}; class CFX_MapPtrToPtr { protected: diff --git a/core/src/fpdfdoc/doc_bookmark.cpp b/core/src/fpdfdoc/doc_bookmark.cpp index 6ba98e655d..10ef07e93e 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 > vec; - vec.reset(new std::vector(len)); - FX_WCHAR* buf = &vec->front(); + nonstd::unique_ptr 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 { -- cgit v1.2.3