| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 { | 141 { |
| 142 if (nLevel > nMaxRecursion) { | 142 if (nLevel > nMaxRecursion) { |
| 143 return NULL; | 143 return NULL; |
| 144 } | 144 } |
| 145 CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names")); | 145 CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names")); |
| 146 if (pNames) { | 146 if (pNames) { |
| 147 int nCount = pNames->GetCount() / 2; | 147 int nCount = pNames->GetCount() / 2; |
| 148 if (nIndex >= nCurIndex + nCount) { | 148 if (nIndex >= nCurIndex + nCount) { |
| 149 nCurIndex += nCount; | 149 nCurIndex += nCount; |
| 150 return NULL; | 150 return NULL; |
| 151 } else { | |
| 152 if (ppFind != NULL) { | |
| 153 *ppFind = pNames; | |
| 154 } | |
| 155 csName = pNames->GetString((nIndex - nCurIndex) * 2); | |
| 156 return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1); | |
| 157 } | 151 } |
| 152 if (ppFind != NULL) { |
| 153 *ppFind = pNames; |
| 154 } |
| 155 csName = pNames->GetString((nIndex - nCurIndex) * 2); |
| 156 return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1); |
| 158 } | 157 } |
| 159 CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids")); | 158 CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids")); |
| 160 if (pKids == NULL) { | 159 if (pKids == NULL) { |
| 161 return NULL; | 160 return NULL; |
| 162 } | 161 } |
| 163 for (FX_DWORD i = 0; i < pKids->GetCount(); i ++) { | 162 for (FX_DWORD i = 0; i < pKids->GetCount(); i ++) { |
| 164 CPDF_Dictionary* pKid = pKids->GetDict(i); | 163 CPDF_Dictionary* pKid = pKids->GetDict(i); |
| 165 if (pKid == NULL) { | 164 if (pKid == NULL) { |
| 166 continue; | 165 continue; |
| 167 } | 166 } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 if (nPage > 0 && nPage <= nPages) { | 562 if (nPage > 0 && nPage <= nPages) { |
| 564 return nPage; | 563 return nPage; |
| 565 } | 564 } |
| 566 return -1; | 565 return -1; |
| 567 } | 566 } |
| 568 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const | 567 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const |
| 569 { | 568 { |
| 570 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); | 569 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); |
| 571 return GetPageByLabel(bsLabel); | 570 return GetPageByLabel(bsLabel); |
| 572 } | 571 } |
| OLD | NEW |