| OLD | NEW |
| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 pReference->SetRef(pDoc, newobjnum); | 216 pReference->SetRef(pDoc, newobjnum); |
| 217 break; | 217 break; |
| 218 } | 218 } |
| 219 case CPDF_Object::DICTIONARY: { | 219 case CPDF_Object::DICTIONARY: { |
| 220 CPDF_Dictionary* pDict = pObj->AsDictionary(); | 220 CPDF_Dictionary* pDict = pObj->AsDictionary(); |
| 221 auto it = pDict->begin(); | 221 auto it = pDict->begin(); |
| 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.c_str(), "Parent") || | 226 if (key == "Parent" || key == "Prev" || key == "First") |
| 227 !FXSYS_strcmp(key.c_str(), "Prev") || | |
| 228 !FXSYS_strcmp(key.c_str(), "First")) { | |
| 229 continue; | 227 continue; |
| 230 } | 228 if (!pNextObj) |
| 231 if (pNextObj) { | |
| 232 if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) | |
| 233 pDict->RemoveAt(key); | |
| 234 } else { | |
| 235 return FALSE; | 229 return FALSE; |
| 236 } | 230 if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) |
| 231 pDict->RemoveAt(key); |
| 237 } | 232 } |
| 238 break; | 233 break; |
| 239 } | 234 } |
| 240 case CPDF_Object::ARRAY: { | 235 case CPDF_Object::ARRAY: { |
| 241 CPDF_Array* pArray = pObj->AsArray(); | 236 CPDF_Array* pArray = pObj->AsArray(); |
| 242 for (size_t i = 0; i < pArray->GetCount(); ++i) { | 237 for (size_t i = 0; i < pArray->GetCount(); ++i) { |
| 243 CPDF_Object* pNextObj = pArray->GetObjectAt(i); | 238 CPDF_Object* pNextObj = pArray->GetObjectAt(i); |
| 244 if (!pNextObj) | 239 if (!pNextObj) |
| 245 return FALSE; | 240 return FALSE; |
| 246 if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) | 241 if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 if (!pSrcDict) | 398 if (!pSrcDict) |
| 404 return FALSE; | 399 return FALSE; |
| 405 | 400 |
| 406 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); | 401 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); |
| 407 if (!pDstDict) | 402 if (!pDstDict) |
| 408 return FALSE; | 403 return FALSE; |
| 409 | 404 |
| 410 pDstDict->SetAt("ViewerPreferences", pSrcDict->CloneDirectObject()); | 405 pDstDict->SetAt("ViewerPreferences", pSrcDict->CloneDirectObject()); |
| 411 return TRUE; | 406 return TRUE; |
| 412 } | 407 } |
| OLD | NEW |