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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 10 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 if (pLimits && | 24 if (pLimits && |
25 (num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) { | 25 (num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) { |
26 return NULL; | 26 return NULL; |
27 } | 27 } |
28 CPDF_Array* pNumbers = pNode->GetArrayBy("Nums"); | 28 CPDF_Array* pNumbers = pNode->GetArrayBy("Nums"); |
29 if (pNumbers) { | 29 if (pNumbers) { |
30 uint32_t dwCount = pNumbers->GetCount() / 2; | 30 uint32_t dwCount = pNumbers->GetCount() / 2; |
31 for (uint32_t i = 0; i < dwCount; i++) { | 31 for (uint32_t i = 0; i < dwCount; i++) { |
32 int index = pNumbers->GetIntegerAt(i * 2); | 32 int index = pNumbers->GetIntegerAt(i * 2); |
33 if (num == index) { | 33 if (num == index) { |
34 return pNumbers->GetElementValue(i * 2 + 1); | 34 return pNumbers->GetDirectObjectAt(i * 2 + 1); |
35 } | 35 } |
36 if (index > num) { | 36 if (index > num) { |
37 break; | 37 break; |
38 } | 38 } |
39 } | 39 } |
40 return NULL; | 40 return NULL; |
41 } | 41 } |
42 CPDF_Array* pKids = pNode->GetArrayBy("Kids"); | 42 CPDF_Array* pKids = pNode->GetArrayBy("Kids"); |
43 if (!pKids) { | 43 if (!pKids) { |
44 return NULL; | 44 return NULL; |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 | 736 |
737 CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, | 737 CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, |
738 const FX_CHAR* name, | 738 const FX_CHAR* name, |
739 int nLevel) { | 739 int nLevel) { |
740 if (nLevel > FPDFDOC_UTILS_MAXRECURSION) { | 740 if (nLevel > FPDFDOC_UTILS_MAXRECURSION) { |
741 return NULL; | 741 return NULL; |
742 } | 742 } |
743 if (!pFieldDict) { | 743 if (!pFieldDict) { |
744 return NULL; | 744 return NULL; |
745 } | 745 } |
746 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); | 746 CPDF_Object* pAttr = pFieldDict->GetDirectObjectBy(name); |
747 if (pAttr) { | 747 if (pAttr) { |
748 return pAttr; | 748 return pAttr; |
749 } | 749 } |
750 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); | 750 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); |
751 if (!pParent) { | 751 if (!pParent) { |
752 return NULL; | 752 return NULL; |
753 } | 753 } |
754 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); | 754 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); |
755 } | 755 } |
OLD | NEW |