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/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
8 const int nMaxRecursion = 32; | 8 const int nMaxRecursion = 32; |
9 int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) | 9 int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) |
10 { | 10 { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 CFX_ByteString CPDF_Dest::GetRemoteName() | 66 CFX_ByteString CPDF_Dest::GetRemoteName() |
67 { | 67 { |
68 if (m_pObj == NULL) { | 68 if (m_pObj == NULL) { |
69 return CFX_ByteString(); | 69 return CFX_ByteString(); |
70 } | 70 } |
71 return m_pObj->GetString(); | 71 return m_pObj->GetString(); |
72 } | 72 } |
73 CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, FX_BSTR category) | 73 CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, FX_BSTR category) |
74 { | 74 { |
75 m_pRoot = pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))->GetDict(category); | 75 if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))) |
| 76 m_pRoot = pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))->GetDict(category)
; |
| 77 else |
| 78 m_pRoot = NULL; |
76 } | 79 } |
77 static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, const CFX_ByteString&
csName, | 80 static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, const CFX_ByteString&
csName, |
78 int& nIndex, CPDF_Array** ppFind, int nLevel
= 0) | 81 int& nIndex, CPDF_Array** ppFind, int nLevel
= 0) |
79 { | 82 { |
80 if (nLevel > nMaxRecursion) { | 83 if (nLevel > nMaxRecursion) { |
81 return NULL; | 84 return NULL; |
82 } | 85 } |
83 CPDF_Array* pLimits = pNode->GetArray(FX_BSTRC("Limits")); | 86 CPDF_Array* pLimits = pNode->GetArray(FX_BSTRC("Limits")); |
84 if (pLimits != NULL) { | 87 if (pLimits != NULL) { |
85 CFX_ByteString csLeft = pLimits->GetString(0); | 88 CFX_ByteString csLeft = pLimits->GetString(0); |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 if (nPage > 0 && nPage <= nPages) { | 561 if (nPage > 0 && nPage <= nPages) { |
559 return nPage; | 562 return nPage; |
560 } | 563 } |
561 return -1; | 564 return -1; |
562 } | 565 } |
563 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const | 566 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const |
564 { | 567 { |
565 CFX_ByteString bsLabel = PDF_EncodeText((CFX_WideString)wsLabel); | 568 CFX_ByteString bsLabel = PDF_EncodeText((CFX_WideString)wsLabel); |
566 return GetPageByLabel(bsLabel); | 569 return GetPageByLabel(bsLabel); |
567 } | 570 } |
OLD | NEW |