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

Side by Side Diff: fpdfsdk/fpdfppo.cpp

Issue 1862123003: Rename both As{Byte,Wide}StringC() helpers to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, fix new usage. 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/fpdfxfa/fpdfxfa_doc.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.AsByteStringC())) 113 if (pCurPageDict->KeyExist(cbSrcKeyStr.AsStringC()))
114 pCurPageDict->RemoveAt(cbSrcKeyStr.AsByteStringC()); 114 pCurPageDict->RemoveAt(cbSrcKeyStr.AsStringC());
115 pCurPageDict->SetAt(cbSrcKeyStr.AsByteStringC(), pObj->Clone()); 115 pCurPageDict->SetAt(cbSrcKeyStr.AsStringC(), 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 while (it != pDict->end()) { 222 while (it != pDict->end()) {
223 const CFX_ByteString& key = it->first; 223 const CFX_ByteString& key = it->first;
224 CPDF_Object* pNextObj = it->second; 224 CPDF_Object* pNextObj = it->second;
225 ++it; 225 ++it;
226 if (!FXSYS_strcmp(key, "Parent") || !FXSYS_strcmp(key, "Prev") || 226 if (!FXSYS_strcmp(key, "Parent") || !FXSYS_strcmp(key, "Prev") ||
227 !FXSYS_strcmp(key, "First")) { 227 !FXSYS_strcmp(key, "First")) {
228 continue; 228 continue;
229 } 229 }
230 if (pNextObj) { 230 if (pNextObj) {
231 if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) 231 if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
232 pDict->RemoveAt(key.AsByteStringC()); 232 pDict->RemoveAt(key.AsStringC());
233 } else { 233 } else {
234 return FALSE; 234 return FALSE;
235 } 235 }
236 } 236 }
237 break; 237 break;
238 } 238 }
239 case CPDF_Object::ARRAY: { 239 case CPDF_Object::ARRAY: {
240 CPDF_Array* pArray = pObj->AsArray(); 240 CPDF_Array* pArray = pObj->AsArray();
241 uint32_t count = pArray->GetCount(); 241 uint32_t count = pArray->GetCount();
242 for (uint32_t i = 0; i < count; ++i) { 242 for (uint32_t i = 0; i < count; ++i) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 if (!pSrcDict) 403 if (!pSrcDict)
404 return FALSE; 404 return FALSE;
405 405
406 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); 406 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
407 if (!pDstDict) 407 if (!pDstDict)
408 return FALSE; 408 return FALSE;
409 409
410 pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE)); 410 pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE));
411 return TRUE; 411 return TRUE;
412 } 412 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_flatten.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698