summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_annot.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-10 15:39:28 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-10 15:39:28 -0800
commitd2cfdd5c72be670aff556c44aaff53df66b23ea6 (patch)
treede7fce67d473f019174e554790b403a069c59eb5 /core/src/fpdfdoc/doc_annot.cpp
parent60d909e9d4444b2b8582275624ee97734d331a38 (diff)
downloadpdfium-d2cfdd5c72be670aff556c44aaff53df66b23ea6.tar.xz
Merge to XFA: Replace several more CFX_MapPtrToPtr with std::set or std::map
Original Review URL: https://codereview.chromium.org/1520643002 . (cherry picked from commit 7db2a535f163e7ce5995da12161ebd0214f0f75a) Original Review URL: https://codereview.chromium.org/1511413008 . (cherry picked from commit 168cfb7ee0f2abbd2bddb7e7d8b430a6d8c6c120) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1515613006 .
Diffstat (limited to 'core/src/fpdfdoc/doc_annot.cpp')
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 0765acdf6e..26ea45fd9d 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -124,14 +124,10 @@ CPDF_Annot::~CPDF_Annot() {
ClearCachedAP();
}
void CPDF_Annot::ClearCachedAP() {
- FX_POSITION pos = m_APMap.GetStartPosition();
- while (pos) {
- void* pForm;
- void* pObjects;
- m_APMap.GetNextAssoc(pos, pForm, pObjects);
- delete (CPDF_PageObjects*)pObjects;
+ for (const auto& pair : m_APMap) {
+ delete pair.second;
}
- m_APMap.RemoveAll();
+ m_APMap.clear();
}
CFX_ByteString CPDF_Annot::GetSubType() const {
return m_sSubtype;
@@ -192,14 +188,14 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) {
if (!pStream)
return nullptr;
- void* pForm;
- if (m_APMap.Lookup(pStream, pForm))
- return static_cast<CPDF_Form*>(pForm);
+ auto it = m_APMap.find(pStream);
+ if (it != m_APMap.end())
+ return it->second;
CPDF_Form* pNewForm =
new CPDF_Form(m_pList->GetDocument(), pPage->m_pResources, pStream);
pNewForm->ParseContent(nullptr, nullptr, nullptr, nullptr);
- m_APMap.SetAt(pStream, pNewForm);
+ m_APMap[pStream] = pNewForm;
return pNewForm;
}