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 "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
10 #include "public/fpdf_formfill.h" | 10 #include "public/fpdf_formfill.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 DLLEXPORT int STDCALL | 115 DLLEXPORT int STDCALL |
116 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints) { | 116 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints) { |
117 if (!avail || !hints) | 117 if (!avail || !hints) |
118 return PDF_DATA_ERROR; | 118 return PDF_DATA_ERROR; |
119 CFPDF_DownloadHintsWrap hints_wrap(hints); | 119 CFPDF_DownloadHintsWrap hints_wrap(hints); |
120 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap); | 120 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap); |
121 } | 121 } |
122 | 122 |
123 DLLEXPORT FPDF_DOCUMENT STDCALL | 123 DLLEXPORT FPDF_DOCUMENT STDCALL |
124 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { | 124 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { |
125 if (avail == NULL) | 125 if (!avail) |
126 return NULL; | 126 return NULL; |
127 CPDF_Parser* pParser = new CPDF_Parser; | 127 CPDF_Parser* pParser = new CPDF_Parser; |
128 pParser->SetPassword(password); | 128 pParser->SetPassword(password); |
129 | 129 |
130 FX_DWORD err_code = pParser->StartAsynParse( | 130 FX_DWORD err_code = pParser->StartAsynParse( |
131 ((CFPDF_DataAvail*)avail)->m_pDataAvail->GetFileRead()); | 131 ((CFPDF_DataAvail*)avail)->m_pDataAvail->GetFileRead()); |
132 if (err_code) { | 132 if (err_code) { |
133 delete pParser; | 133 delete pParser; |
134 ProcessParseError(err_code); | 134 ProcessParseError(err_code); |
135 return NULL; | 135 return NULL; |
(...skipping 24 matching lines...) Expand all Loading... |
160 return PDF_FORM_ERROR; | 160 return PDF_FORM_ERROR; |
161 CFPDF_DownloadHintsWrap hints_wrap(hints); | 161 CFPDF_DownloadHintsWrap hints_wrap(hints); |
162 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 162 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
163 } | 163 } |
164 | 164 |
165 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 165 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
166 if (!avail) | 166 if (!avail) |
167 return PDF_LINEARIZATION_UNKNOWN; | 167 return PDF_LINEARIZATION_UNKNOWN; |
168 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 168 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
169 } | 169 } |
OLD | NEW |