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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 404653005: Remove a few unused variables, functions, and tables. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/src/fpdfdoc/doc_ap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_page.h" 9 #include "../../../include/fpdfapi/fpdf_page.h"
10 #include "../../../../third_party/numerics/safe_math.h" 10 #include "../../../../third_party/numerics/safe_math.h"
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 FX_BOOL bOverFlow = FALSE; 629 FX_BOOL bOverFlow = FALSE;
630 FX_DWORD size = (FX_DWORD)(m_Syntax.m_FileLen - pos); 630 FX_DWORD size = (FX_DWORD)(m_Syntax.m_FileLen - pos);
631 if (size > 4096) { 631 if (size > 4096) {
632 size = 4096; 632 size = 4096;
633 } 633 }
634 if (!m_Syntax.m_pFileAccess->ReadBlock(buffer, pos, size)) { 634 if (!m_Syntax.m_pFileAccess->ReadBlock(buffer, pos, size)) {
635 break; 635 break;
636 } 636 }
637 for (FX_DWORD i = 0; i < size; i ++) { 637 for (FX_DWORD i = 0; i < size; i ++) {
638 FX_BYTE byte = buffer[i]; 638 FX_BYTE byte = buffer[i];
639 FX_LPBYTE pData = buffer + i;
640 switch (status) { 639 switch (status) {
641 case 0: 640 case 0:
642 if (_PDF_CharType[byte] == 'W') { 641 if (_PDF_CharType[byte] == 'W') {
643 status = 1; 642 status = 1;
644 } 643 }
645 if (byte <= '9' && byte >= '0') { 644 if (byte <= '9' && byte >= '0') {
646 --i; 645 --i;
647 status = 1; 646 status = 1;
648 } 647 }
649 if (byte == '%') { 648 if (byte == '%') {
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) { 1373 if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) {
1375 m_Syntax.RestorePos(SavedPos); 1374 m_Syntax.RestorePos(SavedPos);
1376 return NULL; 1375 return NULL;
1377 } 1376 }
1378 CPDF_Object* pObj = m_Syntax.GetObject(pObjList, objnum, gennum, 0, pContext ); 1377 CPDF_Object* pObj = m_Syntax.GetObject(pObjList, objnum, gennum, 0, pContext );
1379 FX_FILESIZE endOffset = m_Syntax.SavePos(); 1378 FX_FILESIZE endOffset = m_Syntax.SavePos();
1380 CFX_ByteString bsWord = m_Syntax.GetKeyword(); 1379 CFX_ByteString bsWord = m_Syntax.GetKeyword();
1381 if (bsWord == FX_BSTRC("endobj")) { 1380 if (bsWord == FX_BSTRC("endobj")) {
1382 endOffset = m_Syntax.SavePos(); 1381 endOffset = m_Syntax.SavePos();
1383 } 1382 }
1384 FX_DWORD objSize = endOffset - objOffset;
1385 m_Syntax.RestorePos(SavedPos); 1383 m_Syntax.RestorePos(SavedPos);
1386 if (pObj && !objnum) { 1384 if (pObj && !objnum) {
1387 pObj->m_ObjNum = real_objnum; 1385 pObj->m_ObjNum = real_objnum;
1388 pObj->m_GenNum = gennum; 1386 pObj->m_GenNum = gennum;
1389 } 1387 }
1390 return pObj; 1388 return pObj;
1391 } 1389 }
1392 CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(CPDF_IndirectObjects* pO bjList, FX_FILESIZE pos, FX_DWORD objnum, 1390 CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(CPDF_IndirectObjects* pO bjList, FX_FILESIZE pos, FX_DWORD objnum,
1393 struct PARSE_CONTEXT* pContext, FX_FILESIZE *pResultPos) 1391 struct PARSE_CONTEXT* pContext, FX_FILESIZE *pResultPos)
1394 { 1392 {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 } 1614 }
1617 FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable() 1615 FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable()
1618 { 1616 {
1619 FX_DWORD dwSaveMetadataObjnum = m_Syntax.m_MetadataObjnum; 1617 FX_DWORD dwSaveMetadataObjnum = m_Syntax.m_MetadataObjnum;
1620 m_Syntax.m_MetadataObjnum = 0; 1618 m_Syntax.m_MetadataObjnum = 0;
1621 if (m_pTrailer) { 1619 if (m_pTrailer) {
1622 m_pTrailer->Release(); 1620 m_pTrailer->Release();
1623 m_pTrailer = NULL; 1621 m_pTrailer = NULL;
1624 } 1622 }
1625 m_Syntax.RestorePos(m_LastXRefOffset - m_Syntax.m_HeaderOffset); 1623 m_Syntax.RestorePos(m_LastXRefOffset - m_Syntax.m_HeaderOffset);
1626 FX_FILESIZE dwSavedPos = m_Syntax.SavePos();
1627 FX_BYTE ch = 0; 1624 FX_BYTE ch = 0;
1628 FX_DWORD dwCount = 0; 1625 FX_DWORD dwCount = 0;
1629 m_Syntax.GetNextChar(ch); 1626 m_Syntax.GetNextChar(ch);
1630 FX_INT32 type = _PDF_CharType[ch]; 1627 FX_INT32 type = _PDF_CharType[ch];
1631 while (type == 'W') { 1628 while (type == 'W') {
1632 ++dwCount; 1629 ++dwCount;
1633 if (m_Syntax.m_FileLen >= (FX_FILESIZE)(m_Syntax.SavePos() + m_Syntax.m_ HeaderOffset)) { 1630 if (m_Syntax.m_FileLen >= (FX_FILESIZE)(m_Syntax.SavePos() + m_Syntax.m_ HeaderOffset)) {
1634 break; 1631 break;
1635 } 1632 }
1636 m_Syntax.GetNextChar(ch); 1633 m_Syntax.GetNextChar(ch);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY); 2037 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
2041 FX_BOOL bIsNumber; 2038 FX_BOOL bIsNumber;
2042 CFX_ByteString word = GetNextWord(bIsNumber); 2039 CFX_ByteString word = GetNextWord(bIsNumber);
2043 CPDF_Object* pRet = NULL; 2040 CPDF_Object* pRet = NULL;
2044 if (word.GetLength() == 0) { 2041 if (word.GetLength() == 0) {
2045 if (bTypeOnly) { 2042 if (bTypeOnly) {
2046 return (CPDF_Object*)PDFOBJ_INVALID; 2043 return (CPDF_Object*)PDFOBJ_INVALID;
2047 } 2044 }
2048 return NULL; 2045 return NULL;
2049 } 2046 }
2050 FX_FILESIZE wordOffset = m_Pos - word.GetLength();
2051 if (bIsNumber) { 2047 if (bIsNumber) {
2052 FX_FILESIZE SavedPos = m_Pos; 2048 FX_FILESIZE SavedPos = m_Pos;
2053 CFX_ByteString nextword = GetNextWord(bIsNumber); 2049 CFX_ByteString nextword = GetNextWord(bIsNumber);
2054 if (bIsNumber) { 2050 if (bIsNumber) {
2055 CFX_ByteString nextword2 = GetNextWord(bIsNumber); 2051 CFX_ByteString nextword2 = GetNextWord(bIsNumber);
2056 if (nextword2 == FX_BSTRC("R")) { 2052 if (nextword2 == FX_BSTRC("R")) {
2057 FX_DWORD objnum = FXSYS_atoi(word); 2053 FX_DWORD objnum = FXSYS_atoi(word);
2058 if (bTypeOnly) { 2054 if (bTypeOnly) {
2059 return (CPDF_Object*)PDFOBJ_REFERENCE; 2055 return (CPDF_Object*)PDFOBJ_REFERENCE;
2060 } 2056 }
(...skipping 27 matching lines...) Expand all
2088 if (bTypeOnly) { 2084 if (bTypeOnly) {
2089 return (CPDF_Object*)PDFOBJ_NULL; 2085 return (CPDF_Object*)PDFOBJ_NULL;
2090 } 2086 }
2091 pRet = CPDF_Null::Create(); 2087 pRet = CPDF_Null::Create();
2092 return pRet; 2088 return pRet;
2093 } 2089 }
2094 if (word == FX_BSTRC("(")) { 2090 if (word == FX_BSTRC("(")) {
2095 if (bTypeOnly) { 2091 if (bTypeOnly) {
2096 return (CPDF_Object*)PDFOBJ_STRING; 2092 return (CPDF_Object*)PDFOBJ_STRING;
2097 } 2093 }
2098 FX_FILESIZE SavedPos = m_Pos - 1;
2099 CFX_ByteString str = ReadString(); 2094 CFX_ByteString str = ReadString();
2100 if (m_pCryptoHandler && bDecrypt) { 2095 if (m_pCryptoHandler && bDecrypt) {
2101 m_pCryptoHandler->Decrypt(objnum, gennum, str); 2096 m_pCryptoHandler->Decrypt(objnum, gennum, str);
2102 } 2097 }
2103 pRet = CPDF_String::Create(str, FALSE); 2098 pRet = CPDF_String::Create(str, FALSE);
2104 return pRet; 2099 return pRet;
2105 } 2100 }
2106 if (word == FX_BSTRC("<")) { 2101 if (word == FX_BSTRC("<")) {
2107 if (bTypeOnly) { 2102 if (bTypeOnly) {
2108 return (CPDF_Object*)PDFOBJ_STRING; 2103 return (CPDF_Object*)PDFOBJ_STRING;
2109 } 2104 }
2110 FX_FILESIZE SavedPos = m_Pos - 1;
2111 CFX_ByteString str = ReadHexString(); 2105 CFX_ByteString str = ReadHexString();
2112 if (m_pCryptoHandler && bDecrypt) { 2106 if (m_pCryptoHandler && bDecrypt) {
2113 m_pCryptoHandler->Decrypt(objnum, gennum, str); 2107 m_pCryptoHandler->Decrypt(objnum, gennum, str);
2114 } 2108 }
2115 pRet = CPDF_String::Create(str, TRUE); 2109 pRet = CPDF_String::Create(str, TRUE);
2116 return pRet; 2110 return pRet;
2117 } 2111 }
2118 if (word == FX_BSTRC("[")) { 2112 if (word == FX_BSTRC("[")) {
2119 if (bTypeOnly) { 2113 if (bTypeOnly) {
2120 return (CPDF_Object*)PDFOBJ_ARRAY; 2114 return (CPDF_Object*)PDFOBJ_ARRAY;
2121 } 2115 }
2122 CPDF_Array* pArray = CPDF_Array::Create(); 2116 CPDF_Array* pArray = CPDF_Array::Create();
2123 FX_FILESIZE firstPos = m_Pos - 1;
2124 while (1) { 2117 while (1) {
2125 FX_FILESIZE SavedPos = m_Pos;
2126 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, level + 1); 2118 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, level + 1);
2127 if (pObj == NULL) { 2119 if (pObj == NULL) {
2128 return pArray; 2120 return pArray;
2129 } 2121 }
2130 pArray->Add(pObj); 2122 pArray->Add(pObj);
2131 } 2123 }
2132 } 2124 }
2133 if (word[0] == '/') { 2125 if (word[0] == '/') {
2134 if (bTypeOnly) { 2126 if (bTypeOnly) {
2135 return (CPDF_Object*)PDFOBJ_NAME; 2127 return (CPDF_Object*)PDFOBJ_NAME;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2425 base::CheckedNumeric<FX_FILESIZE> pos = m_Pos; 2417 base::CheckedNumeric<FX_FILESIZE> pos = m_Pos;
2426 pos += len; 2418 pos += len;
2427 if (pos.IsValid() && pos.ValueOrDie() < m_FileLen) { 2419 if (pos.IsValid() && pos.ValueOrDie() < m_FileLen) {
2428 m_Pos = pos.ValueOrDie(); 2420 m_Pos = pos.ValueOrDie();
2429 } else { 2421 } else {
2430 return NULL; 2422 return NULL;
2431 } 2423 }
2432 2424
2433 CPDF_CryptoHandler* pCryptoHandler = objnum == (FX_DWORD)m_MetadataObjnum ? NULL : m_pCryptoHandler; 2425 CPDF_CryptoHandler* pCryptoHandler = objnum == (FX_DWORD)m_MetadataObjnum ? NULL : m_pCryptoHandler;
2434 if (pCryptoHandler == NULL) { 2426 if (pCryptoHandler == NULL) {
2435 FX_FILESIZE SavedPos = m_Pos;
2436 GetNextWord(); 2427 GetNextWord();
2437 if (m_WordSize < 9 || FXSYS_memcmp32(m_WordBuffer, "endstream", 9)) { 2428 if (m_WordSize < 9 || FXSYS_memcmp32(m_WordBuffer, "endstream", 9)) {
2438 m_Pos = StreamStartPos; 2429 m_Pos = StreamStartPos;
2439 FX_FILESIZE offset = FindTag(FX_BSTRC("endstream"), 0); 2430 FX_FILESIZE offset = FindTag(FX_BSTRC("endstream"), 0);
2440 if (offset >= 0) { 2431 if (offset >= 0) {
2441 FX_FILESIZE curPos = m_Pos; 2432 FX_FILESIZE curPos = m_Pos;
2442 m_Pos = StreamStartPos; 2433 m_Pos = StreamStartPos;
2443 FX_FILESIZE endobjOffset = FindTag(FX_BSTRC("endobj"), 0); 2434 FX_FILESIZE endobjOffset = FindTag(FX_BSTRC("endobj"), 0);
2444 if (endobjOffset < offset && endobjOffset >= 0) { 2435 if (endobjOffset < offset && endobjOffset >= 0) {
2445 offset = endobjOffset; 2436 offset = endobjOffset;
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; 3305 m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
3315 return TRUE; 3306 return TRUE;
3316 } 3307 }
3317 if (!pPages) { 3308 if (!pPages) {
3318 if (m_docStatus == PDF_DATAAVAIL_ERROR) { 3309 if (m_docStatus == PDF_DATAAVAIL_ERROR) {
3319 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; 3310 m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
3320 return TRUE; 3311 return TRUE;
3321 } 3312 }
3322 return FALSE; 3313 return FALSE;
3323 } 3314 }
3324 FX_BOOL bNeedLoad = FALSE;
3325 if (!GetPageKids(m_pCurrentParser, pPages)) { 3315 if (!GetPageKids(m_pCurrentParser, pPages)) {
3326 pPages->Release(); 3316 pPages->Release();
3327 m_docStatus = PDF_DATAAVAIL_ERROR; 3317 m_docStatus = PDF_DATAAVAIL_ERROR;
3328 return FALSE; 3318 return FALSE;
3329 } 3319 }
3330 pPages->Release(); 3320 pPages->Release();
3331 m_docStatus = PDF_DATAAVAIL_PAGE; 3321 m_docStatus = PDF_DATAAVAIL_PAGE;
3332 return TRUE; 3322 return TRUE;
3333 } 3323 }
3334 FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints) 3324 FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints)
(...skipping 13 matching lines...) Expand all
3348 } 3338 }
3349 m_docStatus = PDF_DATAAVAIL_END; 3339 m_docStatus = PDF_DATAAVAIL_END;
3350 } 3340 }
3351 return TRUE; 3341 return TRUE;
3352 } 3342 }
3353 pHints->AddSegment(0, req_size); 3343 pHints->AddSegment(0, req_size);
3354 return FALSE; 3344 return FALSE;
3355 } 3345 }
3356 FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints) 3346 FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints)
3357 { 3347 {
3358 FX_DWORD dwFirstPageEndOffset = 0;
3359 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); 3348 CPDF_Dictionary* pDict = m_pLinearized->GetDict();
3360 CPDF_Object *pEndOffSet = pDict ? pDict->GetElement(FX_BSTRC("E")) : NULL; 3349 CPDF_Object *pEndOffSet = pDict ? pDict->GetElement(FX_BSTRC("E")) : NULL;
3361 if (!pEndOffSet) { 3350 if (!pEndOffSet) {
3362 m_docStatus = PDF_DATAAVAIL_ERROR; 3351 m_docStatus = PDF_DATAAVAIL_ERROR;
3363 return FALSE; 3352 return FALSE;
3364 } 3353 }
3365 CPDF_Object *pXRefOffset = pDict ? pDict->GetElement(FX_BSTRC("T")) : NULL; 3354 CPDF_Object *pXRefOffset = pDict ? pDict->GetElement(FX_BSTRC("T")) : NULL;
3366 if (!pXRefOffset) { 3355 if (!pXRefOffset) {
3367 m_docStatus = PDF_DATAAVAIL_ERROR; 3356 m_docStatus = PDF_DATAAVAIL_ERROR;
3368 return FALSE; 3357 return FALSE;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
3465 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)d wLen, FALSE)); 3454 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)d wLen, FALSE));
3466 FX_INT32 offset = GetHeaderOffset((IFX_FileStream*)file); 3455 FX_INT32 offset = GetHeaderOffset((IFX_FileStream*)file);
3467 if (offset == -1) { 3456 if (offset == -1) {
3468 m_docStatus = PDF_DATAAVAIL_ERROR; 3457 m_docStatus = PDF_DATAAVAIL_ERROR;
3469 return FALSE; 3458 return FALSE;
3470 } 3459 }
3471 m_dwHeaderOffset = offset; 3460 m_dwHeaderOffset = offset;
3472 m_syntaxParser.InitParser((IFX_FileStream*)file, offset); 3461 m_syntaxParser.InitParser((IFX_FileStream*)file, offset);
3473 m_syntaxParser.RestorePos(m_syntaxParser.m_HeaderOffset + 9); 3462 m_syntaxParser.RestorePos(m_syntaxParser.m_HeaderOffset + 9);
3474 FX_BOOL bNumber = FALSE; 3463 FX_BOOL bNumber = FALSE;
3475 FX_FILESIZE dwSavePos = m_syntaxParser.SavePos();
3476 CFX_ByteString wordObjNum = m_syntaxParser.GetNextWord(bNumber); 3464 CFX_ByteString wordObjNum = m_syntaxParser.GetNextWord(bNumber);
3477 if (!bNumber) { 3465 if (!bNumber) {
3478 return FALSE; 3466 return FALSE;
3479 } 3467 }
3480 FX_DWORD objnum = FXSYS_atoi(wordObjNum); 3468 FX_DWORD objnum = FXSYS_atoi(wordObjNum);
3481 if (m_pLinearized) { 3469 if (m_pLinearized) {
3482 m_pLinearized->Release(); 3470 m_pLinearized->Release();
3483 m_pLinearized = NULL; 3471 m_pLinearized = NULL;
3484 } 3472 }
3485 m_pLinearized = ParseIndirectObjectAt(m_syntaxParser.m_HeaderOffset + 9, obj num); 3473 m_pLinearized = ParseIndirectObjectAt(m_syntaxParser.m_HeaderOffset + 9, obj num);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3543 xref_offset = 0; 3531 xref_offset = 0;
3544 FX_DWORD req_size = (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_P os : 512); 3532 FX_DWORD req_size = (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_P os : 512);
3545 if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) { 3533 if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) {
3546 FX_INT32 iSize = (FX_INT32)(m_Pos + req_size - m_dwCurrentXRefSteam); 3534 FX_INT32 iSize = (FX_INT32)(m_Pos + req_size - m_dwCurrentXRefSteam);
3547 CFX_BinaryBuf buf(iSize); 3535 CFX_BinaryBuf buf(iSize);
3548 FX_LPBYTE pBuf = buf.GetBuffer(); 3536 FX_LPBYTE pBuf = buf.GetBuffer();
3549 m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize); 3537 m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize);
3550 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_ t)iSize, FALSE)); 3538 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_ t)iSize, FALSE));
3551 m_parser.m_Syntax.InitParser((IFX_FileStream*)file, 0); 3539 m_parser.m_Syntax.InitParser((IFX_FileStream*)file, 0);
3552 FX_BOOL bNumber = FALSE; 3540 FX_BOOL bNumber = FALSE;
3553 FX_FILESIZE dwSavePos = m_parser.m_Syntax.SavePos();
3554 CFX_ByteString objnum = m_parser.m_Syntax.GetNextWord(bNumber); 3541 CFX_ByteString objnum = m_parser.m_Syntax.GetNextWord(bNumber);
3555 if (!bNumber) { 3542 if (!bNumber) {
3556 return -1; 3543 return -1;
3557 } 3544 }
3558 FX_DWORD objNum = FXSYS_atoi(objnum); 3545 FX_DWORD objNum = FXSYS_atoi(objnum);
3559 CPDF_Object *pObj = m_parser.ParseIndirectObjectAt(NULL, 0, objNum, NULL ); 3546 CPDF_Object *pObj = m_parser.ParseIndirectObjectAt(NULL, 0, objNum, NULL );
3560 if (!pObj) { 3547 if (!pObj) {
3561 m_Pos += m_parser.m_Syntax.SavePos(); 3548 m_Pos += m_parser.m_Syntax.SavePos();
3562 return 0; 3549 return 0;
3563 } 3550 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3725 m_Pos = xref_offset; 3712 m_Pos = xref_offset;
3726 } 3713 }
3727 return TRUE; 3714 return TRUE;
3728 } else if (dwRet == -1) { 3715 } else if (dwRet == -1) {
3729 m_docStatus = PDF_DATAAVAIL_ERROR; 3716 m_docStatus = PDF_DATAAVAIL_ERROR;
3730 } 3717 }
3731 return FALSE; 3718 return FALSE;
3732 } 3719 }
3733 FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) 3720 FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints)
3734 { 3721 {
3735 FX_FILESIZE dwSavePos = m_Pos;
3736 FX_INT32 iSize = 0; 3722 FX_INT32 iSize = 0;
3737 CFX_ByteString token; 3723 CFX_ByteString token;
3738 if (!GetNextToken(token)) { 3724 if (!GetNextToken(token)) {
3739 iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512 ); 3725 iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512 );
3740 pHints->AddSegment(m_Pos, iSize); 3726 pHints->AddSegment(m_Pos, iSize);
3741 return FALSE; 3727 return FALSE;
3742 } 3728 }
3743 if (token == "xref") { 3729 if (token == "xref") {
3744 m_CrossOffset.InsertAt(0, m_dwXRefOffset); 3730 m_CrossOffset.InsertAt(0, m_dwXRefOffset);
3745 while (1) { 3731 while (1) {
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
4360 return BinarySearch(dwObjNum, iNext); 4346 return BinarySearch(dwObjNum, iNext);
4361 } 4347 }
4362 FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) 4348 FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext)
4363 { 4349 {
4364 FX_INT32 iLen = m_number_array.GetSize(); 4350 FX_INT32 iLen = m_number_array.GetSize();
4365 FX_INT32 iLow = 0; 4351 FX_INT32 iLow = 0;
4366 FX_INT32 iHigh = iLen - 1; 4352 FX_INT32 iHigh = iLen - 1;
4367 FX_INT32 iMid = 0; 4353 FX_INT32 iMid = 0;
4368 while (iLow <= iHigh) { 4354 while (iLow <= iHigh) {
4369 iMid = (iLow + iHigh) / 2; 4355 iMid = (iLow + iHigh) / 2;
4370 FX_DWORD tt = m_number_array.GetAt(iMid);
4371 if (m_number_array.GetAt(iMid) == value) { 4356 if (m_number_array.GetAt(iMid) == value) {
4372 iNext = iMid; 4357 iNext = iMid;
4373 return TRUE; 4358 return TRUE;
4374 } else if (m_number_array.GetAt(iMid) > value) { 4359 } else if (m_number_array.GetAt(iMid) > value) {
4375 iHigh = iMid - 1; 4360 iHigh = iMid - 1;
4376 } else if (m_number_array.GetAt(iMid) < value) { 4361 } else if (m_number_array.GetAt(iMid) < value) {
4377 iLow = iMid + 1; 4362 iLow = iMid + 1;
4378 } 4363 }
4379 } 4364 }
4380 iNext = iLow; 4365 iNext = iLow;
4381 return FALSE; 4366 return FALSE;
4382 } 4367 }
4383 CPDF_PageNode::~CPDF_PageNode() 4368 CPDF_PageNode::~CPDF_PageNode()
4384 { 4369 {
4385 FX_INT32 iSize = m_childNode.GetSize(); 4370 FX_INT32 iSize = m_childNode.GetSize();
4386 for (FX_INT32 i = 0; i < iSize; ++i) { 4371 for (FX_INT32 i = 0; i < iSize; ++i) {
4387 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4372 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4388 if (pNode) { 4373 if (pNode) {
4389 delete pNode; 4374 delete pNode;
4390 } 4375 }
4391 } 4376 }
4392 m_childNode.RemoveAll(); 4377 m_childNode.RemoveAll();
4393 } 4378 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/src/fpdfdoc/doc_ap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698