| OLD | NEW |
| 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 "public/fpdf_dataavail.h" | 7 #include "public/fpdf_dataavail.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 DLLEXPORT FPDF_DOCUMENT STDCALL | 133 DLLEXPORT FPDF_DOCUMENT STDCALL |
| 134 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { | 134 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { |
| 135 CFPDF_DataAvail* pDataAvail = static_cast<CFPDF_DataAvail*>(avail); | 135 CFPDF_DataAvail* pDataAvail = static_cast<CFPDF_DataAvail*>(avail); |
| 136 if (!pDataAvail) | 136 if (!pDataAvail) |
| 137 return nullptr; | 137 return nullptr; |
| 138 | 138 |
| 139 CPDF_Parser* pParser = new CPDF_Parser; | 139 CPDF_Parser* pParser = new CPDF_Parser; |
| 140 pParser->SetPassword(password); | 140 pParser->SetPassword(password); |
| 141 CPDF_Parser::Error error = | 141 CPDF_Parser::Error error = |
| 142 pParser->StartAsyncParse(pDataAvail->m_pDataAvail->GetFileRead()); | 142 pParser->StartLinearizedParse(pDataAvail->m_pDataAvail->GetFileRead()); |
| 143 if (error != CPDF_Parser::SUCCESS) { | 143 if (error != CPDF_Parser::SUCCESS) { |
| 144 delete pParser; | 144 delete pParser; |
| 145 ProcessParseError(error); | 145 ProcessParseError(error); |
| 146 return nullptr; | 146 return nullptr; |
| 147 } | 147 } |
| 148 pDataAvail->m_pDataAvail->SetDocument(pParser->GetDocument()); | 148 pDataAvail->m_pDataAvail->SetDocument(pParser->GetDocument()); |
| 149 CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS); | 149 CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS); |
| 150 return FPDFDocumentFromCPDFDocument(pParser->GetDocument()); | 150 return FPDFDocumentFromCPDFDocument(pParser->GetDocument()); |
| 151 } | 151 } |
| 152 | 152 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 172 CFPDF_DownloadHintsWrap hints_wrap(hints); | 172 CFPDF_DownloadHintsWrap hints_wrap(hints); |
| 173 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( | 173 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( |
| 174 &hints_wrap); | 174 &hints_wrap); |
| 175 } | 175 } |
| 176 | 176 |
| 177 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 177 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
| 178 if (!avail) | 178 if (!avail) |
| 179 return PDF_LINEARIZATION_UNKNOWN; | 179 return PDF_LINEARIZATION_UNKNOWN; |
| 180 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); | 180 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); |
| 181 } | 181 } |
| OLD | NEW |