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

Unified Diff: xfa/fde/cfde_txtedtbuf.cpp

Issue 2208423002: Use smart pointers for class owned pointers under xfa/fde (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: more fixes Created 4 years, 4 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
Index: xfa/fde/cfde_txtedtbuf.cpp
diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp
index 7af5a1892be36413d2bd38638e4432c0b3ba55d3..fcb3cd3270fe254085ab8e808cf88c660de59544 100644
--- a/xfa/fde/cfde_txtedtbuf.cpp
+++ b/xfa/fde/cfde_txtedtbuf.cpp
@@ -16,17 +16,12 @@ const int kDefaultChunkCount = 2;
} // namespace
CFDE_TxtEdtBuf::CFDE_TxtEdtBuf()
- : m_nChunkSize(kDefaultChunkSize),
- m_nTotal(0),
- m_bChanged(FALSE),
- m_pAllocator(nullptr) {
- ASSERT(m_nChunkSize);
+ : m_nChunkSize(kDefaultChunkSize), m_nTotal(0), m_bChanged(FALSE) {
ResetChunkBuffer(kDefaultChunkCount, m_nChunkSize);
}
CFDE_TxtEdtBuf::~CFDE_TxtEdtBuf() {
Clear(TRUE);
- delete m_pAllocator;
m_Chunks.RemoveAll();
}
@@ -271,14 +266,12 @@ void CFDE_TxtEdtBuf::ResetChunkBuffer(int32_t nDefChunkCount,
int32_t nChunkSize) {
ASSERT(nChunkSize);
ASSERT(nDefChunkCount);
- delete m_pAllocator;
- m_pAllocator = nullptr;
m_Chunks.RemoveAll();
m_nChunkSize = nChunkSize;
int32_t nChunkLength =
sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR);
- m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, nDefChunkCount,
- nChunkLength);
+ m_pAllocator.reset(IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed,
Lei Zhang 2016/08/04 18:09:15 Can we change IFX_MemoryAllocator::Create() to ret
Wei Li 2016/08/04 21:42:25 Done.
+ nDefChunkCount, nChunkLength));
FDE_CHUNKHEADER* lpChunkHeader =
static_cast<FDE_CHUNKHEADER*>(m_pAllocator->Alloc(nChunkLength));
ASSERT(lpChunkHeader);

Powered by Google App Engine
This is Rietveld 408576698