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 "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fpdfapi/fpdf_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
10 #include "../../../../third_party/numerics/safe_math.h" | 10 #include "../../../../third_party/numerics/safe_math.h" |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 } | 996 } |
997 return result; | 997 return result; |
998 } | 998 } |
999 FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
bMainXRef) | 999 FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
bMainXRef) |
1000 { | 1000 { |
1001 CPDF_Stream* pStream = (CPDF_Stream*)ParseIndirectObjectAt(m_pDocument, pos,
0, NULL); | 1001 CPDF_Stream* pStream = (CPDF_Stream*)ParseIndirectObjectAt(m_pDocument, pos,
0, NULL); |
1002 if (!pStream) { | 1002 if (!pStream) { |
1003 return FALSE; | 1003 return FALSE; |
1004 } | 1004 } |
1005 if (m_pDocument) { | 1005 if (m_pDocument) { |
1006 m_pDocument->InsertIndirectObject(pStream->m_ObjNum, pStream); | 1006 CPDF_Dictionary * pDict = m_pDocument->GetRoot(); |
| 1007 if (!pDict || pDict->GetObjNum() != pStream->m_ObjNum) { |
| 1008 m_pDocument->InsertIndirectObject(pStream->m_ObjNum, pStream); |
| 1009 } else { |
| 1010 if (pStream->GetType() == PDFOBJ_STREAM) { |
| 1011 pStream->Release(); |
| 1012 } |
| 1013 return FALSE; |
| 1014 } |
1007 } | 1015 } |
1008 if (pStream->GetType() != PDFOBJ_STREAM) { | 1016 if (pStream->GetType() != PDFOBJ_STREAM) { |
1009 return FALSE; | 1017 return FALSE; |
1010 } | 1018 } |
1011 prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); | 1019 prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); |
1012 FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); | 1020 FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); |
1013 if (size < 0) { | 1021 if (size < 0) { |
1014 pStream->Release(); | 1022 pStream->Release(); |
1015 return FALSE; | 1023 return FALSE; |
1016 } | 1024 } |
(...skipping 3401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4418 { | 4426 { |
4419 FX_INT32 iSize = m_childNode.GetSize(); | 4427 FX_INT32 iSize = m_childNode.GetSize(); |
4420 for (FX_INT32 i = 0; i < iSize; ++i) { | 4428 for (FX_INT32 i = 0; i < iSize; ++i) { |
4421 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4429 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4422 if (pNode) { | 4430 if (pNode) { |
4423 delete pNode; | 4431 delete pNode; |
4424 } | 4432 } |
4425 } | 4433 } |
4426 m_childNode.RemoveAll(); | 4434 m_childNode.RemoveAll(); |
4427 } | 4435 } |
OLD | NEW |