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

Side by Side Diff: fpdfsdk/src/fpdfppo.cpp

Issue 469573002: Treat null Parent as no Parent for dictionary objects (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Tabify Created 6 years, 4 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 | « no previous file | no next file » | 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 "../include/fpdfppo.h" 7 #include "../include/fpdfppo.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 9
10 class CPDF_PageOrganizer 10 class CPDF_PageOrganizer
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if(!pParent || pParent->GetType() != PDFOBJ_DICTIONARY) return NULL; 208 if(!pParent || pParent->GetType() != PDFOBJ_DICTIONARY) return NULL;
209 209
210 CPDF_Dictionary* pp = (CPDF_Dictionary*)pParent; 210 CPDF_Dictionary* pp = (CPDF_Dictionary*)pParent;
211 211
212 if(pDict->KeyExist((const char*)nSrctag)) 212 if(pDict->KeyExist((const char*)nSrctag))
213 return pDict->GetElement((const char*)nSrctag); 213 return pDict->GetElement((const char*)nSrctag);
214 while (pp) 214 while (pp)
215 { 215 {
216 if(pp->KeyExist((const char*)nSrctag)) 216 if(pp->KeyExist((const char*)nSrctag))
217 return pp->GetElement((const char*)nSrctag); 217 return pp->GetElement((const char*)nSrctag);
218 » » else if(pp->KeyExist("Parent")) 218 » » else if (pp->KeyExist("Parent"))
219 » » {
219 pp = (CPDF_Dictionary*)pp->GetElement("Parent")->GetDire ct(); 220 pp = (CPDF_Dictionary*)pp->GetElement("Parent")->GetDire ct();
221 if (pp->GetType() == PDFOBJ_NULL) break;
222 }
220 else break; 223 else break;
221 } 224 }
222 225
223 return NULL; 226 return NULL;
224 } 227 }
225 228
226 FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object *pObj, CPDF_Document *pD oc, 229 FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object *pObj, CPDF_Document *pD oc,
227 CFX_MapPtrToPtr* pMapPtrToPtr) 230 CFX_MapPtrToPtr* pMapPtrToPtr)
228 { 231 {
229 switch (pObj->GetType()) 232 switch (pObj->GetType())
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 if(!pSrcDict) 455 if(!pSrcDict)
453 return FALSE; 456 return FALSE;
454 CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc; 457 CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc;
455 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); 458 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
456 if(!pDstDict) 459 if(!pDstDict)
457 return FALSE; 460 return FALSE;
458 pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE)); 461 pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE));
459 return TRUE; 462 return TRUE;
460 } 463 }
461 464
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698