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

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

Issue 809513002: XFA: merge patch from issue 801913002 and 804463003 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
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
« no previous file with comments | « core/src/fpdfapi/fpdf_page/pageint.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render.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 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 } 1674 }
1675 CPDF_SyntaxParser::CPDF_SyntaxParser() 1675 CPDF_SyntaxParser::CPDF_SyntaxParser()
1676 { 1676 {
1677 m_pFileAccess = NULL; 1677 m_pFileAccess = NULL;
1678 m_pCryptoHandler = NULL; 1678 m_pCryptoHandler = NULL;
1679 m_pFileBuf = NULL; 1679 m_pFileBuf = NULL;
1680 m_BufSize = CPDF_ModuleMgr::Get()->m_FileBufSize; 1680 m_BufSize = CPDF_ModuleMgr::Get()->m_FileBufSize;
1681 m_pFileBuf = NULL; 1681 m_pFileBuf = NULL;
1682 m_MetadataObjnum = 0; 1682 m_MetadataObjnum = 0;
1683 m_dwWordPos = 0; 1683 m_dwWordPos = 0;
1684 #if defined(_FPDFAPI_MINI_)
1685 m_bFileStream = TRUE;
1686 #else
1687 m_bFileStream = FALSE; 1684 m_bFileStream = FALSE;
1688 #endif
1689 } 1685 }
1690 CPDF_SyntaxParser::~CPDF_SyntaxParser() 1686 CPDF_SyntaxParser::~CPDF_SyntaxParser()
1691 { 1687 {
1692 if (m_pFileBuf) { 1688 if (m_pFileBuf) {
1693 FX_Free(m_pFileBuf); 1689 FX_Free(m_pFileBuf);
1694 } 1690 }
1695 } 1691 }
1696 FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) 1692 FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch)
1697 { 1693 {
1698 FX_FILESIZE save_pos = m_Pos; 1694 FX_FILESIZE save_pos = m_Pos;
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
2466 } else { 2462 } else {
2467 m_Pos = StreamStartPos; 2463 m_Pos = StreamStartPos;
2468 if (FindTag(FX_BSTRC("endobj"), 0) < 0) { 2464 if (FindTag(FX_BSTRC("endobj"), 0) < 0) {
2469 return NULL; 2465 return NULL;
2470 } 2466 }
2471 } 2467 }
2472 } 2468 }
2473 m_Pos = StreamStartPos; 2469 m_Pos = StreamStartPos;
2474 } 2470 }
2475 CPDF_Stream* pStream; 2471 CPDF_Stream* pStream;
2476 #if defined(_FPDFAPI_MINI_) && !defined(_FXCORE_FEATURE_ALL_)
2477 pStream = FX_NEW CPDF_Stream(m_pFileAccess, pCryptoHandler, m_HeaderOffset + m_Pos, len, pDict, gennum);
2478 m_Pos += len;
2479 #else
2480 FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); 2472 FX_LPBYTE pData = FX_Alloc(FX_BYTE, len);
2481 if (!pData) { 2473 if (!pData) {
2482 return NULL; 2474 return NULL;
2483 } 2475 }
2484 ReadBlock(pData, len); 2476 ReadBlock(pData, len);
2485 if (pCryptoHandler) { 2477 if (pCryptoHandler) {
2486 CFX_BinaryBuf dest_buf; 2478 CFX_BinaryBuf dest_buf;
2487 dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len)); 2479 dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len));
2488 FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum); 2480 FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum);
2489 pCryptoHandler->DecryptStream(context, pData, len, dest_buf); 2481 pCryptoHandler->DecryptStream(context, pData, len, dest_buf);
2490 pCryptoHandler->DecryptFinish(context, dest_buf); 2482 pCryptoHandler->DecryptFinish(context, dest_buf);
2491 FX_Free(pData); 2483 FX_Free(pData);
2492 pData = dest_buf.GetBuffer(); 2484 pData = dest_buf.GetBuffer();
2493 len = dest_buf.GetSize(); 2485 len = dest_buf.GetSize();
2494 dest_buf.DetachBuffer(); 2486 dest_buf.DetachBuffer();
2495 } 2487 }
2496 pStream = FX_NEW CPDF_Stream(pData, len, pDict); 2488 pStream = FX_NEW CPDF_Stream(pData, len, pDict);
2497 #endif
2498 if (pContext) { 2489 if (pContext) {
2499 pContext->m_DataEnd = pContext->m_DataStart + len; 2490 pContext->m_DataEnd = pContext->m_DataStart + len;
2500 } 2491 }
2501 StreamStartPos = m_Pos; 2492 StreamStartPos = m_Pos;
2502 GetNextWord(); 2493 GetNextWord();
2503 if (m_WordSize == 6 && 0 == FXSYS_memcmp32(m_WordBuffer, "endobj", 6)) { 2494 if (m_WordSize == 6 && 0 == FXSYS_memcmp32(m_WordBuffer, "endobj", 6)) {
2504 m_Pos = StreamStartPos; 2495 m_Pos = StreamStartPos;
2505 } 2496 }
2506 return pStream; 2497 return pStream;
2507 } 2498 }
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after
4431 { 4422 {
4432 FX_INT32 iSize = m_childNode.GetSize(); 4423 FX_INT32 iSize = m_childNode.GetSize();
4433 for (FX_INT32 i = 0; i < iSize; ++i) { 4424 for (FX_INT32 i = 0; i < iSize; ++i) {
4434 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4425 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4435 if (pNode) { 4426 if (pNode) {
4436 delete pNode; 4427 delete pNode;
4437 } 4428 }
4438 } 4429 }
4439 m_childNode.RemoveAll(); 4430 m_childNode.RemoveAll();
4440 } 4431 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/pageint.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698