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

Side by Side Diff: fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp

Issue 1541703003: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments, rebase, fix embedder test Created 4 years, 11 months 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 unified diff | Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_utils.cpp ('k') | fpdfsdk/src/fpdf_flatten.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" 7 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
8 8
9 #include "core/include/fpdfapi/fpdf_page.h" 9 #include "core/include/fpdfapi/fpdf_page.h"
10 #include "fpdfsdk/include/fsdk_baseannot.h" 10 #include "fpdfsdk/include/fsdk_baseannot.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 CPDF_Document* pDocument = GetDocument(); 112 CPDF_Document* pDocument = GetDocument();
113 ASSERT(pDocument != NULL); 113 ASSERT(pDocument != NULL);
114 114
115 CPDF_Dictionary* pFonts = pResDict->GetDict("Font"); 115 CPDF_Dictionary* pFonts = pResDict->GetDict("Font");
116 if (!pFonts) 116 if (!pFonts)
117 return NULL; 117 return NULL;
118 118
119 CPDF_Font* pFind = NULL; 119 CPDF_Font* pFind = NULL;
120 120
121 FX_POSITION pos = pFonts->GetStartPos(); 121 for (const auto& it : *pFonts) {
122 while (pos) { 122 const CFX_ByteString& csKey = it.first;
123 CPDF_Object* pObj = NULL; 123 CPDF_Object* pObj = it.second;
124 CFX_ByteString csKey;
125 pObj = pFonts->GetNextElement(pos, csKey);
126 if (!pObj) 124 if (!pObj)
127 continue; 125 continue;
128 126
129 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); 127 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
130 if (!pElement) 128 if (!pElement)
131 continue; 129 continue;
132 if (pElement->GetString("Type") != "Font") 130 if (pElement->GetString("Type") != "Font")
133 continue; 131 continue;
134 132
135 CPDF_Font* pFont = pDocument->LoadFont(pElement); 133 CPDF_Font* pFont = pDocument->LoadFont(pElement);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 262
265 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; 263 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
266 } 264 }
267 265
268 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { 266 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) {
269 m_sAPType = sAPType; 267 m_sAPType = sAPType;
270 268
271 Reset(); 269 Reset();
272 Initialize(); 270 Initialize();
273 } 271 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_utils.cpp ('k') | fpdfsdk/src/fpdf_flatten.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698