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

Side by Side Diff: fpdfsdk/fpdfppo.cpp

Issue 1977093002: Make CFX_ByteString(const CFX_ByteStringC&) explicit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, nit Created 4 years, 7 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_transformpage.cpp ('k') | fpdfsdk/fxedit/fxet_ap.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 14 matching lines...) Expand all
25 using ObjectNumberMap = std::map<uint32_t, uint32_t>; 25 using ObjectNumberMap = std::map<uint32_t, uint32_t>;
26 CPDF_PageOrganizer(); 26 CPDF_PageOrganizer();
27 ~CPDF_PageOrganizer(); 27 ~CPDF_PageOrganizer();
28 28
29 FX_BOOL PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc); 29 FX_BOOL PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc);
30 FX_BOOL ExportPage(CPDF_Document* pSrcPDFDoc, 30 FX_BOOL ExportPage(CPDF_Document* pSrcPDFDoc,
31 std::vector<uint16_t>* pPageNums, 31 std::vector<uint16_t>* pPageNums,
32 CPDF_Document* pDestPDFDoc, 32 CPDF_Document* pDestPDFDoc,
33 int nIndex); 33 int nIndex);
34 CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict, 34 CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict,
35 CFX_ByteString nSrctag); 35 const CFX_ByteString& bsSrctag);
36 FX_BOOL UpdateReference(CPDF_Object* pObj, 36 FX_BOOL UpdateReference(CPDF_Object* pObj,
37 CPDF_Document* pDoc, 37 CPDF_Document* pDoc,
38 ObjectNumberMap* pObjNumberMap); 38 ObjectNumberMap* pObjNumberMap);
39 uint32_t GetNewObjId(CPDF_Document* pDoc, 39 uint32_t GetNewObjId(CPDF_Document* pDoc,
40 ObjectNumberMap* pObjNumberMap, 40 ObjectNumberMap* pObjNumberMap,
41 CPDF_Reference* pRef); 41 CPDF_Reference* pRef);
42 }; 42 };
43 43
44 CPDF_PageOrganizer::CPDF_PageOrganizer() {} 44 CPDF_PageOrganizer::CPDF_PageOrganizer() {}
45 45
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 UpdateReference(pCurPageDict, pDestPDFDoc, pObjNumberMap.get()); 169 UpdateReference(pCurPageDict, pDestPDFDoc, pObjNumberMap.get());
170 ++curpage; 170 ++curpage;
171 } 171 }
172 172
173 return TRUE; 173 return TRUE;
174 } 174 }
175 175
176 CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( 176 CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
177 CPDF_Dictionary* pDict, 177 CPDF_Dictionary* pDict,
178 CFX_ByteString nSrctag) { 178 const CFX_ByteString& bsSrcTag) {
179 if (!pDict || nSrctag.IsEmpty()) 179 if (!pDict || bsSrcTag.IsEmpty())
180 return nullptr; 180 return nullptr;
181 if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type")) 181 if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type"))
182 return nullptr; 182 return nullptr;
183 183
184 CPDF_Object* pType = pDict->GetObjectBy("Type")->GetDirect(); 184 CPDF_Object* pType = pDict->GetObjectBy("Type")->GetDirect();
185 if (!ToName(pType)) 185 if (!ToName(pType))
186 return nullptr; 186 return nullptr;
187 if (pType->GetString().Compare("Page")) 187 if (pType->GetString().Compare("Page"))
188 return nullptr; 188 return nullptr;
189 189
190 CPDF_Dictionary* pp = ToDictionary(pDict->GetObjectBy("Parent")->GetDirect()); 190 CPDF_Dictionary* pp = ToDictionary(pDict->GetObjectBy("Parent")->GetDirect());
191 if (!pp) 191 if (!pp)
192 return nullptr; 192 return nullptr;
193 193
194 CFX_ByteStringC sSrcTag = nSrctag.AsStringC(); 194 if (pDict->KeyExist(bsSrcTag))
195 if (pDict->KeyExist(sSrcTag)) 195 return pDict->GetObjectBy(bsSrcTag);
196 return pDict->GetObjectBy(sSrcTag);
197 196
198 while (pp) { 197 while (pp) {
199 if (pp->KeyExist(sSrcTag)) 198 if (pp->KeyExist(bsSrcTag))
200 return pp->GetObjectBy(sSrcTag); 199 return pp->GetObjectBy(bsSrcTag);
201 if (!pp->KeyExist("Parent")) 200 if (!pp->KeyExist("Parent"))
202 break; 201 break;
203 pp = ToDictionary(pp->GetObjectBy("Parent")->GetDirect()); 202 pp = ToDictionary(pp->GetObjectBy("Parent")->GetDirect());
204 } 203 }
205 return nullptr; 204 return nullptr;
206 } 205 }
207 206
208 FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, 207 FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
209 CPDF_Document* pDoc, 208 CPDF_Document* pDoc,
210 ObjectNumberMap* pObjNumberMap) { 209 ObjectNumberMap* pObjNumberMap) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (!pSrcDict) 403 if (!pSrcDict)
405 return FALSE; 404 return FALSE;
406 405
407 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); 406 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
408 if (!pDstDict) 407 if (!pDstDict)
409 return FALSE; 408 return FALSE;
410 409
411 pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE)); 410 pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE));
412 return TRUE; 411 return TRUE;
413 } 412 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_transformpage.cpp ('k') | fpdfsdk/fxedit/fxet_ap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698