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

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

Issue 1269073003: CPDF_Parser shouldnt be in the business of opening files (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (*(FX_DWORD*)buf == tag) { 109 if (*(FX_DWORD*)buf == tag) {
110 return offset; 110 return offset;
111 } 111 }
112 offset++; 112 offset++;
113 if (offset > 1024) { 113 if (offset > 1024) {
114 return -1; 114 return -1;
115 } 115 }
116 } 116 }
117 return -1; 117 return -1;
118 } 118 }
119 FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, FX_BOOL bReParse) {
120 IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
121 if (!pFileAccess) {
122 return PDFPARSE_ERROR_FILE;
123 }
124 return StartParse(pFileAccess, bReParse);
125 }
126 FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, FX_BOOL bReParse) {
127 IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
128 if (!pFileAccess) {
129 return PDFPARSE_ERROR_FILE;
130 }
131 return StartParse(pFileAccess, bReParse);
132 }
133 CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler(); 119 CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler();
134 CPDF_SecurityHandler* FPDF_CreatePubKeyHandler(void*); 120 CPDF_SecurityHandler* FPDF_CreatePubKeyHandler(void*);
135 FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, 121 FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess,
136 FX_BOOL bReParse, 122 FX_BOOL bReParse,
137 FX_BOOL bOwnFileRead) { 123 FX_BOOL bOwnFileRead) {
138 CloseParser(bReParse); 124 CloseParser(bReParse);
139 m_bXRefStream = FALSE; 125 m_bXRefStream = FALSE;
140 m_LastXRefOffset = 0; 126 m_LastXRefOffset = 0;
141 m_bOwnFileRead = bOwnFileRead; 127 m_bOwnFileRead = bOwnFileRead;
142 int32_t offset = GetHeaderOffset(pFileAccess); 128 int32_t offset = GetHeaderOffset(pFileAccess);
(...skipping 4507 matching lines...) Expand 10 before | Expand all | Expand 10 after
4650 return FALSE; 4636 return FALSE;
4651 } 4637 }
4652 CPDF_PageNode::~CPDF_PageNode() { 4638 CPDF_PageNode::~CPDF_PageNode() {
4653 int32_t iSize = m_childNode.GetSize(); 4639 int32_t iSize = m_childNode.GetSize();
4654 for (int32_t i = 0; i < iSize; ++i) { 4640 for (int32_t i = 0; i < iSize; ++i) {
4655 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; 4641 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i];
4656 delete pNode; 4642 delete pNode;
4657 } 4643 }
4658 m_childNode.RemoveAll(); 4644 m_childNode.RemoveAll();
4659 } 4645 }
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