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_page.h" | 8 #include "../../include/fpdfapi/fpdf_page.h" |
9 #include "../../include/fpdfdoc/fpdf_tagged.h" | 9 #include "../../include/fpdfdoc/fpdf_tagged.h" |
10 #include "tagged_int.h" | 10 #include "tagged_int.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 m_pRoleMap = m_pTreeRoot->GetDict(FX_BSTRC("RoleMap")); | 40 m_pRoleMap = m_pTreeRoot->GetDict(FX_BSTRC("RoleMap")); |
41 } | 41 } |
42 CPDF_StructTreeImpl::~CPDF_StructTreeImpl() { | 42 CPDF_StructTreeImpl::~CPDF_StructTreeImpl() { |
43 for (int i = 0; i < m_Kids.GetSize(); i++) | 43 for (int i = 0; i < m_Kids.GetSize(); i++) |
44 if (m_Kids[i]) { | 44 if (m_Kids[i]) { |
45 m_Kids[i]->Release(); | 45 m_Kids[i]->Release(); |
46 } | 46 } |
47 } | 47 } |
48 void CPDF_StructTreeImpl::LoadDocTree() { | 48 void CPDF_StructTreeImpl::LoadDocTree() { |
49 m_pPage = NULL; | 49 m_pPage = nullptr; |
50 if (m_pTreeRoot == NULL) { | 50 if (!m_pTreeRoot) |
51 return; | 51 return; |
52 } | 52 |
53 CPDF_Object* pKids = m_pTreeRoot->GetElementValue(FX_BSTRC("K")); | 53 CPDF_Object* pKids = m_pTreeRoot->GetElementValue(FX_BSTRC("K")); |
54 if (pKids == NULL) { | 54 if (!pKids) |
55 return; | 55 return; |
56 } | |
57 if (CPDF_Dictionary* pDict = pKids->AsDictionary()) { | 56 if (CPDF_Dictionary* pDict = pKids->AsDictionary()) { |
58 CPDF_StructElementImpl* pStructElementImpl = | 57 CPDF_StructElementImpl* pStructElementImpl = |
59 new CPDF_StructElementImpl(this, NULL, pDict); | 58 new CPDF_StructElementImpl(this, nullptr, pDict); |
60 m_Kids.Add(pStructElementImpl); | 59 m_Kids.Add(pStructElementImpl); |
61 return; | 60 return; |
62 } | 61 } |
63 if (pKids->GetType() != PDFOBJ_ARRAY) { | 62 CPDF_Array* pArray = pKids->AsArray(); |
| 63 if (!pArray) |
64 return; | 64 return; |
65 } | 65 |
66 CPDF_Array* pArray = (CPDF_Array*)pKids; | |
67 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { | 66 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { |
68 CPDF_Dictionary* pKid = pArray->GetDict(i); | 67 CPDF_Dictionary* pKid = pArray->GetDict(i); |
69 CPDF_StructElementImpl* pStructElementImpl = | 68 CPDF_StructElementImpl* pStructElementImpl = |
70 new CPDF_StructElementImpl(this, NULL, pKid); | 69 new CPDF_StructElementImpl(this, nullptr, pKid); |
71 m_Kids.Add(pStructElementImpl); | 70 m_Kids.Add(pStructElementImpl); |
72 } | 71 } |
73 } | 72 } |
74 void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) { | 73 void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) { |
75 m_pPage = pPageDict; | 74 m_pPage = pPageDict; |
76 if (m_pTreeRoot == NULL) { | 75 if (!m_pTreeRoot) |
77 return; | 76 return; |
78 } | 77 |
79 CPDF_Object* pKids = m_pTreeRoot->GetElementValue(FX_BSTRC("K")); | 78 CPDF_Object* pKids = m_pTreeRoot->GetElementValue(FX_BSTRC("K")); |
80 if (pKids == NULL) { | 79 if (!pKids) |
81 return; | 80 return; |
82 } | 81 |
83 FX_DWORD dwKids = 0; | 82 FX_DWORD dwKids = 0; |
84 if (pKids->IsDictionary()) { | 83 if (pKids->IsDictionary()) |
85 dwKids = 1; | 84 dwKids = 1; |
86 } else if (pKids->GetType() == PDFOBJ_ARRAY) { | 85 else if (CPDF_Array* pArray = pKids->AsArray()) |
87 dwKids = ((CPDF_Array*)pKids)->GetCount(); | 86 dwKids = pArray->GetCount(); |
88 } else { | 87 else |
89 return; | 88 return; |
90 } | 89 |
91 FX_DWORD i; | 90 FX_DWORD i; |
92 m_Kids.SetSize(dwKids); | 91 m_Kids.SetSize(dwKids); |
93 for (i = 0; i < dwKids; i++) { | 92 for (i = 0; i < dwKids; i++) { |
94 m_Kids[i] = NULL; | 93 m_Kids[i] = NULL; |
95 } | 94 } |
96 CFX_MapPtrToPtr element_map; | 95 CFX_MapPtrToPtr element_map; |
97 CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict(FX_BSTRC("ParentTree")); | 96 CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict(FX_BSTRC("ParentTree")); |
98 if (pParentTree == NULL) { | 97 if (pParentTree == NULL) { |
99 return; | 98 return; |
100 } | 99 } |
101 CPDF_NumberTree parent_tree(pParentTree); | 100 CPDF_NumberTree parent_tree(pParentTree); |
102 int parents_id = pPageDict->GetInteger(FX_BSTRC("StructParents"), -1); | 101 int parents_id = pPageDict->GetInteger(FX_BSTRC("StructParents"), -1); |
103 if (parents_id >= 0) { | 102 if (parents_id >= 0) { |
104 CPDF_Object* pParents = parent_tree.LookupValue(parents_id); | 103 CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id)); |
105 if (pParents == NULL || pParents->GetType() != PDFOBJ_ARRAY) { | 104 if (!pParentArray) |
106 return; | 105 return; |
107 } | 106 |
108 CPDF_Array* pParentArray = (CPDF_Array*)pParents; | |
109 for (i = 0; i < pParentArray->GetCount(); i++) { | 107 for (i = 0; i < pParentArray->GetCount(); i++) { |
110 CPDF_Dictionary* pParent = pParentArray->GetDict(i); | 108 CPDF_Dictionary* pParent = pParentArray->GetDict(i); |
111 if (pParent == NULL) { | 109 if (pParent == NULL) { |
112 continue; | 110 continue; |
113 } | 111 } |
114 AddPageNode(pParent, element_map); | 112 AddPageNode(pParent, element_map); |
115 } | 113 } |
116 } | 114 } |
117 } | 115 } |
118 CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict, | 116 CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (pObj->IsDictionary()) { | 162 if (pObj->IsDictionary()) { |
165 if (pObj->GetObjNum() == pDict->GetObjNum()) { | 163 if (pObj->GetObjNum() == pDict->GetObjNum()) { |
166 if (m_Kids[0]) { | 164 if (m_Kids[0]) { |
167 m_Kids[0]->Release(); | 165 m_Kids[0]->Release(); |
168 } | 166 } |
169 m_Kids[0] = pElement->Retain(); | 167 m_Kids[0] = pElement->Retain(); |
170 } else { | 168 } else { |
171 return FALSE; | 169 return FALSE; |
172 } | 170 } |
173 } | 171 } |
174 if (pObj->GetType() == PDFOBJ_ARRAY) { | 172 if (CPDF_Array* pTopKids = pObj->AsArray()) { |
175 CPDF_Array* pTopKids = (CPDF_Array*)pObj; | |
176 FX_DWORD i; | 173 FX_DWORD i; |
177 FX_BOOL bSave = FALSE; | 174 FX_BOOL bSave = FALSE; |
178 for (i = 0; i < pTopKids->GetCount(); i++) { | 175 for (i = 0; i < pTopKids->GetCount(); i++) { |
179 CPDF_Object* pKidRef = pTopKids->GetElement(i); | 176 CPDF_Object* pKidRef = pTopKids->GetElement(i); |
180 if (pKidRef == NULL || pKidRef->GetType() != PDFOBJ_REFERENCE) { | 177 if (!pKidRef || pKidRef->GetType() != PDFOBJ_REFERENCE) |
181 continue; | 178 continue; |
182 } | 179 if (((CPDF_Reference*)pKidRef)->GetRefObjNum() != pDict->GetObjNum()) |
183 if (((CPDF_Reference*)pKidRef)->GetRefObjNum() != pDict->GetObjNum()) { | |
184 continue; | 180 continue; |
185 } | 181 |
186 if (m_Kids[i]) { | 182 if (m_Kids[i]) |
187 m_Kids[i]->Release(); | 183 m_Kids[i]->Release(); |
188 } | |
189 m_Kids[i] = pElement->Retain(); | 184 m_Kids[i] = pElement->Retain(); |
190 bSave = TRUE; | 185 bSave = TRUE; |
191 } | 186 } |
192 if (!bSave) { | 187 if (!bSave) |
193 return FALSE; | 188 return FALSE; |
194 } | |
195 } | 189 } |
196 return TRUE; | 190 return TRUE; |
197 } | 191 } |
198 CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, | 192 CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, |
199 CPDF_StructElementImpl* pParent, | 193 CPDF_StructElementImpl* pParent, |
200 CPDF_Dictionary* pDict) | 194 CPDF_Dictionary* pDict) |
201 : m_RefCount(0) { | 195 : m_RefCount(0) { |
202 m_pTree = pTree; | 196 m_pTree = pTree; |
203 m_pDict = pDict; | 197 m_pDict = pDict; |
204 m_Type = pDict->GetString(FX_BSTRC("S")); | 198 m_Type = pDict->GetString(FX_BSTRC("S")); |
(...skipping 19 matching lines...) Expand all Loading... |
224 return this; | 218 return this; |
225 } | 219 } |
226 void CPDF_StructElementImpl::Release() { | 220 void CPDF_StructElementImpl::Release() { |
227 if (--m_RefCount < 1) { | 221 if (--m_RefCount < 1) { |
228 delete this; | 222 delete this; |
229 } | 223 } |
230 } | 224 } |
231 void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) { | 225 void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) { |
232 CPDF_Object* pObj = pDict->GetElement(FX_BSTRC("Pg")); | 226 CPDF_Object* pObj = pDict->GetElement(FX_BSTRC("Pg")); |
233 FX_DWORD PageObjNum = 0; | 227 FX_DWORD PageObjNum = 0; |
234 if (pObj && pObj->GetType() == PDFOBJ_REFERENCE) { | 228 if (pObj && pObj->GetType() == PDFOBJ_REFERENCE) |
235 PageObjNum = ((CPDF_Reference*)pObj)->GetRefObjNum(); | 229 PageObjNum = ((CPDF_Reference*)pObj)->GetRefObjNum(); |
236 } | 230 |
237 CPDF_Object* pKids = pDict->GetElementValue(FX_BSTRC("K")); | 231 CPDF_Object* pKids = pDict->GetElementValue(FX_BSTRC("K")); |
238 if (pKids == NULL) { | 232 if (!pKids) |
239 return; | 233 return; |
240 } | 234 |
241 if (pKids->GetType() == PDFOBJ_ARRAY) { | 235 if (CPDF_Array* pArray = pKids->AsArray()) { |
242 CPDF_Array* pArray = (CPDF_Array*)pKids; | |
243 m_Kids.SetSize(pArray->GetCount()); | 236 m_Kids.SetSize(pArray->GetCount()); |
244 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { | 237 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { |
245 CPDF_Object* pKid = pArray->GetElementValue(i); | 238 CPDF_Object* pKid = pArray->GetElementValue(i); |
246 LoadKid(PageObjNum, pKid, &m_Kids[i]); | 239 LoadKid(PageObjNum, pKid, &m_Kids[i]); |
247 } | 240 } |
248 } else { | 241 } else { |
249 m_Kids.SetSize(1); | 242 m_Kids.SetSize(1); |
250 LoadKid(PageObjNum, pKids, &m_Kids[0]); | 243 LoadKid(PageObjNum, pKids, &m_Kids[0]); |
251 } | 244 } |
252 } | 245 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 pKid->m_Element.m_pElement = | 302 pKid->m_Element.m_pElement = |
310 new CPDF_StructElementImpl(m_pTree, this, pKidDict); | 303 new CPDF_StructElementImpl(m_pTree, this, pKidDict); |
311 } else { | 304 } else { |
312 pKid->m_Element.m_pElement = NULL; | 305 pKid->m_Element.m_pElement = NULL; |
313 } | 306 } |
314 } | 307 } |
315 } | 308 } |
316 static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, | 309 static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, |
317 const CFX_ByteStringC& owner, | 310 const CFX_ByteStringC& owner, |
318 FX_FLOAT nLevel = 0.0F) { | 311 FX_FLOAT nLevel = 0.0F) { |
319 if (nLevel > nMaxRecursion) { | 312 if (nLevel > nMaxRecursion) |
320 return NULL; | 313 return nullptr; |
321 } | 314 if (!pAttrs) |
322 if (pAttrs == NULL) { | 315 return nullptr; |
323 return NULL; | 316 |
324 } | 317 CPDF_Dictionary* pDict = nullptr; |
325 CPDF_Dictionary* pDict = NULL; | |
326 if (pAttrs->IsDictionary()) { | 318 if (pAttrs->IsDictionary()) { |
327 pDict = pAttrs->AsDictionary(); | 319 pDict = pAttrs->AsDictionary(); |
328 } else if (pAttrs->GetType() == PDFOBJ_STREAM) { | 320 } else if (pAttrs->GetType() == PDFOBJ_STREAM) { |
329 pDict = ((CPDF_Stream*)pAttrs)->GetDict(); | 321 pDict = ((CPDF_Stream*)pAttrs)->GetDict(); |
330 } else if (pAttrs->GetType() == PDFOBJ_ARRAY) { | 322 } else if (CPDF_Array* pArray = pAttrs->AsArray()) { |
331 CPDF_Array* pArray = (CPDF_Array*)pAttrs; | |
332 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { | 323 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { |
333 CPDF_Object* pElement = pArray->GetElementValue(i); | 324 CPDF_Object* pElement = pArray->GetElementValue(i); |
334 pDict = FindAttrDict(pElement, owner, nLevel + 1); | 325 pDict = FindAttrDict(pElement, owner, nLevel + 1); |
335 if (pDict) { | 326 if (pDict) |
336 return pDict; | 327 return pDict; |
337 } | |
338 } | 328 } |
339 } | 329 } |
340 if (pDict && pDict->GetString(FX_BSTRC("O")) == owner) { | 330 if (pDict && pDict->GetString(FX_BSTRC("O")) == owner) { |
341 return pDict; | 331 return pDict; |
342 } | 332 } |
343 return NULL; | 333 return NULL; |
344 } | 334 } |
345 CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, | 335 CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, |
346 const CFX_ByteStringC& name, | 336 const CFX_ByteStringC& name, |
347 FX_BOOL bInheritable, | 337 FX_BOOL bInheritable, |
(...skipping 15 matching lines...) Expand all Loading... |
363 if (pA) { | 353 if (pA) { |
364 CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner); | 354 CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner); |
365 if (pAttrDict) { | 355 if (pAttrDict) { |
366 CPDF_Object* pAttr = pAttrDict->GetElementValue(name); | 356 CPDF_Object* pAttr = pAttrDict->GetElementValue(name); |
367 if (pAttr) { | 357 if (pAttr) { |
368 return pAttr; | 358 return pAttr; |
369 } | 359 } |
370 } | 360 } |
371 } | 361 } |
372 CPDF_Object* pC = m_pDict->GetElementValue(FX_BSTRC("C")); | 362 CPDF_Object* pC = m_pDict->GetElementValue(FX_BSTRC("C")); |
373 if (pC == NULL) { | 363 if (!pC) |
374 return NULL; | 364 return nullptr; |
375 } | 365 |
376 CPDF_Dictionary* pClassMap = | 366 CPDF_Dictionary* pClassMap = |
377 m_pTree->m_pTreeRoot->GetDict(FX_BSTRC("ClassMap")); | 367 m_pTree->m_pTreeRoot->GetDict(FX_BSTRC("ClassMap")); |
378 if (pClassMap == NULL) { | 368 if (!pClassMap) |
379 return NULL; | 369 return nullptr; |
380 } | 370 |
381 if (pC->GetType() == PDFOBJ_ARRAY) { | 371 if (CPDF_Array* pArray = pC->AsArray()) { |
382 CPDF_Array* pArray = (CPDF_Array*)pC; | |
383 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { | 372 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { |
384 CFX_ByteString class_name = pArray->GetString(i); | 373 CFX_ByteString class_name = pArray->GetString(i); |
385 CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name); | 374 CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name); |
386 if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner) { | 375 if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner) |
387 return pClassDict->GetElementValue(name); | 376 return pClassDict->GetElementValue(name); |
388 } | |
389 } | 377 } |
390 return NULL; | 378 return nullptr; |
391 } | 379 } |
392 CFX_ByteString class_name = pC->GetString(); | 380 CFX_ByteString class_name = pC->GetString(); |
393 CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name); | 381 CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name); |
394 if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner) { | 382 if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner) |
395 return pClassDict->GetElementValue(name); | 383 return pClassDict->GetElementValue(name); |
396 } | 384 return nullptr; |
397 return NULL; | |
398 } | 385 } |
399 CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, | 386 CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, |
400 const CFX_ByteStringC& name, | 387 const CFX_ByteStringC& name, |
401 FX_BOOL bInheritable, | 388 FX_BOOL bInheritable, |
402 int subindex) { | 389 int subindex) { |
403 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable); | 390 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable); |
404 if (pAttr == NULL || subindex == -1 || pAttr->GetType() != PDFOBJ_ARRAY) { | 391 CPDF_Array* pArray = ToArray(pAttr); |
| 392 if (!pArray || subindex == -1) |
405 return pAttr; | 393 return pAttr; |
406 } | 394 |
407 CPDF_Array* pArray = (CPDF_Array*)pAttr; | 395 if (subindex >= static_cast<int>(pArray->GetCount())) |
408 if (subindex >= (int)pArray->GetCount()) { | |
409 return pAttr; | 396 return pAttr; |
410 } | |
411 return pArray->GetElementValue(subindex); | 397 return pArray->GetElementValue(subindex); |
412 } | 398 } |
413 CFX_ByteString CPDF_StructElementImpl::GetName( | 399 CFX_ByteString CPDF_StructElementImpl::GetName( |
414 const CFX_ByteStringC& owner, | 400 const CFX_ByteStringC& owner, |
415 const CFX_ByteStringC& name, | 401 const CFX_ByteStringC& name, |
416 const CFX_ByteStringC& default_value, | 402 const CFX_ByteStringC& default_value, |
417 FX_BOOL bInheritable, | 403 FX_BOOL bInheritable, |
418 int subindex) { | 404 int subindex) { |
419 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 405 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); |
420 if (ToName(pAttr)) | 406 if (ToName(pAttr)) |
421 return pAttr->GetString(); | 407 return pAttr->GetString(); |
422 return default_value; | 408 return default_value; |
423 } | 409 } |
424 | 410 |
425 FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, | 411 FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, |
426 const CFX_ByteStringC& name, | 412 const CFX_ByteStringC& name, |
427 FX_ARGB default_value, | 413 FX_ARGB default_value, |
428 FX_BOOL bInheritable, | 414 FX_BOOL bInheritable, |
429 int subindex) { | 415 int subindex) { |
430 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 416 CPDF_Array* pArray = ToArray(GetAttr(owner, name, bInheritable, subindex)); |
431 if (pAttr == NULL || pAttr->GetType() != PDFOBJ_ARRAY) { | 417 if (!pArray) |
432 return default_value; | 418 return default_value; |
433 } | |
434 CPDF_Array* pArray = (CPDF_Array*)pAttr; | |
435 return 0xff000000 | ((int)(pArray->GetNumber(0) * 255) << 16) | | 419 return 0xff000000 | ((int)(pArray->GetNumber(0) * 255) << 16) | |
436 ((int)(pArray->GetNumber(1) * 255) << 8) | | 420 ((int)(pArray->GetNumber(1) * 255) << 8) | |
437 (int)(pArray->GetNumber(2) * 255); | 421 (int)(pArray->GetNumber(2) * 255); |
438 } | 422 } |
439 FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, | 423 FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, |
440 const CFX_ByteStringC& name, | 424 const CFX_ByteStringC& name, |
441 FX_FLOAT default_value, | 425 FX_FLOAT default_value, |
442 FX_BOOL bInheritable, | 426 FX_BOOL bInheritable, |
443 int subindex) { | 427 int subindex) { |
444 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 428 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); |
445 return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; | 429 return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; |
446 } | 430 } |
447 int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, | 431 int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, |
448 const CFX_ByteStringC& name, | 432 const CFX_ByteStringC& name, |
449 int default_value, | 433 int default_value, |
450 FX_BOOL bInheritable, | 434 FX_BOOL bInheritable, |
451 int subindex) { | 435 int subindex) { |
452 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 436 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); |
453 return ToNumber(pAttr) ? pAttr->GetInteger() : default_value; | 437 return ToNumber(pAttr) ? pAttr->GetInteger() : default_value; |
454 } | 438 } |
OLD | NEW |