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 #include "../../public/fpdf_formfill.h" | 8 #include "../../public/fpdf_formfill.h" |
9 #include "../include/fsdk_define.h" | 9 #include "../include/fsdk_define.h" |
10 | 10 |
| 11 // These checks are here because core/ and public/ cannot depend on each other. |
| 12 static_assert(IPDF_DataAvail::DataError == PDF_DATA_ERROR, |
| 13 "IPDF_DataAvail::DataError value mismatch"); |
| 14 static_assert(IPDF_DataAvail::DataNotAvailable == PDF_DATA_NOTAVAIL, |
| 15 "IPDF_DataAvail::DataNotAvailable value mismatch"); |
| 16 static_assert(IPDF_DataAvail::DataAvailable == PDF_DATA_AVAIL, |
| 17 "IPDF_DataAvail::DataAvailable value mismatch"); |
| 18 |
| 19 static_assert(IPDF_DataAvail::LinearizationUnknown == PDF_LINEARIZATION_UNKNOWN, |
| 20 "IPDF_DataAvail::LinearizationUnknown value mismatch"); |
| 21 static_assert(IPDF_DataAvail::NotLinearized == PDF_NOT_LINEARIZED, |
| 22 "IPDF_DataAvail::NotLinearized value mismatch"); |
| 23 static_assert(IPDF_DataAvail::Linearized == PDF_LINEARIZED, |
| 24 "IPDF_DataAvail::Linearized value mismatch"); |
| 25 |
| 26 static_assert(IPDF_DataAvail::FormError == PDF_FORM_ERROR, |
| 27 "IPDF_DataAvail::FormError value mismatch"); |
| 28 static_assert(IPDF_DataAvail::FormNotAvailable == PDF_FORM_NOTAVAIL, |
| 29 "IPDF_DataAvail::FormNotAvailable value mismatch"); |
| 30 static_assert(IPDF_DataAvail::FormAvailable == PDF_FORM_AVAIL, |
| 31 "IPDF_DataAvail::FormAvailable value mismatch"); |
| 32 static_assert(IPDF_DataAvail::FormNotExist == PDF_FORM_NOTEXIST, |
| 33 "IPDF_DataAvail::FormNotExist value mismatch"); |
| 34 |
11 class CFPDF_FileAvailWrap : public IFX_FileAvail { | 35 class CFPDF_FileAvailWrap : public IFX_FileAvail { |
12 public: | 36 public: |
13 CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } | 37 CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } |
14 ~CFPDF_FileAvailWrap() override {} | 38 ~CFPDF_FileAvailWrap() override {} |
15 | 39 |
16 void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } | 40 void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } |
17 | 41 |
18 // IFX_FileAvail | 42 // IFX_FileAvail |
19 FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) override { | 43 FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) override { |
20 return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); | 44 return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return PDF_FORM_ERROR; | 161 return PDF_FORM_ERROR; |
138 CFPDF_DownloadHintsWrap hints_wrap(hints); | 162 CFPDF_DownloadHintsWrap hints_wrap(hints); |
139 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 163 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
140 } | 164 } |
141 | 165 |
142 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 166 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
143 if (!avail) | 167 if (!avail) |
144 return PDF_LINEARIZATION_UNKNOWN; | 168 return PDF_LINEARIZATION_UNKNOWN; |
145 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 169 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
146 } | 170 } |
OLD | NEW |