diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-08-19 09:49:24 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-08-19 09:49:24 -0700 |
commit | 09d33bcd82a82cb55039d41651df13e17d6c3e59 (patch) | |
tree | 7a748b7570ff6ad0321c4334319bac101da0e6af /fpdfsdk/src/fsdk_annothandler.cpp | |
parent | 1b0023986bc22ce362097b25deb9746b693ef235 (diff) | |
download | pdfium-09d33bcd82a82cb55039d41651df13e17d6c3e59.tar.xz |
Merge to XFA: CFX_MapByteStringToPtr considered harmful (combo patch).
New manual edits: two unused members deleted, one adapted.
fde_csscache.cpp
fde_csscache.h
fpdfxfa_doc.h
fx_ge_fontmap.cpp
(cherry picked from commit 1d9dbd53b205b2b4d9e75a7eeb95e80837917ea3)
(cherry picked from commit cb4d0ea68308e3c51a6ba9551b393bb2f639afc4)
(cherry picked from commit 9cf44c2ed09a8b2ff243eb6dbb72a8cceae1b5ff)
(cherry picked from commit 2a2a6aa7f51352fc481e78f6ad9d41f2738bcc48)
(cherry picked from commit ce4ffb8183af3fa2bb5133f0f7370a88e064c516)
Original Review URL: https://codereview.chromium.org/1297723002 .
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1301793002 .
Diffstat (limited to 'fpdfsdk/src/fsdk_annothandler.cpp')
-rw-r--r-- | fpdfsdk/src/fsdk_annothandler.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp index 55d4629801..287a26baa8 100644 --- a/fpdfsdk/src/fsdk_annothandler.cpp +++ b/fpdfsdk/src/fsdk_annothandler.cpp @@ -29,25 +29,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); @@ -131,9 +126,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, |