Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 case PDFOBJ_DICTIONARY: | 32 case PDFOBJ_DICTIONARY: |
| 33 delete (CPDF_Dictionary*)this; | 33 delete (CPDF_Dictionary*)this; |
| 34 break; | 34 break; |
| 35 case PDFOBJ_STREAM: | 35 case PDFOBJ_STREAM: |
| 36 delete (CPDF_Stream*)this; | 36 delete (CPDF_Stream*)this; |
| 37 break; | 37 break; |
| 38 default: | 38 default: |
| 39 delete this; | 39 delete this; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | |
| 42 CFX_ByteString CPDF_Object::GetString() const | 43 CFX_ByteString CPDF_Object::GetString() const |
| 43 { | 44 { |
| 44 switch (m_Type) { | |
| 45 case PDFOBJ_BOOLEAN: | |
| 46 return ((CPDF_Boolean*)this)->m_bValue ? "true" : "false"; | |
| 47 case PDFOBJ_NUMBER: | |
| 48 return ((CPDF_Number*)this)->GetString(); | |
| 49 case PDFOBJ_STRING: | |
| 50 return ((CPDF_String*)this)->m_String; | |
| 51 case PDFOBJ_NAME: | |
| 52 return ((CPDF_Name*)this)->m_Name; | |
| 53 case PDFOBJ_REFERENCE: { | |
| 54 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; | |
| 55 if (pRef->m_pObjList == NULL) { | |
| 56 break; | |
| 57 } | |
| 58 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum); | |
| 59 if (pObj == NULL) { | |
| 60 return CFX_ByteString(); | |
| 61 } | |
| 62 return pObj->GetString(); | |
| 63 } | |
| 64 } | |
| 65 return CFX_ByteString(); | 45 return CFX_ByteString(); |
| 66 } | 46 } |
| 47 | |
| 67 CFX_ByteStringC CPDF_Object::GetConstString() const | 48 CFX_ByteStringC CPDF_Object::GetConstString() const |
| 68 { | 49 { |
| 69 switch (m_Type) { | 50 switch (m_Type) { |
| 70 case PDFOBJ_STRING: | 51 case PDFOBJ_STRING: |
| 71 return CFX_ByteStringC((const uint8_t*)((CPDF_String*)this)->m_Strin g, ((CPDF_String*)this)->m_String.GetLength()); | 52 return CFX_ByteStringC((const uint8_t*)((CPDF_String*)this)->m_Strin g, ((CPDF_String*)this)->m_String.GetLength()); |
| 72 case PDFOBJ_NAME: | 53 case PDFOBJ_NAME: |
| 73 return CFX_ByteStringC((const uint8_t*)((CPDF_Name*)this)->m_Name, ( (CPDF_Name*)this)->m_Name.GetLength()); | 54 return CFX_ByteStringC((const uint8_t*)((CPDF_Name*)this)->m_Name, ( (CPDF_Name*)this)->m_Name.GetLength()); |
| 74 case PDFOBJ_REFERENCE: { | 55 case PDFOBJ_REFERENCE: { |
| 75 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; | 56 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; |
| 76 if (pRef->m_pObjList == NULL) { | 57 if (pRef->m_pObjList == NULL) { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) | 315 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) |
| 335 { | 316 { |
| 336 if (m_Type == PDFOBJ_STRING) { | 317 if (m_Type == PDFOBJ_STRING) { |
| 337 ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); | 318 ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); |
| 338 } else if (m_Type == PDFOBJ_STREAM) { | 319 } else if (m_Type == PDFOBJ_STREAM) { |
| 339 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); | 320 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); |
| 340 ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength (), FALSE, FALSE); | 321 ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength (), FALSE, FALSE); |
| 341 } | 322 } |
| 342 } | 323 } |
| 343 | 324 |
| 325 CFX_ByteString CPDF_Boolean::GetString() const | |
| 326 { | |
| 327 return m_bValue ? "true" : "false"; | |
| 328 } | |
| 329 | |
| 344 CPDF_Number::CPDF_Number(int value) | 330 CPDF_Number::CPDF_Number(int value) |
| 345 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(TRUE), m_Integer(value) { | 331 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(TRUE), m_Integer(value) { |
| 346 } | 332 } |
| 347 | 333 |
| 348 CPDF_Number::CPDF_Number(FX_FLOAT value) | 334 CPDF_Number::CPDF_Number(FX_FLOAT value) |
| 349 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(FALSE), m_Float(value) { | 335 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(FALSE), m_Float(value) { |
| 350 } | 336 } |
| 351 | 337 |
| 352 CPDF_Number::CPDF_Number(FX_BOOL bInteger, void* pData) | 338 CPDF_Number::CPDF_Number(FX_BOOL bInteger, void* pData) |
| 353 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData) { | 339 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 370 return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer, FXFORMAT_SIGNED ) : CFX_ByteString::FormatFloat(m_Float); | 356 return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer, FXFORMAT_SIGNED ) : CFX_ByteString::FormatFloat(m_Float); |
| 371 } | 357 } |
| 372 void CPDF_Number::SetNumber(FX_FLOAT value) | 358 void CPDF_Number::SetNumber(FX_FLOAT value) |
| 373 { | 359 { |
| 374 m_bInteger = FALSE; | 360 m_bInteger = FALSE; |
| 375 m_Float = value; | 361 m_Float = value; |
| 376 } | 362 } |
| 377 CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING) , m_bHex(FALSE) { | 363 CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING) , m_bHex(FALSE) { |
| 378 m_String = PDF_EncodeText(str); | 364 m_String = PDF_EncodeText(str); |
| 379 } | 365 } |
| 366 | |
| 367 CFX_ByteString CPDF_String::GetString() const | |
| 368 { | |
| 369 return m_String; | |
| 370 } | |
| 371 | |
| 372 CFX_ByteString CPDF_Name::GetString() const | |
| 373 { | |
| 374 return m_Name; | |
| 375 } | |
| 376 | |
| 380 CPDF_Array::~CPDF_Array() | 377 CPDF_Array::~CPDF_Array() |
| 381 { | 378 { |
| 382 int size = m_Objects.GetSize(); | 379 int size = m_Objects.GetSize(); |
| 383 CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); | 380 CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); |
| 384 for (int i = 0; i < size; i ++) { | 381 for (int i = 0; i < size; i ++) { |
| 385 if (pList[i]) | 382 if (pList[i]) |
| 386 pList[i]->Release(); | 383 pList[i]->Release(); |
| 387 } | 384 } |
| 388 } | 385 } |
| 389 CFX_FloatRect CPDF_Array::GetRect() | 386 CFX_FloatRect CPDF_Array::GetRect() |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 412 if (i >= (FX_DWORD)m_Objects.GetSize()) { | 409 if (i >= (FX_DWORD)m_Objects.GetSize()) { |
| 413 return NULL; | 410 return NULL; |
| 414 } | 411 } |
| 415 return (CPDF_Object*)m_Objects.GetAt(i); | 412 return (CPDF_Object*)m_Objects.GetAt(i); |
| 416 } | 413 } |
| 417 CPDF_Object* CPDF_Array::GetElementValue(FX_DWORD i) const | 414 CPDF_Object* CPDF_Array::GetElementValue(FX_DWORD i) const |
| 418 { | 415 { |
| 419 if (i >= (FX_DWORD)m_Objects.GetSize()) { | 416 if (i >= (FX_DWORD)m_Objects.GetSize()) { |
| 420 return NULL; | 417 return NULL; |
| 421 } | 418 } |
| 422 return ((CPDF_Object*)m_Objects.GetAt(i))->GetDirect(); | 419 return ((CPDF_Object*)m_Objects.GetAt(i))->GetDirect(); |
|
Tom Sepez
2015/07/16 20:24:46
Given that m_Objects is of type CFX_PtrArray, and
| |
| 423 } | 420 } |
| 424 CFX_ByteString CPDF_Array::GetString(FX_DWORD i) const | 421 CFX_ByteString CPDF_Array::GetStringAt(FX_DWORD i) const |
| 425 { | 422 { |
| 426 if (i < (FX_DWORD)m_Objects.GetSize()) { | 423 if (i < (FX_DWORD)m_Objects.GetSize()) { |
| 427 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); | 424 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); |
|
Tom Sepez
2015/07/16 20:24:46
nit: I'd really like this block to be a one-liner,
| |
| 428 return p->GetString(); | 425 return p->GetString(); |
| 429 } | 426 } |
| 430 else | 427 return CFX_ByteString(); |
| 431 return CFX_ByteString(); | |
| 432 } | 428 } |
| 433 CFX_ByteStringC CPDF_Array::GetConstString(FX_DWORD i) const | 429 CFX_ByteStringC CPDF_Array::GetConstString(FX_DWORD i) const |
| 434 { | 430 { |
| 435 if (i < (FX_DWORD)m_Objects.GetSize()) { | 431 if (i < (FX_DWORD)m_Objects.GetSize()) { |
| 436 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); | 432 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); |
| 437 return p->GetConstString(); | 433 return p->GetConstString(); |
| 438 } | 434 } |
| 439 else | 435 return CFX_ByteStringC(); |
| 440 return CFX_ByteStringC(); | |
| 441 } | 436 } |
| 442 int CPDF_Array::GetInteger(FX_DWORD i) const | 437 int CPDF_Array::GetInteger(FX_DWORD i) const |
| 443 { | 438 { |
| 444 if (i >= (FX_DWORD)m_Objects.GetSize()) { | 439 if (i >= (FX_DWORD)m_Objects.GetSize()) { |
| 445 return 0; | 440 return 0; |
| 446 } | 441 } |
| 447 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); | 442 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); |
| 448 return p->GetInteger(); | 443 return p->GetInteger(); |
| 449 } | 444 } |
| 450 FX_FLOAT CPDF_Array::GetNumber(FX_DWORD i) const | 445 FX_FLOAT CPDF_Array::GetNumber(FX_DWORD i) const |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 { | 554 { |
| 560 if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { | 555 if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { |
| 561 return FALSE; | 556 return FALSE; |
| 562 } | 557 } |
| 563 for (int i = 0; i < m_Objects.GetSize(); i ++) | 558 for (int i = 0; i < m_Objects.GetSize(); i ++) |
| 564 if (!((CPDF_Object*)m_Objects[i])->IsIdentical((CPDF_Object*)pOther->m_O bjects[i])) { | 559 if (!((CPDF_Object*)m_Objects[i])->IsIdentical((CPDF_Object*)pOther->m_O bjects[i])) { |
| 565 return FALSE; | 560 return FALSE; |
| 566 } | 561 } |
| 567 return TRUE; | 562 return TRUE; |
| 568 } | 563 } |
| 564 | |
| 569 CPDF_Dictionary::~CPDF_Dictionary() | 565 CPDF_Dictionary::~CPDF_Dictionary() |
| 570 { | 566 { |
| 571 FX_POSITION pos = m_Map.GetStartPosition(); | 567 FX_POSITION pos = m_Map.GetStartPosition(); |
| 572 while (pos) { | 568 while (pos) { |
| 573 void* value = m_Map.GetNextValue(pos); | 569 void* value = m_Map.GetNextValue(pos); |
| 574 if (value) | 570 if (value) |
| 575 ((CPDF_Object*)value)->Release(); | 571 ((CPDF_Object*)value)->Release(); |
| 576 } | 572 } |
| 577 } | 573 } |
| 578 FX_POSITION CPDF_Dictionary::GetStartPos() const | 574 FX_POSITION CPDF_Dictionary::GetStartPos() const |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 593 CPDF_Object* p = NULL; | 589 CPDF_Object* p = NULL; |
| 594 m_Map.Lookup(key, (void*&)p); | 590 m_Map.Lookup(key, (void*&)p); |
| 595 return p; | 591 return p; |
| 596 } | 592 } |
| 597 CPDF_Object* CPDF_Dictionary::GetElementValue(const CFX_ByteStringC& key) const | 593 CPDF_Object* CPDF_Dictionary::GetElementValue(const CFX_ByteStringC& key) const |
| 598 { | 594 { |
| 599 CPDF_Object* p = NULL; | 595 CPDF_Object* p = NULL; |
| 600 m_Map.Lookup(key, (void*&)p); | 596 m_Map.Lookup(key, (void*&)p); |
| 601 return p ? p->GetDirect() : NULL; | 597 return p ? p->GetDirect() : NULL; |
| 602 } | 598 } |
| 603 CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key) const | 599 CFX_ByteString CPDF_Dictionary::GetStringAt(const CFX_ByteStringC& key) const |
| 604 { | 600 { |
| 605 CPDF_Object* p = NULL; | 601 CPDF_Object* p = NULL; |
| 606 m_Map.Lookup(key, (void*&)p); | 602 m_Map.Lookup(key, (void*&)p); |
| 607 if (p) | 603 if (p) |
| 608 return p->GetString(); | 604 return p->GetString(); |
| 609 else | 605 else |
|
Tom Sepez
2015/07/16 20:24:46
nit: else after return.
| |
| 610 return CFX_ByteString(); | 606 return CFX_ByteString(); |
| 611 } | 607 } |
| 612 CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key) cons t | 608 CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key) cons t |
| 613 { | 609 { |
| 614 CPDF_Object* p = NULL; | 610 CPDF_Object* p = NULL; |
| 615 m_Map.Lookup(key, (void*&)p); | 611 m_Map.Lookup(key, (void*&)p); |
| 616 if (p) | 612 if (p) |
| 617 return p->GetConstString(); | 613 return p->GetConstString(); |
| 618 else | 614 else |
| 619 return CFX_ByteStringC(); | 615 return CFX_ByteStringC(); |
| 620 } | 616 } |
| 621 CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key, CFX_C harMap* pCharMap) const | 617 CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key, CFX_C harMap* pCharMap) const |
| 622 { | 618 { |
| 623 CPDF_Object* p = NULL; | 619 CPDF_Object* p = NULL; |
| 624 m_Map.Lookup(key, (void*&)p); | 620 m_Map.Lookup(key, (void*&)p); |
| 625 if (p) { | 621 if (p) { |
| 626 if(p->GetType() == PDFOBJ_REFERENCE) { | 622 if(p->GetType() == PDFOBJ_REFERENCE) { |
| 627 p = ((CPDF_Reference*)p)->GetDirect(); | 623 p = ((CPDF_Reference*)p)->GetDirect(); |
| 628 if (p) { | 624 if (p) { |
| 629 return p->GetUnicodeText(pCharMap); | 625 return p->GetUnicodeText(pCharMap); |
| 630 } | 626 } |
| 631 } else { | 627 } else { |
| 632 return p->GetUnicodeText(pCharMap); | 628 return p->GetUnicodeText(pCharMap); |
| 633 } | 629 } |
| 634 } | 630 } |
| 635 return CFX_WideString(); | 631 return CFX_WideString(); |
| 636 } | 632 } |
| 637 CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key, const CFX_ ByteStringC& def) const | 633 CFX_ByteString CPDF_Dictionary::GetStringAt(const CFX_ByteStringC& key, |
| 634 const CFX_ByteStringC& def) const | |
| 638 { | 635 { |
| 639 CPDF_Object* p = NULL; | 636 CPDF_Object* p = NULL; |
| 640 m_Map.Lookup(key, (void*&)p); | 637 m_Map.Lookup(key, (void*&)p); |
| 641 if (p) { | 638 if (p) { |
| 642 return p->GetString(); | 639 return p->GetString(); |
| 643 } | 640 } |
| 644 return CFX_ByteString(def); | 641 return CFX_ByteString(def); |
| 645 } | 642 } |
| 646 CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key, cons t CFX_ByteStringC& def) const | 643 CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key, cons t CFX_ByteStringC& def) const |
| 647 { | 644 { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 850 { | 847 { |
| 851 CPDF_Array* pArray = new CPDF_Array; | 848 CPDF_Array* pArray = new CPDF_Array; |
| 852 pArray->AddNumber16(matrix.a); | 849 pArray->AddNumber16(matrix.a); |
| 853 pArray->AddNumber16(matrix.b); | 850 pArray->AddNumber16(matrix.b); |
| 854 pArray->AddNumber16(matrix.c); | 851 pArray->AddNumber16(matrix.c); |
| 855 pArray->AddNumber16(matrix.d); | 852 pArray->AddNumber16(matrix.d); |
| 856 pArray->AddNumber(matrix.e); | 853 pArray->AddNumber(matrix.e); |
| 857 pArray->AddNumber(matrix.f); | 854 pArray->AddNumber(matrix.f); |
| 858 SetAt(key, pArray); | 855 SetAt(key, pArray); |
| 859 } | 856 } |
| 857 | |
| 860 CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) | 858 CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) |
| 861 : CPDF_Object(PDFOBJ_STREAM) { | 859 : CPDF_Object(PDFOBJ_STREAM) { |
| 862 m_pDict = pDict; | 860 m_pDict = pDict; |
| 863 m_dwSize = size; | 861 m_dwSize = size; |
| 864 m_GenNum = (FX_DWORD) - 1; | 862 m_GenNum = (FX_DWORD) - 1; |
| 865 m_pDataBuf = pData; | 863 m_pDataBuf = pData; |
| 866 m_pCryptoHandler = NULL; | 864 m_pCryptoHandler = NULL; |
| 867 } | 865 } |
| 868 CPDF_Stream::~CPDF_Stream() | 866 CPDF_Stream::~CPDF_Stream() |
| 869 { | 867 { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1120 } | 1118 } |
| 1121 if (pSrcData != pStream->m_pDataBuf && pSrcData != m_pData) { | 1119 if (pSrcData != pStream->m_pDataBuf && pSrcData != m_pData) { |
| 1122 FX_Free(pSrcData); | 1120 FX_Free(pSrcData); |
| 1123 } | 1121 } |
| 1124 if (pDecryptedData != pSrcData && pDecryptedData != m_pData) { | 1122 if (pDecryptedData != pSrcData && pDecryptedData != m_pData) { |
| 1125 FX_Free(pDecryptedData); | 1123 FX_Free(pDecryptedData); |
| 1126 } | 1124 } |
| 1127 m_pSrcData = NULL; | 1125 m_pSrcData = NULL; |
| 1128 m_bNewBuf = m_pData != pStream->m_pDataBuf; | 1126 m_bNewBuf = m_pData != pStream->m_pDataBuf; |
| 1129 } | 1127 } |
| 1128 | |
| 1130 CPDF_StreamAcc::~CPDF_StreamAcc() | 1129 CPDF_StreamAcc::~CPDF_StreamAcc() |
| 1131 { | 1130 { |
| 1132 if (m_bNewBuf && m_pData) { | 1131 if (m_bNewBuf && m_pData) { |
| 1133 FX_Free(m_pData); | 1132 FX_Free(m_pData); |
| 1134 } | 1133 } |
| 1135 if (m_pSrcData) { | 1134 if (m_pSrcData) { |
| 1136 FX_Free(m_pSrcData); | 1135 FX_Free(m_pSrcData); |
| 1137 } | 1136 } |
| 1138 } | 1137 } |
| 1139 const uint8_t* CPDF_StreamAcc::GetData() const | 1138 const uint8_t* CPDF_StreamAcc::GetData() const |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1166 } | 1165 } |
| 1167 uint8_t* p = FX_Alloc(uint8_t, m_dwSize); | 1166 uint8_t* p = FX_Alloc(uint8_t, m_dwSize); |
| 1168 FXSYS_memcpy(p, m_pData, m_dwSize); | 1167 FXSYS_memcpy(p, m_pData, m_dwSize); |
| 1169 return p; | 1168 return p; |
| 1170 } | 1169 } |
| 1171 void CPDF_Reference::SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) | 1170 void CPDF_Reference::SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) |
| 1172 { | 1171 { |
| 1173 m_pObjList = pDoc; | 1172 m_pObjList = pDoc; |
| 1174 m_RefObjNum = objnum; | 1173 m_RefObjNum = objnum; |
| 1175 } | 1174 } |
| 1175 | |
| 1176 CFX_ByteString CPDF_Reference::GetString() const | |
| 1177 { | |
| 1178 if (m_pObjList) { | |
| 1179 CPDF_Object* pObj = m_pObjList->GetIndirectObject(m_RefObjNum); | |
| 1180 if (pObj) | |
| 1181 return pObj->GetString(); | |
| 1182 } | |
| 1183 return CFX_ByteString(); | |
| 1184 } | |
| 1185 | |
| 1176 CPDF_IndirectObjects::CPDF_IndirectObjects(CPDF_Parser* pParser) | 1186 CPDF_IndirectObjects::CPDF_IndirectObjects(CPDF_Parser* pParser) |
| 1177 { | 1187 { |
| 1178 m_pParser = pParser; | 1188 m_pParser = pParser; |
| 1179 m_IndirectObjs.InitHashTable(1013); | 1189 m_IndirectObjs.InitHashTable(1013); |
| 1180 if (pParser) { | 1190 if (pParser) { |
| 1181 m_LastObjNum = m_pParser->GetLastObjNum(); | 1191 m_LastObjNum = m_pParser->GetLastObjNum(); |
| 1182 } else { | 1192 } else { |
| 1183 m_LastObjNum = 0; | 1193 m_LastObjNum = 0; |
| 1184 } | 1194 } |
| 1185 } | 1195 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 pObj->m_ObjNum = objnum; | 1290 pObj->m_ObjNum = objnum; |
| 1281 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); | 1291 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); |
| 1282 if (m_LastObjNum < objnum) { | 1292 if (m_LastObjNum < objnum) { |
| 1283 m_LastObjNum = objnum; | 1293 m_LastObjNum = objnum; |
| 1284 } | 1294 } |
| 1285 } | 1295 } |
| 1286 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const | 1296 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const |
| 1287 { | 1297 { |
| 1288 return m_LastObjNum; | 1298 return m_LastObjNum; |
| 1289 } | 1299 } |
| OLD | NEW |