| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 std::unique_ptr<CPDF_Parser> pParser(new CPDF_Parser); | 139 std::unique_ptr<CPDF_Parser> pParser(new CPDF_Parser); |
| 140 pParser->SetPassword(password); | 140 pParser->SetPassword(password); |
| 141 | 141 |
| 142 std::unique_ptr<CPDF_Document> pDocument(new CPDF_Document(pParser.get())); | 142 std::unique_ptr<CPDF_Document> pDocument(new CPDF_Document(pParser.get())); |
| 143 CPDF_Parser::Error error = pParser->StartAsyncParse( | 143 CPDF_Parser::Error error = pParser->StartLinearizedParse( |
| 144 pDataAvail->m_pDataAvail->GetFileRead(), std::move(pDocument)); | 144 pDataAvail->m_pDataAvail->GetFileRead(), std::move(pDocument)); |
| 145 if (error != CPDF_Parser::SUCCESS) { | 145 if (error != CPDF_Parser::SUCCESS) { |
| 146 ProcessParseError(error); | 146 ProcessParseError(error); |
| 147 return nullptr; | 147 return nullptr; |
| 148 } | 148 } |
| 149 pDataAvail->m_pDataAvail->SetDocument(pParser->GetDocument()); | 149 pDataAvail->m_pDataAvail->SetDocument(pParser->GetDocument()); |
| 150 CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS); | 150 CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS); |
| 151 return FPDFDocumentFromCPDFDocument(pParser.release()->GetDocument()); | 151 return FPDFDocumentFromCPDFDocument(pParser.release()->GetDocument()); |
| 152 } | 152 } |
| 153 | 153 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 173 CFPDF_DownloadHintsWrap hints_wrap(hints); | 173 CFPDF_DownloadHintsWrap hints_wrap(hints); |
| 174 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( | 174 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( |
| 175 &hints_wrap); | 175 &hints_wrap); |
| 176 } | 176 } |
| 177 | 177 |
| 178 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 178 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
| 179 if (!avail) | 179 if (!avail) |
| 180 return PDF_LINEARIZATION_UNKNOWN; | 180 return PDF_LINEARIZATION_UNKNOWN; |
| 181 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); | 181 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); |
| 182 } | 182 } |
| OLD | NEW |