Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_parser.cpp

Issue 2384883003: Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: Remove ScopedDict typedefs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/fpdfapi/fpdf_parser/cpdf_parser.h" 7 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 m_pTrailer(nullptr), 54 m_pTrailer(nullptr),
55 m_pEncryptDict(nullptr), 55 m_pEncryptDict(nullptr),
56 m_bVersionUpdated(false), 56 m_bVersionUpdated(false),
57 m_pLinearized(nullptr), 57 m_pLinearized(nullptr),
58 m_dwFirstPageNo(0), 58 m_dwFirstPageNo(0),
59 m_dwXrefStartObjNum(0) { 59 m_dwXrefStartObjNum(0) {
60 m_pSyntax.reset(new CPDF_SyntaxParser); 60 m_pSyntax.reset(new CPDF_SyntaxParser);
61 } 61 }
62 62
63 CPDF_Parser::~CPDF_Parser() { 63 CPDF_Parser::~CPDF_Parser() {
64 if (m_pTrailer) 64 delete m_pTrailer;
65 m_pTrailer->Release();
66
67 ReleaseEncryptHandler(); 65 ReleaseEncryptHandler();
68 SetEncryptDictionary(nullptr); 66 SetEncryptDictionary(nullptr);
69 67
70 if (m_bOwnFileRead && m_pSyntax->m_pFileAccess) { 68 if (m_bOwnFileRead && m_pSyntax->m_pFileAccess) {
71 m_pSyntax->m_pFileAccess->Release(); 69 m_pSyntax->m_pFileAccess->Release();
72 m_pSyntax->m_pFileAccess = nullptr; 70 m_pSyntax->m_pFileAccess = nullptr;
73 } 71 }
74 72
75 int32_t iLen = m_Trailers.GetSize(); 73 int32_t iLen = m_Trailers.GetSize();
76 for (int32_t i = 0; i < iLen; ++i) { 74 for (int32_t i = 0; i < iLen; ++i)
77 if (CPDF_Dictionary* trailer = m_Trailers.GetAt(i)) 75 delete m_Trailers.GetAt(i);
78 trailer->Release();
79 }
80 76
81 if (m_pLinearized) 77 delete m_pLinearized;
82 m_pLinearized->Release();
83 } 78 }
84 79
85 uint32_t CPDF_Parser::GetLastObjNum() const { 80 uint32_t CPDF_Parser::GetLastObjNum() const {
86 return m_ObjectInfo.empty() ? 0 : m_ObjectInfo.rbegin()->first; 81 return m_ObjectInfo.empty() ? 0 : m_ObjectInfo.rbegin()->first;
87 } 82 }
88 83
89 bool CPDF_Parser::IsValidObjectNumber(uint32_t objnum) const { 84 bool CPDF_Parser::IsValidObjectNumber(uint32_t objnum) const {
90 return !m_ObjectInfo.empty() && objnum <= m_ObjectInfo.rbegin()->first; 85 return !m_ObjectInfo.empty() && objnum <= m_ObjectInfo.rbegin()->first;
91 } 86 }
92 87
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Check for circular references. 346 // Check for circular references.
352 if (pdfium::ContainsKey(seen_xrefpos, xrefpos)) 347 if (pdfium::ContainsKey(seen_xrefpos, xrefpos))
353 return FALSE; 348 return FALSE;
354 349
355 seen_xrefpos.insert(xrefpos); 350 seen_xrefpos.insert(xrefpos);
356 351
357 // SLOW ... 352 // SLOW ...
358 CrossRefList.insert(CrossRefList.begin(), xrefpos); 353 CrossRefList.insert(CrossRefList.begin(), xrefpos);
359 LoadCrossRefV4(xrefpos, 0, TRUE); 354 LoadCrossRefV4(xrefpos, 0, TRUE);
360 355
361 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( 356 std::unique_ptr<CPDF_Dictionary> pDict(LoadTrailerV4());
362 LoadTrailerV4());
363 if (!pDict) 357 if (!pDict)
364 return FALSE; 358 return FALSE;
365 359
366 xrefpos = GetDirectInteger(pDict.get(), "Prev"); 360 xrefpos = GetDirectInteger(pDict.get(), "Prev");
367 361
368 // SLOW ... 362 // SLOW ...
369 XRefStreamList.insert(XRefStreamList.begin(), 363 XRefStreamList.insert(XRefStreamList.begin(),
370 pDict->GetIntegerFor("XRefStm")); 364 pDict->GetIntegerFor("XRefStm"));
371 m_Trailers.Add(pDict.release()); 365 m_Trailers.Add(pDict.release());
372 } 366 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 // Check for circular references. 400 // Check for circular references.
407 if (pdfium::ContainsKey(seen_xrefpos, xrefpos)) 401 if (pdfium::ContainsKey(seen_xrefpos, xrefpos))
408 return FALSE; 402 return FALSE;
409 403
410 seen_xrefpos.insert(xrefpos); 404 seen_xrefpos.insert(xrefpos);
411 405
412 // SLOW ... 406 // SLOW ...
413 CrossRefList.insert(CrossRefList.begin(), xrefpos); 407 CrossRefList.insert(CrossRefList.begin(), xrefpos);
414 LoadCrossRefV4(xrefpos, 0, TRUE); 408 LoadCrossRefV4(xrefpos, 0, TRUE);
415 409
416 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( 410 std::unique_ptr<CPDF_Dictionary> pDict(LoadTrailerV4());
417 LoadTrailerV4());
418 if (!pDict) 411 if (!pDict)
419 return FALSE; 412 return FALSE;
420 413
421 xrefpos = GetDirectInteger(pDict.get(), "Prev"); 414 xrefpos = GetDirectInteger(pDict.get(), "Prev");
422 415
423 // SLOW ... 416 // SLOW ...
424 XRefStreamList.insert(XRefStreamList.begin(), 417 XRefStreamList.insert(XRefStreamList.begin(),
425 pDict->GetIntegerFor("XRefStm")); 418 pDict->GetIntegerFor("XRefStm"));
426 m_Trailers.Add(pDict.release()); 419 m_Trailers.Add(pDict.release());
427 } 420 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 return FALSE; 577 return FALSE;
585 } 578 }
586 m_ObjectStreamMap.clear(); 579 m_ObjectStreamMap.clear();
587 m_bXRefStream = TRUE; 580 m_bXRefStream = TRUE;
588 return TRUE; 581 return TRUE;
589 } 582 }
590 583
591 FX_BOOL CPDF_Parser::RebuildCrossRef() { 584 FX_BOOL CPDF_Parser::RebuildCrossRef() {
592 m_ObjectInfo.clear(); 585 m_ObjectInfo.clear();
593 m_SortedOffset.clear(); 586 m_SortedOffset.clear();
594 if (m_pTrailer) { 587 delete m_pTrailer;
595 m_pTrailer->Release(); 588 m_pTrailer = nullptr;
596 m_pTrailer = nullptr;
597 }
598 589
599 ParserState state = ParserState::kDefault; 590 ParserState state = ParserState::kDefault;
600
601 int32_t inside_index = 0; 591 int32_t inside_index = 0;
602 uint32_t objnum = 0; 592 uint32_t objnum = 0;
603 uint32_t gennum = 0; 593 uint32_t gennum = 0;
604 int32_t depth = 0; 594 int32_t depth = 0;
605
606 const uint32_t kBufferSize = 4096; 595 const uint32_t kBufferSize = 4096;
607 std::vector<uint8_t> buffer(kBufferSize); 596 std::vector<uint8_t> buffer(kBufferSize);
608 597
609 FX_FILESIZE pos = m_pSyntax->m_HeaderOffset; 598 FX_FILESIZE pos = m_pSyntax->m_HeaderOffset;
610 FX_FILESIZE start_pos = 0; 599 FX_FILESIZE start_pos = 0;
611 FX_FILESIZE start_pos1 = 0; 600 FX_FILESIZE start_pos1 = 0;
612 FX_FILESIZE last_obj = -1; 601 FX_FILESIZE last_obj = -1;
613 FX_FILESIZE last_xref = -1; 602 FX_FILESIZE last_xref = -1;
614 FX_FILESIZE last_trailer = -1; 603 FX_FILESIZE last_trailer = -1;
615 604
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 CPDF_Object* pObject = ParseIndirectObjectAtByStrict( 738 CPDF_Object* pObject = ParseIndirectObjectAtByStrict(
750 m_pDocument, obj_pos, objnum, &obj_end); 739 m_pDocument, obj_pos, objnum, &obj_end);
751 if (CPDF_Stream* pStream = ToStream(pObject)) { 740 if (CPDF_Stream* pStream = ToStream(pObject)) {
752 if (CPDF_Dictionary* pDict = pStream->GetDict()) { 741 if (CPDF_Dictionary* pDict = pStream->GetDict()) {
753 if ((pDict->KeyExist("Type")) && 742 if ((pDict->KeyExist("Type")) &&
754 (pDict->GetStringFor("Type") == "XRef" && 743 (pDict->GetStringFor("Type") == "XRef" &&
755 pDict->KeyExist("Size"))) { 744 pDict->KeyExist("Size"))) {
756 CPDF_Object* pRoot = pDict->GetObjectFor("Root"); 745 CPDF_Object* pRoot = pDict->GetObjectFor("Root");
757 if (pRoot && pRoot->GetDict() && 746 if (pRoot && pRoot->GetDict() &&
758 pRoot->GetDict()->GetObjectFor("Pages")) { 747 pRoot->GetDict()->GetObjectFor("Pages")) {
759 if (m_pTrailer) 748 if (m_pTrailer)
Lei Zhang 2016/10/03 21:50:47 no if
Tom Sepez 2016/10/05 21:03:02 Done.
760 m_pTrailer->Release(); 749 delete m_pTrailer;
761 m_pTrailer = ToDictionary(pDict->Clone()); 750 m_pTrailer = ToDictionary(pDict->Clone());
762 } 751 }
763 } 752 }
764 } 753 }
765 } 754 }
766 755
767 FX_FILESIZE offset = 0; 756 FX_FILESIZE offset = 0;
768 m_pSyntax->RestorePos(obj_pos); 757 m_pSyntax->RestorePos(obj_pos);
769 offset = m_pSyntax->FindTag("obj", 0); 758 offset = m_pSyntax->FindTag("obj", 0);
770 if (offset == -1) 759 if (offset == -1)
(...skipping 17 matching lines...) Expand all
788 m_ObjectInfo[objnum].gennum = gennum; 777 m_ObjectInfo[objnum].gennum = gennum;
789 if (oldgen != gennum) 778 if (oldgen != gennum)
790 m_bVersionUpdated = true; 779 m_bVersionUpdated = true;
791 } 780 }
792 } else { 781 } else {
793 m_ObjectInfo[objnum].pos = obj_pos; 782 m_ObjectInfo[objnum].pos = obj_pos;
794 m_ObjectInfo[objnum].type = 1; 783 m_ObjectInfo[objnum].type = 1;
795 m_ObjectInfo[objnum].gennum = gennum; 784 m_ObjectInfo[objnum].gennum = gennum;
796 } 785 }
797 786
798 if (pObject) 787 delete pObject;
799 pObject->Release();
800 } 788 }
801 --i; 789 --i;
802 state = ParserState::kDefault; 790 state = ParserState::kDefault;
803 break; 791 break;
804 } 792 }
805 break; 793 break;
806 794
807 case ParserState::kTrailer: 795 case ParserState::kTrailer:
808 if (inside_index == 7) { 796 if (inside_index == 7) {
809 if (PDFCharIsWhitespace(byte) || PDFCharIsDelimiter(byte)) { 797 if (PDFCharIsWhitespace(byte) || PDFCharIsDelimiter(byte)) {
810 last_trailer = pos + i - 7; 798 last_trailer = pos + i - 7;
811 m_pSyntax->RestorePos(pos + i - m_pSyntax->m_HeaderOffset); 799 m_pSyntax->RestorePos(pos + i - m_pSyntax->m_HeaderOffset);
812 800
813 CPDF_Object* pObj = m_pSyntax->GetObject(m_pDocument, 0, 0, true); 801 CPDF_Object* pObj = m_pSyntax->GetObject(m_pDocument, 0, 0, true);
814 if (pObj) { 802 if (pObj) {
815 if (!pObj->IsDictionary() && !pObj->AsStream()) { 803 if (!pObj->IsDictionary() && !pObj->AsStream()) {
816 pObj->Release(); 804 delete pObj;
817 } else { 805 } else {
818 CPDF_Stream* pStream = pObj->AsStream(); 806 CPDF_Stream* pStream = pObj->AsStream();
819 if (CPDF_Dictionary* pTrailer = 807 if (CPDF_Dictionary* pTrailer =
820 pStream ? pStream->GetDict() : pObj->AsDictionary()) { 808 pStream ? pStream->GetDict() : pObj->AsDictionary()) {
821 if (m_pTrailer) { 809 if (m_pTrailer) {
822 CPDF_Object* pRoot = pTrailer->GetObjectFor("Root"); 810 CPDF_Object* pRoot = pTrailer->GetObjectFor("Root");
823 CPDF_Reference* pRef = ToReference(pRoot); 811 CPDF_Reference* pRef = ToReference(pRoot);
824 if (!pRoot || 812 if (!pRoot ||
825 (pRef && IsValidObjectNumber(pRef->GetRefObjNum()) && 813 (pRef && IsValidObjectNumber(pRef->GetRefObjNum()) &&
826 m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) { 814 m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) {
827 auto it = pTrailer->begin(); 815 auto it = pTrailer->begin();
828 while (it != pTrailer->end()) { 816 while (it != pTrailer->end()) {
829 const CFX_ByteString& key = it->first; 817 const CFX_ByteString& key = it->first;
830 CPDF_Object* pElement = it->second; 818 CPDF_Object* pElement = it->second;
831 ++it; 819 ++it;
832 uint32_t dwObjNum = 820 uint32_t dwObjNum =
833 pElement ? pElement->GetObjNum() : 0; 821 pElement ? pElement->GetObjNum() : 0;
834 if (dwObjNum) { 822 if (dwObjNum) {
835 m_pTrailer->SetReferenceFor(key, m_pDocument, 823 m_pTrailer->SetReferenceFor(key, m_pDocument,
836 dwObjNum); 824 dwObjNum);
837 } else { 825 } else {
838 m_pTrailer->SetFor(key, pElement->Clone()); 826 m_pTrailer->SetFor(key, pElement->Clone());
839 } 827 }
840 } 828 }
841 } 829 }
842 pObj->Release(); 830 delete pObj;
843 } else { 831 } else {
844 if (pObj->IsStream()) { 832 if (pObj->IsStream()) {
845 m_pTrailer = ToDictionary(pTrailer->Clone()); 833 m_pTrailer = ToDictionary(pTrailer->Clone());
846 pObj->Release(); 834 delete pObj;
847 } else { 835 } else {
848 m_pTrailer = pTrailer; 836 m_pTrailer = pTrailer;
849 } 837 }
850 838
851 FX_FILESIZE dwSavePos = m_pSyntax->SavePos(); 839 FX_FILESIZE dwSavePos = m_pSyntax->SavePos();
852 CFX_ByteString strWord = m_pSyntax->GetKeyword(); 840 CFX_ByteString strWord = m_pSyntax->GetKeyword();
853 if (!strWord.Compare("startxref")) { 841 if (!strWord.Compare("startxref")) {
854 bool bNumber; 842 bool bNumber;
855 CFX_ByteString bsOffset = 843 CFX_ByteString bsOffset =
856 m_pSyntax->GetNextWord(&bNumber); 844 m_pSyntax->GetNextWord(&bNumber);
857 if (bNumber) 845 if (bNumber)
858 m_LastXRefOffset = FXSYS_atoi(bsOffset.c_str()); 846 m_LastXRefOffset = FXSYS_atoi(bsOffset.c_str());
859 } 847 }
860 m_pSyntax->RestorePos(dwSavePos); 848 m_pSyntax->RestorePos(dwSavePos);
861 } 849 }
862 } else { 850 } else {
863 pObj->Release(); 851 delete pObj;
864 } 852 }
865 } 853 }
866 } 854 }
867 } 855 }
868 --i; 856 --i;
869 state = ParserState::kDefault; 857 state = ParserState::kDefault;
870 } else if (byte == "trailer"[inside_index]) { 858 } else if (byte == "trailer"[inside_index]) {
871 inside_index++; 859 inside_index++;
872 } else { 860 } else {
873 --i; 861 --i;
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 *pResultPos = m_pSyntax->m_Pos; 1400 *pResultPos = m_pSyntax->m_Pos;
1413 1401
1414 m_pSyntax->RestorePos(SavedPos); 1402 m_pSyntax->RestorePos(SavedPos);
1415 return pObj; 1403 return pObj;
1416 } 1404 }
1417 1405
1418 CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() { 1406 CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() {
1419 if (m_pSyntax->GetKeyword() != "trailer") 1407 if (m_pSyntax->GetKeyword() != "trailer")
1420 return nullptr; 1408 return nullptr;
1421 1409
1422 std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( 1410 std::unique_ptr<CPDF_Object> pObj(
1423 m_pSyntax->GetObject(m_pDocument, 0, 0, true)); 1411 m_pSyntax->GetObject(m_pDocument, 0, 0, true));
1424 if (!ToDictionary(pObj.get())) 1412 if (!ToDictionary(pObj.get()))
1425 return nullptr; 1413 return nullptr;
1426 return pObj.release()->AsDictionary(); 1414 return pObj.release()->AsDictionary();
1427 } 1415 }
1428 1416
1429 uint32_t CPDF_Parser::GetPermissions() const { 1417 uint32_t CPDF_Parser::GetPermissions() const {
1430 if (!m_pSecurityHandler) 1418 if (!m_pSecurityHandler)
1431 return 0xFFFFFFFF; 1419 return 0xFFFFFFFF;
1432 1420
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 m_pLinearized = m_pSyntax->GetObject(nullptr, objnum, gennum, true); 1452 m_pLinearized = m_pSyntax->GetObject(nullptr, objnum, gennum, true);
1465 if (!m_pLinearized) 1453 if (!m_pLinearized)
1466 return FALSE; 1454 return FALSE;
1467 1455
1468 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); 1456 CPDF_Dictionary* pDict = m_pLinearized->GetDict();
1469 if (pDict && pDict->GetObjectFor("Linearized")) { 1457 if (pDict && pDict->GetObjectFor("Linearized")) {
1470 m_pSyntax->GetNextWord(nullptr); 1458 m_pSyntax->GetNextWord(nullptr);
1471 1459
1472 CPDF_Object* pLen = pDict->GetObjectFor("L"); 1460 CPDF_Object* pLen = pDict->GetObjectFor("L");
1473 if (!pLen) { 1461 if (!pLen) {
1474 m_pLinearized->Release(); 1462 delete m_pLinearized;
1475 m_pLinearized = nullptr; 1463 m_pLinearized = nullptr;
1476 return FALSE; 1464 return FALSE;
1477 } 1465 }
1478 1466
1479 if (pLen->GetInteger() != (int)pFileAccess->GetSize()) 1467 if (pLen->GetInteger() != (int)pFileAccess->GetSize())
1480 return FALSE; 1468 return FALSE;
1481 1469
1482 if (CPDF_Number* pNo = ToNumber(pDict->GetObjectFor("P"))) 1470 if (CPDF_Number* pNo = ToNumber(pDict->GetObjectFor("P")))
1483 m_dwFirstPageNo = pNo->GetInteger(); 1471 m_dwFirstPageNo = pNo->GetInteger();
1484 1472
1485 if (CPDF_Number* pTable = ToNumber(pDict->GetObjectFor("T"))) 1473 if (CPDF_Number* pTable = ToNumber(pDict->GetObjectFor("T")))
1486 m_LastXRefOffset = pTable->GetInteger(); 1474 m_LastXRefOffset = pTable->GetInteger();
1487 1475
1488 return TRUE; 1476 return TRUE;
1489 } 1477 }
1490 m_pLinearized->Release(); 1478 delete m_pLinearized;
1491 m_pLinearized = nullptr; 1479 m_pLinearized = nullptr;
1492 return FALSE; 1480 return FALSE;
1493 } 1481 }
1494 1482
1495 CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(IFX_FileRead* pFileAccess, 1483 CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(IFX_FileRead* pFileAccess,
1496 CPDF_Document* pDocument) { 1484 CPDF_Document* pDocument) {
1497 ASSERT(!m_bHasParsed); 1485 ASSERT(!m_bHasParsed);
1498 1486
1499 m_bXRefStream = FALSE; 1487 m_bXRefStream = FALSE;
1500 m_LastXRefOffset = 0; 1488 m_LastXRefOffset = 0;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 return FALSE; 1576 return FALSE;
1589 } 1577 }
1590 m_ObjectStreamMap.clear(); 1578 m_ObjectStreamMap.clear();
1591 m_bXRefStream = TRUE; 1579 m_bXRefStream = TRUE;
1592 return TRUE; 1580 return TRUE;
1593 } 1581 }
1594 1582
1595 CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() { 1583 CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() {
1596 uint32_t dwSaveMetadataObjnum = m_pSyntax->m_MetadataObjnum; 1584 uint32_t dwSaveMetadataObjnum = m_pSyntax->m_MetadataObjnum;
1597 m_pSyntax->m_MetadataObjnum = 0; 1585 m_pSyntax->m_MetadataObjnum = 0;
1598 if (m_pTrailer) {
1599 m_pTrailer->Release();
1600 m_pTrailer = nullptr;
1601 }
1602 1586
1587 delete m_pTrailer;
1588 m_pTrailer = nullptr;
1603 m_pSyntax->RestorePos(m_LastXRefOffset - m_pSyntax->m_HeaderOffset); 1589 m_pSyntax->RestorePos(m_LastXRefOffset - m_pSyntax->m_HeaderOffset);
1590
1604 uint8_t ch = 0; 1591 uint8_t ch = 0;
1605 uint32_t dwCount = 0; 1592 uint32_t dwCount = 0;
1606 m_pSyntax->GetNextChar(ch); 1593 m_pSyntax->GetNextChar(ch);
1607 while (PDFCharIsWhitespace(ch)) { 1594 while (PDFCharIsWhitespace(ch)) {
1608 ++dwCount; 1595 ++dwCount;
1609 if (m_pSyntax->m_FileLen >= 1596 if (m_pSyntax->m_FileLen >=
1610 (FX_FILESIZE)(m_pSyntax->SavePos() + m_pSyntax->m_HeaderOffset)) { 1597 (FX_FILESIZE)(m_pSyntax->SavePos() + m_pSyntax->m_HeaderOffset)) {
1611 break; 1598 break;
1612 } 1599 }
1613 m_pSyntax->GetNextChar(ch); 1600 m_pSyntax->GetNextChar(ch);
1614 } 1601 }
1615 m_LastXRefOffset += dwCount; 1602 m_LastXRefOffset += dwCount;
1616 m_ObjectStreamMap.clear(); 1603 m_ObjectStreamMap.clear();
1617 m_ObjCache.clear(); 1604 m_ObjCache.clear();
1618 1605
1619 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && 1606 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) &&
1620 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { 1607 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) {
1621 m_LastXRefOffset = 0; 1608 m_LastXRefOffset = 0;
1622 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; 1609 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum;
1623 return FORMAT_ERROR; 1610 return FORMAT_ERROR;
1624 } 1611 }
1625 1612
1626 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; 1613 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum;
1627 return SUCCESS; 1614 return SUCCESS;
1628 } 1615 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698