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

Side by Side Diff: fpdfsdk/fpdfppo.cpp

Issue 1889863002: Make CPDF_Dictionary methods take CFX_ByteString arguments (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: One last caller. Created 4 years, 8 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 | « fpdfsdk/fpdf_flatten.cpp ('k') | fpdfsdk/fsdk_baseannot.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 "public/fpdf_ppo.h" 7 #include "public/fpdf_ppo.h"
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage); 103 CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage);
104 CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(pPageNums->at(i) - 1); 104 CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(pPageNums->at(i) - 1);
105 if (!pSrcPageDict || !pCurPageDict) 105 if (!pSrcPageDict || !pCurPageDict)
106 return FALSE; 106 return FALSE;
107 107
108 // Clone the page dictionary 108 // Clone the page dictionary
109 for (const auto& it : *pSrcPageDict) { 109 for (const auto& it : *pSrcPageDict) {
110 const CFX_ByteString& cbSrcKeyStr = it.first; 110 const CFX_ByteString& cbSrcKeyStr = it.first;
111 CPDF_Object* pObj = it.second; 111 CPDF_Object* pObj = it.second;
112 if (cbSrcKeyStr.Compare(("Type")) && cbSrcKeyStr.Compare(("Parent"))) { 112 if (cbSrcKeyStr.Compare(("Type")) && cbSrcKeyStr.Compare(("Parent"))) {
113 if (pCurPageDict->KeyExist(cbSrcKeyStr.AsStringC())) 113 if (pCurPageDict->KeyExist(cbSrcKeyStr))
114 pCurPageDict->RemoveAt(cbSrcKeyStr.AsStringC()); 114 pCurPageDict->RemoveAt(cbSrcKeyStr);
115 pCurPageDict->SetAt(cbSrcKeyStr.AsStringC(), pObj->Clone()); 115 pCurPageDict->SetAt(cbSrcKeyStr, pObj->Clone());
116 } 116 }
117 } 117 }
118 118
119 // inheritable item 119 // inheritable item
120 CPDF_Object* pInheritable = nullptr; 120 CPDF_Object* pInheritable = nullptr;
121 // 1 MediaBox //required 121 // 1 MediaBox //required
122 if (!pCurPageDict->KeyExist("MediaBox")) { 122 if (!pCurPageDict->KeyExist("MediaBox")) {
123 pInheritable = PageDictGetInheritableTag(pSrcPageDict, "MediaBox"); 123 pInheritable = PageDictGetInheritableTag(pSrcPageDict, "MediaBox");
124 if (!pInheritable) { 124 if (!pInheritable) {
125 // Search the "CropBox" from source page dictionary, 125 // Search the "CropBox" from source page dictionary,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 const CFX_ByteString& key = it->first; 224 const CFX_ByteString& key = it->first;
225 CPDF_Object* pNextObj = it->second; 225 CPDF_Object* pNextObj = it->second;
226 ++it; 226 ++it;
227 if (!FXSYS_strcmp(key.c_str(), "Parent") || 227 if (!FXSYS_strcmp(key.c_str(), "Parent") ||
228 !FXSYS_strcmp(key.c_str(), "Prev") || 228 !FXSYS_strcmp(key.c_str(), "Prev") ||
229 !FXSYS_strcmp(key.c_str(), "First")) { 229 !FXSYS_strcmp(key.c_str(), "First")) {
230 continue; 230 continue;
231 } 231 }
232 if (pNextObj) { 232 if (pNextObj) {
233 if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) 233 if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
234 pDict->RemoveAt(key.AsStringC()); 234 pDict->RemoveAt(key);
235 } else { 235 } else {
236 return FALSE; 236 return FALSE;
237 } 237 }
238 } 238 }
239 break; 239 break;
240 } 240 }
241 case CPDF_Object::ARRAY: { 241 case CPDF_Object::ARRAY: {
242 CPDF_Array* pArray = pObj->AsArray(); 242 CPDF_Array* pArray = pObj->AsArray();
243 for (size_t i = 0; i < pArray->GetCount(); ++i) { 243 for (size_t i = 0; i < pArray->GetCount(); ++i) {
244 CPDF_Object* pNextObj = pArray->GetObjectAt(i); 244 CPDF_Object* pNextObj = pArray->GetObjectAt(i);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (!pSrcDict) 404 if (!pSrcDict)
405 return FALSE; 405 return FALSE;
406 406
407 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); 407 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
408 if (!pDstDict) 408 if (!pDstDict)
409 return FALSE; 409 return FALSE;
410 410
411 pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE)); 411 pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE));
412 return TRUE; 412 return TRUE;
413 } 413 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_flatten.cpp ('k') | fpdfsdk/fsdk_baseannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698