| 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/fxcrt/fx_string.h" | 8 #include "../../../include/fxcrt/fx_string.h" |
| 9 | 9 |
| 10 // static | 10 // static |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 switch (m_Type) { | 41 switch (m_Type) { |
| 42 case PDFOBJ_BOOLEAN: | 42 case PDFOBJ_BOOLEAN: |
| 43 return AsBoolean()->m_bValue ? "true" : "false"; | 43 return AsBoolean()->m_bValue ? "true" : "false"; |
| 44 case PDFOBJ_NUMBER: | 44 case PDFOBJ_NUMBER: |
| 45 return AsNumber()->GetString(); | 45 return AsNumber()->GetString(); |
| 46 case PDFOBJ_STRING: | 46 case PDFOBJ_STRING: |
| 47 return AsString()->m_String; | 47 return AsString()->m_String; |
| 48 case PDFOBJ_NAME: | 48 case PDFOBJ_NAME: |
| 49 return AsName()->m_Name; | 49 return AsName()->m_Name; |
| 50 case PDFOBJ_REFERENCE: { | 50 case PDFOBJ_REFERENCE: { |
| 51 const CPDF_Reference* pRef = AsReference(); | 51 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; |
| 52 if (!pRef->m_pObjList) | 52 if (pRef->m_pObjList == NULL) { |
| 53 break; | 53 break; |
| 54 | 54 } |
| 55 CPDF_Object* pObj = | 55 CPDF_Object* pObj = |
| 56 pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum()); | 56 pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum()); |
| 57 return pObj ? pObj->GetString() : CFX_ByteString(); | 57 if (pObj == NULL) { |
| 58 return CFX_ByteString(); |
| 59 } |
| 60 return pObj->GetString(); |
| 58 } | 61 } |
| 59 } | 62 } |
| 60 return CFX_ByteString(); | 63 return CFX_ByteString(); |
| 61 } | 64 } |
| 62 CFX_ByteStringC CPDF_Object::GetConstString() const { | 65 CFX_ByteStringC CPDF_Object::GetConstString() const { |
| 63 switch (m_Type) { | 66 switch (m_Type) { |
| 64 case PDFOBJ_STRING: { | 67 case PDFOBJ_STRING: { |
| 65 CFX_ByteString str = AsString()->m_String; | 68 CFX_ByteString str = AsString()->m_String; |
| 66 return CFX_ByteStringC((const uint8_t*)str, str.GetLength()); | 69 return CFX_ByteStringC((const uint8_t*)str, str.GetLength()); |
| 67 } | 70 } |
| 68 case PDFOBJ_NAME: { | 71 case PDFOBJ_NAME: { |
| 69 CFX_ByteString name = AsName()->m_Name; | 72 CFX_ByteString name = AsName()->m_Name; |
| 70 return CFX_ByteStringC((const uint8_t*)name, name.GetLength()); | 73 return CFX_ByteStringC((const uint8_t*)name, name.GetLength()); |
| 71 } | 74 } |
| 72 case PDFOBJ_REFERENCE: { | 75 case PDFOBJ_REFERENCE: { |
| 73 const CPDF_Reference* pRef = AsReference(); | 76 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; |
| 74 if (!pRef->m_pObjList) | 77 if (pRef->m_pObjList == NULL) { |
| 75 break; | 78 break; |
| 76 | 79 } |
| 77 CPDF_Object* pObj = | 80 CPDF_Object* pObj = |
| 78 pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum()); | 81 pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum()); |
| 79 return pObj ? pObj->GetConstString() : CFX_ByteStringC(); | 82 if (pObj == NULL) { |
| 83 return CFX_ByteStringC(); |
| 84 } |
| 85 return pObj->GetConstString(); |
| 80 } | 86 } |
| 81 } | 87 } |
| 82 return CFX_ByteStringC(); | 88 return CFX_ByteStringC(); |
| 83 } | 89 } |
| 84 FX_FLOAT CPDF_Object::GetNumber() const { | 90 FX_FLOAT CPDF_Object::GetNumber() const { |
| 85 switch (m_Type) { | 91 switch (m_Type) { |
| 86 case PDFOBJ_NUMBER: | 92 case PDFOBJ_NUMBER: |
| 87 return AsNumber()->GetNumber(); | 93 return AsNumber()->GetNumber(); |
| 88 case PDFOBJ_REFERENCE: { | 94 case PDFOBJ_REFERENCE: { |
| 89 const CPDF_Reference* pRef = AsReference(); | 95 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; |
| 90 if (!pRef->m_pObjList) | 96 if (pRef->m_pObjList == NULL) { |
| 91 break; | 97 break; |
| 92 | 98 } |
| 93 CPDF_Object* pObj = | 99 CPDF_Object* pObj = |
| 94 pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum()); | 100 pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum()); |
| 95 return pObj ? pObj->GetNumber() : 0; | 101 if (pObj == NULL) { |
| 102 return 0; |
| 103 } |
| 104 return pObj->GetNumber(); |
| 96 } | 105 } |
| 97 } | 106 } |
| 98 return 0; | 107 return 0; |
| 99 } | 108 } |
| 100 FX_FLOAT CPDF_Object::GetNumber16() const { | 109 FX_FLOAT CPDF_Object::GetNumber16() const { |
| 101 return GetNumber(); | 110 return GetNumber(); |
| 102 } | 111 } |
| 103 int CPDF_Object::GetInteger() const { | 112 int CPDF_Object::GetInteger() const { |
| 104 CFX_AutoRestorer<int> restorer(&s_nCurRefDepth); | 113 CFX_AutoRestorer<int> restorer(&s_nCurRefDepth); |
| 105 if (++s_nCurRefDepth > OBJECT_REF_MAX_DEPTH) { | 114 if (++s_nCurRefDepth > OBJECT_REF_MAX_DEPTH) { |
| 106 return 0; | 115 return 0; |
| 107 } | 116 } |
| 108 switch (m_Type) { | 117 switch (m_Type) { |
| 109 case PDFOBJ_BOOLEAN: | 118 case PDFOBJ_BOOLEAN: |
| 110 return AsBoolean()->m_bValue; | 119 return AsBoolean()->m_bValue; |
| 111 case PDFOBJ_NUMBER: | 120 case PDFOBJ_NUMBER: |
| 112 return AsNumber()->GetInteger(); | 121 return AsNumber()->GetInteger(); |
| 113 case PDFOBJ_REFERENCE: { | 122 case PDFOBJ_REFERENCE: { |
| 114 const CPDF_Reference* pRef = AsReference(); | 123 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; |
| 115 PARSE_CONTEXT context; | 124 PARSE_CONTEXT context; |
| 116 FXSYS_memset(&context, 0, sizeof(PARSE_CONTEXT)); | 125 FXSYS_memset(&context, 0, sizeof(PARSE_CONTEXT)); |
| 117 if (!pRef->m_pObjList) | 126 if (pRef->m_pObjList == NULL) { |
| 118 return 0; | 127 return 0; |
| 119 | 128 } |
| 120 CPDF_Object* pObj = | 129 CPDF_Object* pObj = |
| 121 pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum(), &context); | 130 pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum(), &context); |
| 122 return pObj ? pObj->GetInteger() : 0; | 131 if (pObj == NULL) { |
| 132 return 0; |
| 133 } |
| 134 return pObj->GetInteger(); |
| 123 } | 135 } |
| 124 } | 136 } |
| 125 return 0; | 137 return 0; |
| 126 } | 138 } |
| 127 | 139 |
| 128 CPDF_Dictionary* CPDF_Object::GetDict() const { | 140 CPDF_Dictionary* CPDF_Object::GetDict() const { |
| 129 switch (m_Type) { | 141 switch (m_Type) { |
| 130 case PDFOBJ_DICTIONARY: | 142 case PDFOBJ_DICTIONARY: |
| 131 // The method should be made non-const if we want to not be const. | 143 // The method should be made non-const if we want to not be const. |
| 132 // See bug #234. | 144 // See bug #234. |
| 133 return const_cast<CPDF_Dictionary*>(AsDictionary()); | 145 return const_cast<CPDF_Dictionary*>(AsDictionary()); |
| 134 case PDFOBJ_STREAM: | 146 case PDFOBJ_STREAM: |
| 135 return AsStream()->GetDict(); | 147 return AsStream()->GetDict(); |
| 136 case PDFOBJ_REFERENCE: { | 148 case PDFOBJ_REFERENCE: { |
| 137 const CPDF_Reference* pRef = AsReference(); | 149 CPDF_Reference* pRef = (CPDF_Reference*)this; |
| 138 CPDF_IndirectObjects* pIndirect = pRef->GetObjList(); | 150 CPDF_IndirectObjects* pIndirect = pRef->GetObjList(); |
| 139 if (!pIndirect) | 151 if (!pIndirect) |
| 140 return nullptr; | 152 return nullptr; |
| 141 CPDF_Object* pObj = pIndirect->GetIndirectObject(pRef->GetRefObjNum()); | 153 CPDF_Object* pObj = pIndirect->GetIndirectObject(pRef->GetRefObjNum()); |
| 142 if (!pObj || (pObj == this)) | 154 if (!pObj || (pObj == this)) |
| 143 return nullptr; | 155 return nullptr; |
| 144 return pObj->GetDict(); | 156 return pObj->GetDict(); |
| 145 } | 157 } |
| 146 default: | 158 default: |
| 147 return nullptr; | 159 return nullptr; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 165 case PDFOBJ_STRING: | 177 case PDFOBJ_STRING: |
| 166 AsString()->m_String = str; | 178 AsString()->m_String = str; |
| 167 return; | 179 return; |
| 168 case PDFOBJ_NAME: | 180 case PDFOBJ_NAME: |
| 169 AsName()->m_Name = str; | 181 AsName()->m_Name = str; |
| 170 return; | 182 return; |
| 171 } | 183 } |
| 172 ASSERT(FALSE); | 184 ASSERT(FALSE); |
| 173 } | 185 } |
| 174 int CPDF_Object::GetDirectType() const { | 186 int CPDF_Object::GetDirectType() const { |
| 175 const CPDF_Reference* pRef = AsReference(); | 187 if (m_Type != PDFOBJ_REFERENCE) { |
| 176 if (!pRef) | |
| 177 return m_Type; | 188 return m_Type; |
| 189 } |
| 190 CPDF_Reference* pRef = (CPDF_Reference*)this; |
| 178 return pRef->m_pObjList->GetIndirectType(pRef->GetRefObjNum()); | 191 return pRef->m_pObjList->GetIndirectType(pRef->GetRefObjNum()); |
| 179 } | 192 } |
| 180 FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const { | 193 FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const { |
| 181 if (this == pOther) | 194 if (this == pOther) { |
| 182 return TRUE; | 195 return TRUE; |
| 183 if (!pOther) | 196 } |
| 197 if (pOther == NULL) { |
| 184 return FALSE; | 198 return FALSE; |
| 199 } |
| 185 if (pOther->m_Type != m_Type) { | 200 if (pOther->m_Type != m_Type) { |
| 186 if (IsReference() && GetDirect()) | 201 if (m_Type == PDFOBJ_REFERENCE && GetDirect()) { |
| 187 return GetDirect()->IsIdentical(pOther); | 202 return GetDirect()->IsIdentical(pOther); |
| 188 if (pOther->IsReference()) | 203 } |
| 204 if (pOther->m_Type == PDFOBJ_REFERENCE) { |
| 189 return IsIdentical(pOther->GetDirect()); | 205 return IsIdentical(pOther->GetDirect()); |
| 206 } |
| 190 return FALSE; | 207 return FALSE; |
| 191 } | 208 } |
| 192 switch (m_Type) { | 209 switch (m_Type) { |
| 193 case PDFOBJ_BOOLEAN: | 210 case PDFOBJ_BOOLEAN: |
| 194 return AsBoolean()->Identical(pOther->AsBoolean()); | 211 return AsBoolean()->Identical(pOther->AsBoolean()); |
| 195 case PDFOBJ_NUMBER: | 212 case PDFOBJ_NUMBER: |
| 196 return AsNumber()->Identical(pOther->AsNumber()); | 213 return AsNumber()->Identical(pOther->AsNumber()); |
| 197 case PDFOBJ_STRING: | 214 case PDFOBJ_STRING: |
| 198 return AsString()->Identical(pOther->AsString()); | 215 return AsString()->Identical(pOther->AsString()); |
| 199 case PDFOBJ_NAME: | 216 case PDFOBJ_NAME: |
| 200 return AsName()->Identical(pOther->AsName()); | 217 return AsName()->Identical(pOther->AsName()); |
| 201 case PDFOBJ_ARRAY: | 218 case PDFOBJ_ARRAY: |
| 202 return AsArray()->Identical(pOther->AsArray()); | 219 return AsArray()->Identical(pOther->AsArray()); |
| 203 case PDFOBJ_DICTIONARY: | 220 case PDFOBJ_DICTIONARY: |
| 204 return AsDictionary()->Identical(pOther->AsDictionary()); | 221 return AsDictionary()->Identical(pOther->AsDictionary()); |
| 205 case PDFOBJ_NULL: | 222 case PDFOBJ_NULL: |
| 206 return TRUE; | 223 return TRUE; |
| 207 case PDFOBJ_STREAM: | 224 case PDFOBJ_STREAM: |
| 208 return AsStream()->Identical(pOther->AsStream()); | 225 return AsStream()->Identical(pOther->AsStream()); |
| 209 case PDFOBJ_REFERENCE: | 226 case PDFOBJ_REFERENCE: |
| 210 return AsReference()->Identical(pOther->AsReference()); | 227 return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther)); |
| 211 } | 228 } |
| 212 return FALSE; | 229 return FALSE; |
| 213 } | 230 } |
| 214 CPDF_Object* CPDF_Object::GetDirect() const { | 231 CPDF_Object* CPDF_Object::GetDirect() const { |
| 215 const CPDF_Reference* pRef = AsReference(); | 232 if (m_Type != PDFOBJ_REFERENCE) { |
| 216 if (!pRef) | 233 return (CPDF_Object*)this; |
| 217 return const_cast<CPDF_Object*>(this); | 234 } |
| 218 if (!pRef->m_pObjList) | 235 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; |
| 219 return nullptr; | 236 if (pRef->m_pObjList == NULL) { |
| 237 return NULL; |
| 238 } |
| 220 return pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum()); | 239 return pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum()); |
| 221 } | 240 } |
| 222 CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const { | 241 CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const { |
| 223 CFX_MapPtrToPtr visited; | 242 CFX_MapPtrToPtr visited; |
| 224 return CloneInternal(bDirect, &visited); | 243 return CloneInternal(bDirect, &visited); |
| 225 } | 244 } |
| 226 CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, | 245 CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, |
| 227 CFX_MapPtrToPtr* visited) const { | 246 CFX_MapPtrToPtr* visited) const { |
| 228 switch (m_Type) { | 247 switch (m_Type) { |
| 229 case PDFOBJ_BOOLEAN: | 248 case PDFOBJ_BOOLEAN: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 CPDF_StreamAcc acc; | 288 CPDF_StreamAcc acc; |
| 270 acc.LoadAllData(pThis, TRUE); | 289 acc.LoadAllData(pThis, TRUE); |
| 271 FX_DWORD streamSize = acc.GetSize(); | 290 FX_DWORD streamSize = acc.GetSize(); |
| 272 CPDF_Dictionary* pDict = pThis->GetDict(); | 291 CPDF_Dictionary* pDict = pThis->GetDict(); |
| 273 if (pDict) { | 292 if (pDict) { |
| 274 pDict = ToDictionary(pDict->CloneInternal(bDirect, visited)); | 293 pDict = ToDictionary(pDict->CloneInternal(bDirect, visited)); |
| 275 } | 294 } |
| 276 return new CPDF_Stream(acc.DetachData(), streamSize, pDict); | 295 return new CPDF_Stream(acc.DetachData(), streamSize, pDict); |
| 277 } | 296 } |
| 278 case PDFOBJ_REFERENCE: { | 297 case PDFOBJ_REFERENCE: { |
| 279 const CPDF_Reference* pRef = AsReference(); | 298 CPDF_Reference* pRef = (CPDF_Reference*)this; |
| 280 FX_DWORD obj_num = pRef->GetRefObjNum(); | 299 FX_DWORD obj_num = pRef->GetRefObjNum(); |
| 281 if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) { | 300 if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) { |
| 282 visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); | 301 visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); |
| 283 if (!pRef->GetDirect()) | 302 if (!pRef->GetDirect()) |
| 284 return nullptr; | 303 return nullptr; |
| 285 | 304 |
| 286 return pRef->GetDirect()->CloneInternal(TRUE, visited); | 305 return pRef->GetDirect()->CloneInternal(TRUE, visited); |
| 287 } | 306 } |
| 288 return new CPDF_Reference(pRef->m_pObjList, obj_num); | 307 return new CPDF_Reference(pRef->m_pObjList, obj_num); |
| 289 } | 308 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 373 } |
| 355 | 374 |
| 356 CPDF_Number* CPDF_Object::AsNumber() { | 375 CPDF_Number* CPDF_Object::AsNumber() { |
| 357 return IsNumber() ? static_cast<CPDF_Number*>(this) : nullptr; | 376 return IsNumber() ? static_cast<CPDF_Number*>(this) : nullptr; |
| 358 } | 377 } |
| 359 | 378 |
| 360 const CPDF_Number* CPDF_Object::AsNumber() const { | 379 const CPDF_Number* CPDF_Object::AsNumber() const { |
| 361 return IsNumber() ? static_cast<const CPDF_Number*>(this) : nullptr; | 380 return IsNumber() ? static_cast<const CPDF_Number*>(this) : nullptr; |
| 362 } | 381 } |
| 363 | 382 |
| 364 CPDF_Reference* CPDF_Object::AsReference() { | |
| 365 return IsReference() ? static_cast<CPDF_Reference*>(this) : nullptr; | |
| 366 } | |
| 367 | |
| 368 const CPDF_Reference* CPDF_Object::AsReference() const { | |
| 369 return IsReference() ? static_cast<const CPDF_Reference*>(this) : nullptr; | |
| 370 } | |
| 371 | |
| 372 CPDF_Stream* CPDF_Object::AsStream() { | 383 CPDF_Stream* CPDF_Object::AsStream() { |
| 373 return IsStream() ? static_cast<CPDF_Stream*>(this) : nullptr; | 384 return IsStream() ? static_cast<CPDF_Stream*>(this) : nullptr; |
| 374 } | 385 } |
| 375 | 386 |
| 376 const CPDF_Stream* CPDF_Object::AsStream() const { | 387 const CPDF_Stream* CPDF_Object::AsStream() const { |
| 377 return IsStream() ? static_cast<const CPDF_Stream*>(this) : nullptr; | 388 return IsStream() ? static_cast<const CPDF_Stream*>(this) : nullptr; |
| 378 } | 389 } |
| 379 | 390 |
| 380 CPDF_String* CPDF_Object::AsString() { | 391 CPDF_String* CPDF_Object::AsString() { |
| 381 return IsString() ? static_cast<CPDF_String*>(this) : nullptr; | 392 return IsString() ? static_cast<CPDF_String*>(this) : nullptr; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 m_Map.Lookup(key, (void*&)p); | 632 m_Map.Lookup(key, (void*&)p); |
| 622 if (p) { | 633 if (p) { |
| 623 return p->GetConstString(); | 634 return p->GetConstString(); |
| 624 } | 635 } |
| 625 return CFX_ByteStringC(); | 636 return CFX_ByteStringC(); |
| 626 } | 637 } |
| 627 CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key, | 638 CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key, |
| 628 CFX_CharMap* pCharMap) const { | 639 CFX_CharMap* pCharMap) const { |
| 629 CPDF_Object* p = NULL; | 640 CPDF_Object* p = NULL; |
| 630 m_Map.Lookup(key, (void*&)p); | 641 m_Map.Lookup(key, (void*&)p); |
| 631 if (CPDF_Reference* pRef = ToReference(p)) | 642 if (p) { |
| 632 p = pRef->GetDirect(); | 643 if (p->GetType() == PDFOBJ_REFERENCE) { |
| 633 return p ? p->GetUnicodeText(pCharMap) : CFX_WideString(); | 644 p = ((CPDF_Reference*)p)->GetDirect(); |
| 645 if (p) { |
| 646 return p->GetUnicodeText(pCharMap); |
| 647 } |
| 648 } else { |
| 649 return p->GetUnicodeText(pCharMap); |
| 650 } |
| 651 } |
| 652 return CFX_WideString(); |
| 634 } | 653 } |
| 635 CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key, | 654 CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key, |
| 636 const CFX_ByteStringC& def) const { | 655 const CFX_ByteStringC& def) const { |
| 637 CPDF_Object* p = NULL; | 656 CPDF_Object* p = NULL; |
| 638 m_Map.Lookup(key, (void*&)p); | 657 m_Map.Lookup(key, (void*&)p); |
| 639 if (p) { | 658 if (p) { |
| 640 return p->GetString(); | 659 return p->GetString(); |
| 641 } | 660 } |
| 642 return CFX_ByteString(def); | 661 return CFX_ByteString(def); |
| 643 } | 662 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 } | 714 } |
| 696 CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const { | 715 CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const { |
| 697 return ToArray(GetElementValue(key)); | 716 return ToArray(GetElementValue(key)); |
| 698 } | 717 } |
| 699 CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const { | 718 CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const { |
| 700 return ToStream(GetElementValue(key)); | 719 return ToStream(GetElementValue(key)); |
| 701 } | 720 } |
| 702 CFX_FloatRect CPDF_Dictionary::GetRect(const CFX_ByteStringC& key) const { | 721 CFX_FloatRect CPDF_Dictionary::GetRect(const CFX_ByteStringC& key) const { |
| 703 CFX_FloatRect rect; | 722 CFX_FloatRect rect; |
| 704 CPDF_Array* pArray = GetArray(key); | 723 CPDF_Array* pArray = GetArray(key); |
| 705 if (pArray) | 724 if (pArray) { |
| 706 rect = pArray->GetRect(); | 725 rect = pArray->GetRect(); |
| 726 } |
| 707 return rect; | 727 return rect; |
| 708 } | 728 } |
| 709 CFX_AffineMatrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const { | 729 CFX_AffineMatrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const { |
| 710 CFX_AffineMatrix matrix; | 730 CFX_AffineMatrix matrix; |
| 711 CPDF_Array* pArray = GetArray(key); | 731 CPDF_Array* pArray = GetArray(key); |
| 712 if (pArray) | 732 if (pArray) { |
| 713 matrix = pArray->GetMatrix(); | 733 matrix = pArray->GetMatrix(); |
| 734 } |
| 714 return matrix; | 735 return matrix; |
| 715 } | 736 } |
| 716 FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { | 737 FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { |
| 717 void* value; | 738 void* value; |
| 718 return m_Map.Lookup(key, value); | 739 return m_Map.Lookup(key, value); |
| 719 } | 740 } |
| 720 void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, | 741 void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, |
| 721 CPDF_Object* pObj, | 742 CPDF_Object* pObj, |
| 722 CPDF_IndirectObjects* pObjs) { | 743 CPDF_IndirectObjects* pObjs) { |
| 723 ASSERT(m_Type == PDFOBJ_DICTIONARY); | 744 ASSERT(m_Type == PDFOBJ_DICTIONARY); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 } | 1230 } |
| 1210 pObj->m_ObjNum = objnum; | 1231 pObj->m_ObjNum = objnum; |
| 1211 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); | 1232 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); |
| 1212 if (m_LastObjNum < objnum) { | 1233 if (m_LastObjNum < objnum) { |
| 1213 m_LastObjNum = objnum; | 1234 m_LastObjNum = objnum; |
| 1214 } | 1235 } |
| 1215 } | 1236 } |
| 1216 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { | 1237 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { |
| 1217 return m_LastObjNum; | 1238 return m_LastObjNum; |
| 1218 } | 1239 } |
| OLD | NEW |