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

Unified Diff: core/fpdfdoc/doc_annot.cpp

Issue 2136683002: Use smart pointers for class owned member variables (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 5 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 | « core/fpdfdoc/cpvt_wordinfo.cpp ('k') | core/fpdfdoc/include/fpdf_doc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/doc_annot.cpp
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index 9b2f9e505f3eff5983acd9dd196114171a737929..fe17e9c811906c81b4ab687ddb484222a8e484e6 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -41,7 +41,8 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
pAnnots->RemoveAt(i + 1);
pDict = pAnnots->GetDictAt(i);
}
- m_AnnotList.push_back(new CPDF_Annot(pDict, this));
+ m_AnnotList.push_back(
+ std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, this)));
if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" &&
CPDF_InterForm::UpdatingAPEnabled()) {
FPDF_GenerateAP(m_pDocument, pDict);
@@ -49,10 +50,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
}
}
-CPDF_AnnotList::~CPDF_AnnotList() {
- for (CPDF_Annot* annot : m_AnnotList)
- delete annot;
-}
+CPDF_AnnotList::~CPDF_AnnotList() {}
void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
@@ -62,7 +60,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
FX_BOOL bWidgetPass,
CPDF_RenderOptions* pOptions,
FX_RECT* clip_rect) {
- for (CPDF_Annot* pAnnot : m_AnnotList) {
+ for (const auto& pAnnot : m_AnnotList) {
bool bWidget = pAnnot->GetSubType() == "Widget";
if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget))
continue;
« no previous file with comments | « core/fpdfdoc/cpvt_wordinfo.cpp ('k') | core/fpdfdoc/include/fpdf_doc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698