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

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

Issue 1278533002: Merge to XFA: CPDF_Parser shouldnt be in the business of opening files (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 4 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/include/fpdfapi/fpdf_parser.h ('k') | fpdfsdk/src/fpdfview.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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "../../../include/fpdfapi/fpdf_module.h" 10 #include "../../../include/fpdfapi/fpdf_module.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if (*(FX_DWORD*)buf == tag) { 112 if (*(FX_DWORD*)buf == tag) {
113 return offset; 113 return offset;
114 } 114 }
115 offset++; 115 offset++;
116 if (offset > 1024) { 116 if (offset > 1024) {
117 return -1; 117 return -1;
118 } 118 }
119 } 119 }
120 return -1; 120 return -1;
121 } 121 }
122 FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, FX_BOOL bReParse) {
123 IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
124 if (!pFileAccess) {
125 return PDFPARSE_ERROR_FILE;
126 }
127 return StartParse(pFileAccess, bReParse);
128 }
129 FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, FX_BOOL bReParse) {
130 IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
131 if (!pFileAccess) {
132 return PDFPARSE_ERROR_FILE;
133 }
134 return StartParse(pFileAccess, bReParse);
135 }
136 CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler(); 122 CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler();
137 CPDF_SecurityHandler* FPDF_CreatePubKeyHandler(void*); 123 CPDF_SecurityHandler* FPDF_CreatePubKeyHandler(void*);
138 FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, 124 FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess,
139 FX_BOOL bReParse, 125 FX_BOOL bReParse,
140 FX_BOOL bOwnFileRead) { 126 FX_BOOL bOwnFileRead) {
141 CloseParser(bReParse); 127 CloseParser(bReParse);
142 m_bXRefStream = FALSE; 128 m_bXRefStream = FALSE;
143 m_LastXRefOffset = 0; 129 m_LastXRefOffset = 0;
144 m_bOwnFileRead = bOwnFileRead; 130 m_bOwnFileRead = bOwnFileRead;
145 int32_t offset = GetHeaderOffset(pFileAccess); 131 int32_t offset = GetHeaderOffset(pFileAccess);
(...skipping 4513 matching lines...) Expand 10 before | Expand all | Expand 10 after
4659 return FALSE; 4645 return FALSE;
4660 } 4646 }
4661 CPDF_PageNode::~CPDF_PageNode() { 4647 CPDF_PageNode::~CPDF_PageNode() {
4662 int32_t iSize = m_childNode.GetSize(); 4648 int32_t iSize = m_childNode.GetSize();
4663 for (int32_t i = 0; i < iSize; ++i) { 4649 for (int32_t i = 0; i < iSize; ++i) {
4664 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; 4650 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i];
4665 delete pNode; 4651 delete pNode;
4666 } 4652 }
4667 m_childNode.RemoveAll(); 4653 m_childNode.RemoveAll();
4668 } 4654 }
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_parser.h ('k') | fpdfsdk/src/fpdfview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698