summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_annothandler.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-08-17 16:26:03 -0700
committerTom Sepez <tsepez@chromium.org>2015-08-17 16:26:03 -0700
commitce4ffb8183af3fa2bb5133f0f7370a88e064c516 (patch)
tree16f05f79aed56678b45bea435addaa75fbb9f85f /fpdfsdk/src/fsdk_annothandler.cpp
parent52a48aadc19b2dee8abeb702269bb168eb6b6999 (diff)
downloadpdfium-ce4ffb8183af3fa2bb5133f0f7370a88e064c516.tar.xz
CFX_MapByteStringToPtr considered harmful.
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1297723002 .
Diffstat (limited to 'fpdfsdk/src/fsdk_annothandler.cpp')
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 40938c7592..bb999e1f08 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -23,25 +23,20 @@ CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {
delete pHandler;
}
m_Handlers.RemoveAll();
- m_mapType2Handler.RemoveAll();
+ m_mapType2Handler.clear();
}
void CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler(
IPDFSDK_AnnotHandler* pAnnotHandler) {
- ASSERT(pAnnotHandler != NULL);
-
- ASSERT(GetAnnotHandler(pAnnotHandler->GetType()) == NULL);
+ ASSERT(!GetAnnotHandler(pAnnotHandler->GetType()));
m_Handlers.Add(pAnnotHandler);
- m_mapType2Handler.SetAt(pAnnotHandler->GetType(), (void*)pAnnotHandler);
+ m_mapType2Handler[pAnnotHandler->GetType()] = pAnnotHandler;
}
void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler(
IPDFSDK_AnnotHandler* pAnnotHandler) {
- ASSERT(pAnnotHandler != NULL);
-
- m_mapType2Handler.RemoveKey(pAnnotHandler->GetType());
-
+ m_mapType2Handler.erase(pAnnotHandler->GetType());
for (int i = 0, sz = m_Handlers.GetSize(); i < sz; i++) {
if (m_Handlers.GetAt(i) == pAnnotHandler) {
m_Handlers.RemoveAt(i);
@@ -110,9 +105,8 @@ IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
const CFX_ByteString& sType) const {
- void* pRet = NULL;
- m_mapType2Handler.Lookup(sType, pRet);
- return (IPDFSDK_AnnotHandler*)pRet;
+ auto it = m_mapType2Handler.find(sType);
+ return it != m_mapType2Handler.end() ? it->second : nullptr;
}
void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView,