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

Unified Diff: xfa/fee/fde_txtedtparag.cpp

Issue 1986373002: Remove Release() from IFX_CharIter, use unique_ptrs. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nit Created 4 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 | « xfa/fee/fde_txtedtpage.cpp ('k') | xfa/fee/fx_wordbreak/fx_wordbreak.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fee/fde_txtedtparag.cpp
diff --git a/xfa/fee/fde_txtedtparag.cpp b/xfa/fee/fde_txtedtparag.cpp
index f49f43147d283d3173270ec9c392662dcabcc5c2..4f5b5a15df4064946ed79764a56d5d7f90733a8f 100644
--- a/xfa/fee/fde_txtedtparag.cpp
+++ b/xfa/fee/fde_txtedtparag.cpp
@@ -37,8 +37,8 @@ void CFDE_TxtEdtParag::LoadParag() {
if (pParam->dwMode & FDE_TEXTEDITMODE_Password) {
wcAlias = m_pEngine->GetAliasChar();
}
- IFX_CharIter* pIter =
- new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pTxtBuf, wcAlias);
+ std::unique_ptr<IFX_CharIter> pIter(
+ new CFDE_TxtEdtBufIter(static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), wcAlias));
pIter->SetAt(m_nCharStart);
int32_t nEndIndex = m_nCharStart + m_nCharCount;
CFX_ArrayTemplate<int32_t> LineBaseArr;
@@ -71,7 +71,6 @@ void CFDE_TxtEdtParag::LoadParag() {
pIter->Next(TRUE);
}
} while (pIter->Next(FALSE) && (pIter->GetAt() < nEndIndex));
- pIter->Release();
pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
pTxtBreak->ClearBreakPieces();
int32_t nLineCount = LineBaseArr.GetSize();
@@ -102,10 +101,11 @@ void CFDE_TxtEdtParag::UnloadParag() {
void CFDE_TxtEdtParag::CalcLines() {
CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf();
- IFX_CharIter* pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pTxtBuf);
int32_t nCount = 0;
uint32_t dwBreakStatus = FX_TXTBREAK_None;
int32_t nEndIndex = m_nCharStart + m_nCharCount;
+ std::unique_ptr<IFX_CharIter> pIter(
+ new CFDE_TxtEdtBufIter(static_cast<CFDE_TxtEdtBuf*>(pTxtBuf)));
pIter->SetAt(m_nCharStart);
FX_BOOL bReload = FALSE;
do {
@@ -129,7 +129,6 @@ void CFDE_TxtEdtParag::CalcLines() {
pIter->Next(TRUE);
}
} while (pIter->Next(FALSE) && (pIter->GetAt() < nEndIndex));
- pIter->Release();
pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
pTxtBreak->ClearBreakPieces();
m_nLineCount = nCount;
« no previous file with comments | « xfa/fee/fde_txtedtpage.cpp ('k') | xfa/fee/fx_wordbreak/fx_wordbreak.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698