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

Unified Diff: core/src/fpdfdoc/doc_annot.cpp

Issue 1515613006: Merge to XFA: Replace several more CFX_MapPtrToPtr with std::set or std::map (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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/src/fpdfapi/fpdf_render/render_int.h ('k') | core/src/fxge/ge/fx_ge_text.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_annot.cpp
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 0765acdf6e0b52f2d0a7dcf43e3adaa66ec890b0..26ea45fd9d0b8a1ae6ecf6d3db98f70aea7a78f1 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;
}
« no previous file with comments | « core/src/fpdfapi/fpdf_render/render_int.h ('k') | core/src/fxge/ge/fx_ge_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698