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