summaryrefslogtreecommitdiff
path: root/fpdfsdk/fsdk_mgr.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-07-11 14:43:40 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-11 14:43:41 -0700
commit5a6c1398d0e559fb6a048cb0dca46ba9f9309a77 (patch)
tree40193eaf374d0f9bf2ec2f257871279b0f36efb8 /fpdfsdk/fsdk_mgr.cpp
parentac14258c429141653f73ca5c1b64ad259ac15804 (diff)
downloadpdfium-5a6c1398d0e559fb6a048cb0dca46ba9f9309a77.tar.xz
Use smart pointers for class owned member variables
Replace raw member variables to smart pointer type to better maintain the ownership and to ease the management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2136683002
Diffstat (limited to 'fpdfsdk/fsdk_mgr.cpp')
-rw-r--r--fpdfsdk/fsdk_mgr.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index 6500e302ec..32cc39622b 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() {