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

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: XFA still uses CFX_CMapByteStringToPtr :( Created 4 years, 12 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
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 #include "fpdfsdk/include/formfiller/FormFiller.h" 8 #include "fpdfsdk/include/formfiller/FormFiller.h"
9 9
10 CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, 10 CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 CPDF_Document* pDocument = GetDocument(); 121 CPDF_Document* pDocument = GetDocument();
122 ASSERT(pDocument != NULL); 122 ASSERT(pDocument != NULL);
123 123
124 CPDF_Dictionary* pFonts = pResDict->GetDict("Font"); 124 CPDF_Dictionary* pFonts = pResDict->GetDict("Font");
125 if (!pFonts) 125 if (!pFonts)
126 return NULL; 126 return NULL;
127 127
128 CPDF_Font* pFind = NULL; 128 CPDF_Font* pFind = NULL;
129 129
130 FX_POSITION pos = pFonts->GetStartPos(); 130 for (const auto& it : *pFonts) {
131 while (pos) { 131 const CFX_ByteString& csKey = it.first;
132 CPDF_Object* pObj = NULL; 132 CPDF_Object* pObj = it.second;
133 CFX_ByteString csKey;
134 pObj = pFonts->GetNextElement(pos, csKey);
135 if (!pObj) 133 if (!pObj)
136 continue; 134 continue;
137 135
138 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); 136 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
139 if (!pElement) 137 if (!pElement)
140 continue; 138 continue;
141 if (pElement->GetString("Type") != "Font") 139 if (pElement->GetString("Type") != "Font")
142 continue; 140 continue;
143 141
144 CPDF_Font* pFont = pDocument->LoadFont(pElement); 142 CPDF_Font* pFont = pDocument->LoadFont(pElement);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 271
274 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; 272 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
275 } 273 }
276 274
277 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { 275 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) {
278 m_sAPType = sAPType; 276 m_sAPType = sAPType;
279 277
280 Reset(); 278 Reset();
281 Initial(); 279 Initial();
282 } 280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698