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 "parser_int.h" | 7 #include "parser_int.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 m_SortedOffset.Add(offset); | 980 m_SortedOffset.Add(offset); |
981 } | 981 } |
982 FX_Free(buffer); | 982 FX_Free(buffer); |
983 return m_pTrailer && m_CrossRef.GetSize() > 0; | 983 return m_pTrailer && m_CrossRef.GetSize() > 0; |
984 } | 984 } |
985 | 985 |
986 FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { | 986 FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { |
987 CPDF_Object* pObject = ParseIndirectObjectAt(m_pDocument, *pos, 0, nullptr); | 987 CPDF_Object* pObject = ParseIndirectObjectAt(m_pDocument, *pos, 0, nullptr); |
988 if (!pObject) | 988 if (!pObject) |
989 return FALSE; | 989 return FALSE; |
990 | |
991 if (m_pDocument) { | 990 if (m_pDocument) { |
991 FX_BOOL bInserted = FALSE; | |
992 CPDF_Dictionary* pDict = m_pDocument->GetRoot(); | 992 CPDF_Dictionary* pDict = m_pDocument->GetRoot(); |
993 if (!pDict || pDict->GetObjNum() != pObject->m_ObjNum) { | 993 if ((!pDict || pDict->GetObjNum() != pObject->m_ObjNum)) |
Tom Sepez
2015/12/10 17:32:13
nit: overparenthesized.
nit: use { here. The rule
jun_fang
2015/12/10 23:24:26
Acknowledged.
| |
994 m_pDocument->InsertIndirectObject(pObject->m_ObjNum, pObject); | 994 bInserted = m_pDocument->InsertIndirectObject(pObject->m_ObjNum, pObject); |
995 } else { | 995 else { |
996 if (pObject->IsStream()) | 996 if (pObject->IsStream()) |
997 pObject->Release(); | 997 pObject->Release(); |
998 bInserted = FALSE; | |
Tom Sepez
2015/12/10 17:32:13
nit: bInserted is already false.
jun_fang
2015/12/10 23:24:26
Acknowledged.
| |
999 } | |
1000 if (!bInserted) | |
998 return FALSE; | 1001 return FALSE; |
999 } | |
1000 } | 1002 } |
1001 | 1003 |
1002 CPDF_Stream* pStream = pObject->AsStream(); | 1004 CPDF_Stream* pStream = pObject->AsStream(); |
1003 if (!pStream) | 1005 if (!pStream) |
1004 return FALSE; | 1006 return FALSE; |
1005 | 1007 |
1006 *pos = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); | 1008 *pos = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); |
1007 int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); | 1009 int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); |
1008 if (size < 0) { | 1010 if (size < 0) { |
1009 pStream->Release(); | 1011 pStream->Release(); |
(...skipping 3539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4549 FX_BOOL bPagePosGot = m_pHintTables->GetPagePos(index, szPageStartPos, | 4551 FX_BOOL bPagePosGot = m_pHintTables->GetPagePos(index, szPageStartPos, |
4550 szPageLength, dwObjNum); | 4552 szPageLength, dwObjNum); |
4551 if (!bPagePosGot) { | 4553 if (!bPagePosGot) { |
4552 return nullptr; | 4554 return nullptr; |
4553 } | 4555 } |
4554 m_syntaxParser.InitParser(m_pFileRead, (FX_DWORD)szPageStartPos); | 4556 m_syntaxParser.InitParser(m_pFileRead, (FX_DWORD)szPageStartPos); |
4555 CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument); | 4557 CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument); |
4556 if (!pPageDict) { | 4558 if (!pPageDict) { |
4557 return nullptr; | 4559 return nullptr; |
4558 } | 4560 } |
4559 m_pDocument->InsertIndirectObject(dwObjNum, pPageDict); | 4561 if (!m_pDocument->InsertIndirectObject(dwObjNum, pPageDict)) |
4562 return nullptr; | |
4560 return pPageDict->GetDict(); | 4563 return pPageDict->GetDict(); |
4561 } | 4564 } |
4562 } | 4565 } |
4563 return m_pDocument->GetPage(index); | 4566 return m_pDocument->GetPage(index); |
4564 } | 4567 } |
4565 IPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( | 4568 IPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( |
4566 IFX_DownloadHints* pHints) { | 4569 IFX_DownloadHints* pHints) { |
4567 if (!m_pDocument) { | 4570 if (!m_pDocument) { |
4568 return FormAvailable; | 4571 return FormAvailable; |
4569 } | 4572 } |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4950 if (!m_pLinearizedDict) | 4953 if (!m_pLinearizedDict) |
4951 return -1; | 4954 return -1; |
4952 CPDF_Array* pRange = m_pLinearizedDict->GetArray(FX_BSTRC("H")); | 4955 CPDF_Array* pRange = m_pLinearizedDict->GetArray(FX_BSTRC("H")); |
4953 if (!pRange) | 4956 if (!pRange) |
4954 return -1; | 4957 return -1; |
4955 CPDF_Object* pStreamLen = pRange->GetElementValue(1); | 4958 CPDF_Object* pStreamLen = pRange->GetElementValue(1); |
4956 if (!pStreamLen) | 4959 if (!pStreamLen) |
4957 return -1; | 4960 return -1; |
4958 return pStreamLen->GetInteger(); | 4961 return pStreamLen->GetInteger(); |
4959 } | 4962 } |
OLD | NEW |