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

Unified Diff: fpdfsdk/fsdk_mgr.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/include/fpdf_doc.h ('k') | pdfium.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fsdk_mgr.cpp
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index 6500e302ec41c3c0e71a50307343dbc2ce51572e..32cc39622bb7fe6db3ca585ad12231c8a34eedb4 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -564,23 +564,23 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
const CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX,
FX_FLOAT pageY) {
- for (const CPDF_Annot* pAnnot : m_pAnnotList->All()) {
+ for (const auto& pAnnot : m_pAnnotList->All()) {
CFX_FloatRect annotRect;
pAnnot->GetRect(annotRect);
if (annotRect.Contains(pageX, pageY))
- return pAnnot;
+ return pAnnot.get();
}
return nullptr;
}
const CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX,
FX_FLOAT pageY) {
- for (const CPDF_Annot* pAnnot : m_pAnnotList->All()) {
+ for (const auto& pAnnot : m_pAnnotList->All()) {
if (pAnnot->GetSubType() == "Widget") {
CFX_FloatRect annotRect;
pAnnot->GetRect(annotRect);
if (annotRect.Contains(pageX, pageY))
- return pAnnot;
+ return pAnnot.get();
}
}
return nullptr;
@@ -1024,7 +1024,8 @@ bool CPDFSDK_PageView::IsValidAnnot(const CPDF_Annot* p) const {
return false;
const auto& annots = m_pAnnotList->All();
- return pdfium::ContainsValue(annots, p);
+ std::unique_ptr<const CPDF_Annot> annot(p);
+ return pdfium::ContainsValue(annots, annot);
}
CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() {
« no previous file with comments | « core/fpdfdoc/include/fpdf_doc.h ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698