summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-08-19 09:49:24 -0700
committerTom Sepez <tsepez@chromium.org>2015-08-19 09:49:24 -0700
commit09d33bcd82a82cb55039d41651df13e17d6c3e59 (patch)
tree7a748b7570ff6ad0321c4334319bac101da0e6af /core/src/fpdfapi/fpdf_page
parent1b0023986bc22ce362097b25deb9746b693ef235 (diff)
downloadpdfium-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 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp21
-rw-r--r--core/src/fpdfapi/fpdf_page/pageint.h3
2 files changed, 9 insertions, 15 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 74e33b56a9..210d5433be 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -171,14 +171,10 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) {
continue;
if (bForceRelease || ipData->use_count() < 2) {
- CPDF_Stream* ipKey = curr_it->first;
- FX_POSITION pos2 = m_HashProfileMap.GetStartPosition();
- while (pos2) {
- CFX_ByteString bsKey;
- CPDF_Stream* pFindStream = nullptr;
- m_HashProfileMap.GetNextAssoc(pos2, bsKey, (void*&)pFindStream);
- if (ipKey == pFindStream) {
- m_HashProfileMap.RemoveKey(bsKey);
+ for (auto hash_it = m_HashProfileMap.begin();
+ hash_it != m_HashProfileMap.end(); ++hash_it) {
+ if (curr_it->first == hash_it->second) {
+ m_HashProfileMap.erase(hash_it);
break;
}
}
@@ -519,18 +515,17 @@ CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(
CPDF_StreamAcc stream;
stream.LoadAllData(pIccProfileStream, FALSE);
uint8_t digest[20];
- CPDF_Stream* pCopiedStream = nullptr;
CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest);
- if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20),
- (void*&)pCopiedStream)) {
- auto it_copied_stream = m_IccProfileMap.find(pCopiedStream);
+ auto hash_it = m_HashProfileMap.find(CFX_ByteStringC(digest, 20));
+ if (hash_it != m_HashProfileMap.end()) {
+ auto it_copied_stream = m_IccProfileMap.find(hash_it->second);
return it_copied_stream->second->AddRef();
}
CPDF_IccProfile* pProfile =
new CPDF_IccProfile(stream.GetData(), stream.GetSize());
CPDF_CountedIccProfile* ipData = new CPDF_CountedIccProfile(pProfile);
m_IccProfileMap[pIccProfileStream] = ipData;
- m_HashProfileMap.SetAt(CFX_ByteStringC(digest, 20), pIccProfileStream);
+ m_HashProfileMap[CFX_ByteStringC(digest, 20)] = pIccProfileStream;
return ipData->AddRef();
}
diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h
index c931af7eb2..4f60cf5baa 100644
--- a/core/src/fpdfapi/fpdf_page/pageint.h
+++ b/core/src/fpdfapi/fpdf_page/pageint.h
@@ -423,9 +423,8 @@ class CPDF_DocPageData {
using CPDF_PatternMap = std::map<CPDF_Object*, CPDF_CountedPattern*>;
CPDF_Document* const m_pPDFDoc;
- CFX_MapByteStringToPtr m_HashProfileMap;
FX_BOOL m_bForceClear;
-
+ std::map<CFX_ByteString, CPDF_Stream*> m_HashProfileMap;
CPDF_ColorSpaceMap m_ColorSpaceMap;
CPDF_FontFileMap m_FontFileMap;
CPDF_FontMap m_FontMap;