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

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

Issue 801913002: Simplify PDFium by removing code that's not used in the open source repo. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years 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 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 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 } 1670 }
1671 CPDF_SyntaxParser::CPDF_SyntaxParser() 1671 CPDF_SyntaxParser::CPDF_SyntaxParser()
1672 { 1672 {
1673 m_pFileAccess = NULL; 1673 m_pFileAccess = NULL;
1674 m_pCryptoHandler = NULL; 1674 m_pCryptoHandler = NULL;
1675 m_pFileBuf = NULL; 1675 m_pFileBuf = NULL;
1676 m_BufSize = CPDF_ModuleMgr::Get()->m_FileBufSize; 1676 m_BufSize = CPDF_ModuleMgr::Get()->m_FileBufSize;
1677 m_pFileBuf = NULL; 1677 m_pFileBuf = NULL;
1678 m_MetadataObjnum = 0; 1678 m_MetadataObjnum = 0;
1679 m_dwWordPos = 0; 1679 m_dwWordPos = 0;
1680 #if defined(_FPDFAPI_MINI_)
1681 m_bFileStream = TRUE;
1682 #else
1683 m_bFileStream = FALSE; 1680 m_bFileStream = FALSE;
1684 #endif
1685 } 1681 }
1686 CPDF_SyntaxParser::~CPDF_SyntaxParser() 1682 CPDF_SyntaxParser::~CPDF_SyntaxParser()
1687 { 1683 {
1688 if (m_pFileBuf) { 1684 if (m_pFileBuf) {
1689 FX_Free(m_pFileBuf); 1685 FX_Free(m_pFileBuf);
1690 } 1686 }
1691 } 1687 }
1692 FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) 1688 FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch)
1693 { 1689 {
1694 FX_FILESIZE save_pos = m_Pos; 1690 FX_FILESIZE save_pos = m_Pos;
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 } else { 2458 } else {
2463 m_Pos = StreamStartPos; 2459 m_Pos = StreamStartPos;
2464 if (FindTag(FX_BSTRC("endobj"), 0) < 0) { 2460 if (FindTag(FX_BSTRC("endobj"), 0) < 0) {
2465 return NULL; 2461 return NULL;
2466 } 2462 }
2467 } 2463 }
2468 } 2464 }
2469 m_Pos = StreamStartPos; 2465 m_Pos = StreamStartPos;
2470 } 2466 }
2471 CPDF_Stream* pStream; 2467 CPDF_Stream* pStream;
2472 #if defined(_FPDFAPI_MINI_) && !defined(_FXCORE_FEATURE_ALL_)
2473 pStream = FX_NEW CPDF_Stream(m_pFileAccess, pCryptoHandler, m_HeaderOffset + m_Pos, len, pDict, gennum);
2474 m_Pos += len;
2475 #else
2476 FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); 2468 FX_LPBYTE pData = FX_Alloc(FX_BYTE, len);
2477 if (!pData) { 2469 if (!pData) {
2478 return NULL; 2470 return NULL;
2479 } 2471 }
2480 ReadBlock(pData, len); 2472 ReadBlock(pData, len);
2481 if (pCryptoHandler) { 2473 if (pCryptoHandler) {
2482 CFX_BinaryBuf dest_buf; 2474 CFX_BinaryBuf dest_buf;
2483 dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len)); 2475 dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len));
2484 FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum); 2476 FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum);
2485 pCryptoHandler->DecryptStream(context, pData, len, dest_buf); 2477 pCryptoHandler->DecryptStream(context, pData, len, dest_buf);
2486 pCryptoHandler->DecryptFinish(context, dest_buf); 2478 pCryptoHandler->DecryptFinish(context, dest_buf);
2487 FX_Free(pData); 2479 FX_Free(pData);
2488 pData = dest_buf.GetBuffer(); 2480 pData = dest_buf.GetBuffer();
2489 len = dest_buf.GetSize(); 2481 len = dest_buf.GetSize();
2490 dest_buf.DetachBuffer(); 2482 dest_buf.DetachBuffer();
2491 } 2483 }
2492 pStream = FX_NEW CPDF_Stream(pData, len, pDict); 2484 pStream = FX_NEW CPDF_Stream(pData, len, pDict);
2493 #endif
2494 if (pContext) { 2485 if (pContext) {
2495 pContext->m_DataEnd = pContext->m_DataStart + len; 2486 pContext->m_DataEnd = pContext->m_DataStart + len;
2496 } 2487 }
2497 StreamStartPos = m_Pos; 2488 StreamStartPos = m_Pos;
2498 GetNextWord(); 2489 GetNextWord();
2499 if (m_WordSize == 6 && 0 == FXSYS_memcmp32(m_WordBuffer, "endobj", 6)) { 2490 if (m_WordSize == 6 && 0 == FXSYS_memcmp32(m_WordBuffer, "endobj", 6)) {
2500 m_Pos = StreamStartPos; 2491 m_Pos = StreamStartPos;
2501 } 2492 }
2502 return pStream; 2493 return pStream;
2503 } 2494 }
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after
4427 { 4418 {
4428 FX_INT32 iSize = m_childNode.GetSize(); 4419 FX_INT32 iSize = m_childNode.GetSize();
4429 for (FX_INT32 i = 0; i < iSize; ++i) { 4420 for (FX_INT32 i = 0; i < iSize; ++i) {
4430 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4421 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4431 if (pNode) { 4422 if (pNode) {
4432 delete pNode; 4423 delete pNode;
4433 } 4424 }
4434 } 4425 }
4435 m_childNode.RemoveAll(); 4426 m_childNode.RemoveAll();
4436 } 4427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698