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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 } | 153 } |
| 154 return pObj->GetDict(); | 154 return pObj->GetDict(); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 return NULL; | 157 return NULL; |
| 158 } | 158 } |
| 159 CPDF_Array* CPDF_Object::GetArray() const | 159 CPDF_Array* CPDF_Object::GetArray() const |
| 160 { | 160 { |
| 161 if (m_Type == PDFOBJ_ARRAY) | 161 if (m_Type == PDFOBJ_ARRAY) |
| 162 return (CPDF_Array*)this; | 162 return (CPDF_Array*)this; |
| 163 else | 163 |
| 164 return NULL; | 164 return NULL; |
| 165 } | 165 } |
| 166 void CPDF_Object::SetString(const CFX_ByteString& str) | 166 void CPDF_Object::SetString(const CFX_ByteString& str) |
| 167 { | 167 { |
| 168 ASSERT(this != NULL); | 168 ASSERT(this != NULL); |
| 169 switch (m_Type) { | 169 switch (m_Type) { |
| 170 case PDFOBJ_BOOLEAN: | 170 case PDFOBJ_BOOLEAN: |
| 171 ((CPDF_Boolean*)this)->m_bValue = str == FX_BSTRC("true") ? 1 : 0; | 171 ((CPDF_Boolean*)this)->m_bValue = str == FX_BSTRC("true") ? 1 : 0; |
| 172 return; | 172 return; |
| 173 case PDFOBJ_NUMBER: | 173 case PDFOBJ_NUMBER: |
| 174 ((CPDF_Number*)this)->SetString(str); | 174 ((CPDF_Number*)this)->SetString(str); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 194 { | 194 { |
| 195 if (this == pOther) { | 195 if (this == pOther) { |
| 196 return TRUE; | 196 return TRUE; |
| 197 } | 197 } |
| 198 if (pOther == NULL) { | 198 if (pOther == NULL) { |
| 199 return FALSE; | 199 return FALSE; |
| 200 } | 200 } |
| 201 if (pOther->m_Type != m_Type) { | 201 if (pOther->m_Type != m_Type) { |
| 202 if (m_Type == PDFOBJ_REFERENCE && GetDirect()) { | 202 if (m_Type == PDFOBJ_REFERENCE && GetDirect()) { |
| 203 return GetDirect()->IsIdentical(pOther); | 203 return GetDirect()->IsIdentical(pOther); |
| 204 } else if (pOther->m_Type == PDFOBJ_REFERENCE) { | 204 } |
| 205 if (pOther->m_Type == PDFOBJ_REFERENCE) { | |
| 205 return IsIdentical(pOther->GetDirect()); | 206 return IsIdentical(pOther->GetDirect()); |
| 206 } | 207 } |
| 207 return FALSE; | 208 return FALSE; |
| 208 } | 209 } |
| 209 switch (m_Type) { | 210 switch (m_Type) { |
| 210 case PDFOBJ_BOOLEAN: | 211 case PDFOBJ_BOOLEAN: |
| 211 return (((CPDF_Boolean*)this)->Identical((CPDF_Boolean*)pOther)); | 212 return (((CPDF_Boolean*)this)->Identical((CPDF_Boolean*)pOther)); |
| 212 case PDFOBJ_NUMBER: | 213 case PDFOBJ_NUMBER: |
| 213 return (((CPDF_Number*)this)->Identical((CPDF_Number*)pOther)); | 214 return (((CPDF_Number*)this)->Identical((CPDF_Number*)pOther)); |
| 214 case PDFOBJ_STRING: | 215 case PDFOBJ_STRING: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 return pCopy; | 279 return pCopy; |
| 279 } | 280 } |
| 280 case PDFOBJ_NULL: { | 281 case PDFOBJ_NULL: { |
| 281 return new CPDF_Null; | 282 return new CPDF_Null; |
| 282 } | 283 } |
| 283 case PDFOBJ_STREAM: { | 284 case PDFOBJ_STREAM: { |
| 284 CPDF_Stream* pThis = (CPDF_Stream*)this; | 285 CPDF_Stream* pThis = (CPDF_Stream*)this; |
| 285 CPDF_StreamAcc acc; | 286 CPDF_StreamAcc acc; |
| 286 acc.LoadAllData(pThis, TRUE); | 287 acc.LoadAllData(pThis, TRUE); |
| 287 FX_DWORD streamSize = acc.GetSize(); | 288 FX_DWORD streamSize = acc.GetSize(); |
| 288 CPDF_Stream* pObj; | 289 if (!pThis->GetDict()) |
|
Lei Zhang
2015/07/21 23:43:23
Since the two return lines are similar, how about:
Tom Sepez
2015/07/22 20:38:24
Something like that.
| |
| 289 if (pThis->GetDict()) | 290 return new CPDF_Stream(acc.DetachData(), streamSize, NULL); |
| 290 pObj = new CPDF_Stream(acc.DetachData(), streamSize, (CPDF_D ictionary*)((CPDF_Object*)pThis->GetDict())->CloneInternal(bDirect, visited)); | 291 |
| 291 else | 292 return new CPDF_Stream(acc.DetachData(), streamSize, |
| 292 pObj = new CPDF_Stream(acc.DetachData(), streamSize, NULL); | 293 (CPDF_Dictionary*)((CPDF_Object*)pThis->G etDict())->CloneInternal(bDirect, visited)); |
| 293 return pObj; | |
| 294 } | 294 } |
| 295 case PDFOBJ_REFERENCE: { | 295 case PDFOBJ_REFERENCE: { |
| 296 CPDF_Reference* pRef = (CPDF_Reference*)this; | 296 CPDF_Reference* pRef = (CPDF_Reference*)this; |
| 297 FX_DWORD obj_num = pRef->m_RefObjNum; | 297 FX_DWORD obj_num = pRef->m_RefObjNum; |
| 298 if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) { | 298 if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) { |
| 299 visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); | 299 visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); |
| 300 CPDF_Object* ret; | 300 if (!pRef->GetDirect()) |
| 301 if (pRef->GetDirect()) | 301 return nullptr; |
| 302 ret = pRef->GetDirect()->CloneInternal(TRUE, visited); | 302 |
| 303 else | 303 return pRef->GetDirect()->CloneInternal(TRUE, visited); |
| 304 ret = NULL; | |
| 305 return ret; | |
| 306 } else { | |
| 307 return new CPDF_Reference(pRef->m_pObjList, obj_num); | |
| 308 } | 304 } |
| 305 return new CPDF_Reference(pRef->m_pObjList, obj_num); | |
| 309 } | 306 } |
| 310 } | 307 } |
| 311 return NULL; | 308 return NULL; |
| 312 } | 309 } |
| 313 CPDF_Object* CPDF_Object::CloneRef(CPDF_IndirectObjects* pDoc) const | 310 CPDF_Object* CPDF_Object::CloneRef(CPDF_IndirectObjects* pDoc) const |
| 314 { | 311 { |
| 315 if (m_ObjNum) { | 312 if (m_ObjNum) { |
| 316 return new CPDF_Reference(pDoc, m_ObjNum); | 313 return new CPDF_Reference(pDoc, m_ObjNum); |
| 317 } | 314 } |
| 318 return Clone(); | 315 return Clone(); |
| 319 } | 316 } |
| 320 CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const | 317 CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const |
| 321 { | 318 { |
| 322 if (m_Type == PDFOBJ_STRING) { | 319 if (m_Type == PDFOBJ_STRING) { |
| 323 return PDF_DecodeText(((CPDF_String*)this)->m_String, pCharMap); | 320 return PDF_DecodeText(((CPDF_String*)this)->m_String, pCharMap); |
| 324 } else if (m_Type == PDFOBJ_STREAM) { | 321 } |
| 322 if (m_Type == PDFOBJ_STREAM) { | |
| 325 CPDF_StreamAcc stream; | 323 CPDF_StreamAcc stream; |
| 326 stream.LoadAllData((CPDF_Stream*)this, FALSE); | 324 stream.LoadAllData((CPDF_Stream*)this, FALSE); |
| 327 CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize( ), pCharMap); | 325 CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize( ), pCharMap); |
| 328 return result; | 326 return result; |
| 329 } else if (m_Type == PDFOBJ_NAME) { | 327 } |
| 328 if (m_Type == PDFOBJ_NAME) { | |
| 330 return PDF_DecodeText(((CPDF_Name*)this)->m_Name, pCharMap); | 329 return PDF_DecodeText(((CPDF_Name*)this)->m_Name, pCharMap); |
| 331 } | 330 } |
| 332 return CFX_WideString(); | 331 return CFX_WideString(); |
| 333 } | 332 } |
| 334 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) | 333 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) |
| 335 { | 334 { |
| 336 if (m_Type == PDFOBJ_STRING) { | 335 if (m_Type == PDFOBJ_STRING) { |
| 337 ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); | 336 ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); |
| 338 } else if (m_Type == PDFOBJ_STREAM) { | 337 } else if (m_Type == PDFOBJ_STREAM) { |
| 339 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); | 338 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 return NULL; | 419 return NULL; |
| 421 } | 420 } |
| 422 return ((CPDF_Object*)m_Objects.GetAt(i))->GetDirect(); | 421 return ((CPDF_Object*)m_Objects.GetAt(i))->GetDirect(); |
| 423 } | 422 } |
| 424 CFX_ByteString CPDF_Array::GetString(FX_DWORD i) const | 423 CFX_ByteString CPDF_Array::GetString(FX_DWORD i) const |
| 425 { | 424 { |
| 426 if (i < (FX_DWORD)m_Objects.GetSize()) { | 425 if (i < (FX_DWORD)m_Objects.GetSize()) { |
| 427 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); | 426 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); |
| 428 return p->GetString(); | 427 return p->GetString(); |
| 429 } | 428 } |
| 430 else | 429 return CFX_ByteString(); |
| 431 return CFX_ByteString(); | |
| 432 } | 430 } |
| 433 CFX_ByteStringC CPDF_Array::GetConstString(FX_DWORD i) const | 431 CFX_ByteStringC CPDF_Array::GetConstString(FX_DWORD i) const |
| 434 { | 432 { |
| 435 if (i < (FX_DWORD)m_Objects.GetSize()) { | 433 if (i < (FX_DWORD)m_Objects.GetSize()) { |
| 436 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); | 434 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); |
| 437 return p->GetConstString(); | 435 return p->GetConstString(); |
| 438 } | 436 } |
| 439 else | 437 return CFX_ByteStringC(); |
| 440 return CFX_ByteStringC(); | |
| 441 } | 438 } |
| 442 int CPDF_Array::GetInteger(FX_DWORD i) const | 439 int CPDF_Array::GetInteger(FX_DWORD i) const |
| 443 { | 440 { |
| 444 if (i >= (FX_DWORD)m_Objects.GetSize()) { | 441 if (i >= (FX_DWORD)m_Objects.GetSize()) { |
| 445 return 0; | 442 return 0; |
| 446 } | 443 } |
| 447 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); | 444 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); |
| 448 return p->GetInteger(); | 445 return p->GetInteger(); |
| 449 } | 446 } |
| 450 FX_FLOAT CPDF_Array::GetNumber(FX_DWORD i) const | 447 FX_FLOAT CPDF_Array::GetNumber(FX_DWORD i) const |
| 451 { | 448 { |
| 452 if (i >= (FX_DWORD)m_Objects.GetSize()) { | 449 if (i >= (FX_DWORD)m_Objects.GetSize()) { |
| 453 return 0; | 450 return 0; |
| 454 } | 451 } |
| 455 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); | 452 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); |
| 456 return p->GetNumber(); | 453 return p->GetNumber(); |
| 457 } | 454 } |
| 458 CPDF_Dictionary* CPDF_Array::GetDict(FX_DWORD i) const | 455 CPDF_Dictionary* CPDF_Array::GetDict(FX_DWORD i) const |
| 459 { | 456 { |
| 460 CPDF_Object* p = GetElementValue(i); | 457 CPDF_Object* p = GetElementValue(i); |
| 461 if (p == NULL) { | 458 if (!p) { |
| 462 return NULL; | 459 return NULL; |
| 463 } else if (p->GetType() == PDFOBJ_DICTIONARY) { | 460 } |
| 461 if (p->GetType() == PDFOBJ_DICTIONARY) { | |
| 464 return (CPDF_Dictionary*)p; | 462 return (CPDF_Dictionary*)p; |
| 465 } else if (p->GetType() == PDFOBJ_STREAM) { | 463 } |
| 464 if (p->GetType() == PDFOBJ_STREAM) { | |
| 466 return ((CPDF_Stream*)p)->GetDict(); | 465 return ((CPDF_Stream*)p)->GetDict(); |
| 467 } | 466 } |
| 468 return NULL; | 467 return NULL; |
| 469 } | 468 } |
| 470 CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const | 469 CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const |
| 471 { | 470 { |
| 472 CPDF_Object* p = GetElementValue(i); | 471 CPDF_Object* p = GetElementValue(i); |
| 473 if (p == NULL || p->GetType() != PDFOBJ_STREAM) { | 472 if (p == NULL || p->GetType() != PDFOBJ_STREAM) { |
| 474 return NULL; | 473 return NULL; |
| 475 } | 474 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 597 CPDF_Object* CPDF_Dictionary::GetElementValue(const CFX_ByteStringC& key) const | 596 CPDF_Object* CPDF_Dictionary::GetElementValue(const CFX_ByteStringC& key) const |
| 598 { | 597 { |
| 599 CPDF_Object* p = NULL; | 598 CPDF_Object* p = NULL; |
| 600 m_Map.Lookup(key, (void*&)p); | 599 m_Map.Lookup(key, (void*&)p); |
| 601 return p ? p->GetDirect() : NULL; | 600 return p ? p->GetDirect() : NULL; |
| 602 } | 601 } |
| 603 CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key) const | 602 CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key) const |
| 604 { | 603 { |
| 605 CPDF_Object* p = NULL; | 604 CPDF_Object* p = NULL; |
| 606 m_Map.Lookup(key, (void*&)p); | 605 m_Map.Lookup(key, (void*&)p); |
| 607 if (p) | 606 if (p) { |
| 608 return p->GetString(); | 607 return p->GetString(); |
| 609 else | 608 } |
| 610 return CFX_ByteString(); | 609 return CFX_ByteString(); |
| 611 } | 610 } |
| 612 CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key) cons t | 611 CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key) cons t |
| 613 { | 612 { |
| 614 CPDF_Object* p = NULL; | 613 CPDF_Object* p = NULL; |
| 615 m_Map.Lookup(key, (void*&)p); | 614 m_Map.Lookup(key, (void*&)p); |
| 616 if (p) | 615 if (p) { |
| 617 return p->GetConstString(); | 616 return p->GetConstString(); |
| 618 else | 617 } |
| 619 return CFX_ByteStringC(); | 618 return CFX_ByteStringC(); |
| 620 } | 619 } |
| 621 CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key, CFX_C harMap* pCharMap) const | 620 CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key, CFX_C harMap* pCharMap) const |
| 622 { | 621 { |
| 623 CPDF_Object* p = NULL; | 622 CPDF_Object* p = NULL; |
| 624 m_Map.Lookup(key, (void*&)p); | 623 m_Map.Lookup(key, (void*&)p); |
| 625 if (p) { | 624 if (p) { |
| 626 if(p->GetType() == PDFOBJ_REFERENCE) { | 625 if(p->GetType() == PDFOBJ_REFERENCE) { |
| 627 p = ((CPDF_Reference*)p)->GetDirect(); | 626 p = ((CPDF_Reference*)p)->GetDirect(); |
| 628 if (p) { | 627 if (p) { |
| 629 return p->GetUnicodeText(pCharMap); | 628 return p->GetUnicodeText(pCharMap); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 640 m_Map.Lookup(key, (void*&)p); | 639 m_Map.Lookup(key, (void*&)p); |
| 641 if (p) { | 640 if (p) { |
| 642 return p->GetString(); | 641 return p->GetString(); |
| 643 } | 642 } |
| 644 return CFX_ByteString(def); | 643 return CFX_ByteString(def); |
| 645 } | 644 } |
| 646 CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key, cons t CFX_ByteStringC& def) const | 645 CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key, cons t CFX_ByteStringC& def) const |
| 647 { | 646 { |
| 648 CPDF_Object* p = NULL; | 647 CPDF_Object* p = NULL; |
| 649 m_Map.Lookup(key, (void*&)p); | 648 m_Map.Lookup(key, (void*&)p); |
| 650 if (p) | 649 if (p) { |
| 651 return p->GetConstString(); | 650 return p->GetConstString(); |
| 652 else | 651 } |
| 653 return CFX_ByteStringC(def); | 652 return CFX_ByteStringC(def); |
| 654 } | 653 } |
| 655 int CPDF_Dictionary::GetInteger(const CFX_ByteStringC& key) const | 654 int CPDF_Dictionary::GetInteger(const CFX_ByteStringC& key) const |
| 656 { | 655 { |
| 657 CPDF_Object* p = NULL; | 656 CPDF_Object* p = NULL; |
| 658 m_Map.Lookup(key, (void*&)p); | 657 m_Map.Lookup(key, (void*&)p); |
| 659 if (p) { | 658 if (p) { |
| 660 return p->GetInteger(); | 659 return p->GetInteger(); |
| 661 } | 660 } |
| 662 return 0; | 661 return 0; |
| 663 } | 662 } |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 684 CPDF_Object* p = NULL; | 683 CPDF_Object* p = NULL; |
| 685 m_Map.Lookup(key, (void*&)p); | 684 m_Map.Lookup(key, (void*&)p); |
| 686 if (p && p->GetType() == PDFOBJ_BOOLEAN) { | 685 if (p && p->GetType() == PDFOBJ_BOOLEAN) { |
| 687 return p->GetInteger(); | 686 return p->GetInteger(); |
| 688 } | 687 } |
| 689 return bDefault; | 688 return bDefault; |
| 690 } | 689 } |
| 691 CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const | 690 CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const |
| 692 { | 691 { |
| 693 CPDF_Object* p = GetElementValue(key); | 692 CPDF_Object* p = GetElementValue(key); |
| 694 if (p == NULL) { | 693 if (!p) { |
| 695 return NULL; | 694 return nullptr; |
| 696 } else if (p->GetType() == PDFOBJ_DICTIONARY) { | 695 } |
| 696 if (p->GetType() == PDFOBJ_DICTIONARY) { | |
| 697 return (CPDF_Dictionary*)p; | 697 return (CPDF_Dictionary*)p; |
| 698 } else if (p->GetType() == PDFOBJ_STREAM) { | 698 } |
| 699 if (p->GetType() == PDFOBJ_STREAM) { | |
| 699 return ((CPDF_Stream*)p)->GetDict(); | 700 return ((CPDF_Stream*)p)->GetDict(); |
| 700 } | 701 } |
| 701 return NULL; | 702 return nullptr; |
| 702 } | 703 } |
| 703 CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const | 704 CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const |
| 704 { | 705 { |
| 705 CPDF_Object* p = GetElementValue(key); | 706 CPDF_Object* p = GetElementValue(key); |
| 706 if (p == NULL || p->GetType() != PDFOBJ_ARRAY) { | 707 if (p == NULL || p->GetType() != PDFOBJ_ARRAY) { |
| 707 return NULL; | 708 return NULL; |
| 708 } | 709 } |
| 709 return (CPDF_Array*)p; | 710 return (CPDF_Array*)p; |
| 710 } | 711 } |
| 711 CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const | 712 CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1262 ((CPDF_Object*)value)->Destroy(); | 1263 ((CPDF_Object*)value)->Destroy(); |
| 1263 m_IndirectObjs.RemoveKey((void*)(uintptr_t)objnum); | 1264 m_IndirectObjs.RemoveKey((void*)(uintptr_t)objnum); |
| 1264 } | 1265 } |
| 1265 void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO bj) | 1266 void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO bj) |
| 1266 { | 1267 { |
| 1267 if (objnum == 0 || pObj == NULL) { | 1268 if (objnum == 0 || pObj == NULL) { |
| 1268 return; | 1269 return; |
| 1269 } | 1270 } |
| 1270 void* value = NULL; | 1271 void* value = NULL; |
| 1271 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { | 1272 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { |
| 1272 if (value) | 1273 if (value) { |
| 1273 { | 1274 if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum()) { |
| 1274 if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum()) | |
| 1275 return; | 1275 return; |
| 1276 else | 1276 } |
| 1277 ((CPDF_Object*)value)->Destroy(); | 1277 ((CPDF_Object*)value)->Destroy(); |
| 1278 } | 1278 } |
| 1279 } | 1279 } |
| 1280 pObj->m_ObjNum = objnum; | 1280 pObj->m_ObjNum = objnum; |
| 1281 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); | 1281 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); |
| 1282 if (m_LastObjNum < objnum) { | 1282 if (m_LastObjNum < objnum) { |
| 1283 m_LastObjNum = objnum; | 1283 m_LastObjNum = objnum; |
| 1284 } | 1284 } |
| 1285 } | 1285 } |
| 1286 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const | 1286 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const |
| 1287 { | 1287 { |
| 1288 return m_LastObjNum; | 1288 return m_LastObjNum; |
| 1289 } | 1289 } |
| OLD | NEW |