diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-01-20 14:33:49 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-01-20 14:33:49 -0800 |
commit | fcb6398ea511e32a09d192543f70041b82646df1 (patch) | |
tree | 5e7809400749292195e47ec24af1018d3b002343 /core/src/fpdfapi | |
parent | 49e4932735292790c77b5362603d9f5d7f6adaaa (diff) | |
download | pdfium-fcb6398ea511e32a09d192543f70041b82646df1.tar.xz |
Merge to XFA: Replace more CFX_MapPtrToPtr.
Original Review URL: https://codereview.chromium.org/1580573002 .
(cherry picked from commit a505d9d3e13485e090e50d5d83f882fb707d3f48)
R=ochang@chromium.org
Review URL: https://codereview.chromium.org/1610163003 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index cd22b31238..97c5a75082 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -161,14 +161,7 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) { m_Syntax.m_pFileAccess->Release(); m_Syntax.m_pFileAccess = NULL; } - FX_POSITION pos = m_ObjectStreamMap.GetStartPosition(); - while (pos) { - void* objnum; - CPDF_StreamAcc* pStream; - m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream); - delete pStream; - } - m_ObjectStreamMap.RemoveAll(); + m_ObjectStreamMap.clear(); m_ObjCache.clear(); m_SortedOffset.RemoveAll(); @@ -616,7 +609,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV5(FX_FILESIZE xrefpos) { return FALSE; } } - m_ObjectStreamMap.InitHashTable(101, FALSE); + m_ObjectStreamMap.clear(); m_bXRefStream = TRUE; return TRUE; } @@ -1252,18 +1245,18 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject( } CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) { - CPDF_StreamAcc* pStreamAcc = nullptr; - if (m_ObjectStreamMap.Lookup((void*)(uintptr_t)objnum, (void*&)pStreamAcc)) - return pStreamAcc; + auto it = m_ObjectStreamMap.find(objnum); + if (it != m_ObjectStreamMap.end()) + return it->second.get(); const CPDF_Stream* pStream = ToStream( m_pDocument ? m_pDocument->GetIndirectObject(objnum, nullptr) : nullptr); if (!pStream) return nullptr; - pStreamAcc = new CPDF_StreamAcc; + CPDF_StreamAcc* pStreamAcc = new CPDF_StreamAcc; pStreamAcc->LoadAllData(pStream); - m_ObjectStreamMap.SetAt((void*)(uintptr_t)objnum, pStreamAcc); + m_ObjectStreamMap[objnum].reset(pStreamAcc); return pStreamAcc; } @@ -1671,7 +1664,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos) { return FALSE; } } - m_ObjectStreamMap.InitHashTable(101, FALSE); + m_ObjectStreamMap.clear(); m_bXRefStream = TRUE; return TRUE; } @@ -1695,14 +1688,7 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable() { m_Syntax.GetNextChar(ch); } m_LastXRefOffset += dwCount; - FX_POSITION pos = m_ObjectStreamMap.GetStartPosition(); - while (pos) { - void* objnum; - CPDF_StreamAcc* pStream; - m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream); - delete pStream; - } - m_ObjectStreamMap.RemoveAll(); + m_ObjectStreamMap.clear(); m_ObjCache.clear(); if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |