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 "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 | 9 |
10 extern void ProcessParseError(FX_DWORD err_code); | 10 extern void ProcessParseError(FX_DWORD err_code); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 class CFPDF_DataAvail | 80 class CFPDF_DataAvail |
81 { | 81 { |
82 public: | 82 public: |
83 CFPDF_DataAvail() | 83 CFPDF_DataAvail() |
84 { | 84 { |
85 m_pDataAvail = NULL; | 85 m_pDataAvail = NULL; |
86 } | 86 } |
87 | 87 |
88 ~CFPDF_DataAvail() | 88 ~CFPDF_DataAvail() |
89 { | 89 { |
90 » » if (m_pDataAvail) delete m_pDataAvail; | 90 delete m_pDataAvail; |
91 } | 91 } |
92 | 92 |
93 IPDF_DataAvail* m_pDataAvail; | 93 IPDF_DataAvail* m_pDataAvail; |
94 CFPDF_FileAvailWrap m_FileAvail; | 94 CFPDF_FileAvailWrap m_FileAvail; |
95 CFPDF_FileAccessWrap m_FileRead; | 95 CFPDF_FileAccessWrap m_FileRead; |
96 }; | 96 }; |
97 | 97 |
98 DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FIL
EACCESS* file) | 98 DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FIL
EACCESS* file) |
99 { | 99 { |
100 CFPDF_DataAvail* pAvail = new CFPDF_DataAvail; | 100 CFPDF_DataAvail* pAvail = new CFPDF_DataAvail; |
101 pAvail->m_FileAvail.Set(file_avail); | 101 pAvail->m_FileAvail.Set(file_avail); |
102 pAvail->m_FileRead.Set(file); | 102 pAvail->m_FileRead.Set(file); |
103 pAvail->m_pDataAvail = IPDF_DataAvail::Create(&pAvail->m_FileAvail, &pAv
ail->m_FileRead); | 103 pAvail->m_pDataAvail = IPDF_DataAvail::Create(&pAvail->m_FileAvail, &pAv
ail->m_FileRead); |
104 return pAvail; | 104 return pAvail; |
105 } | 105 } |
106 | 106 |
107 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail) | 107 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail) |
108 { | 108 { |
109 » if (avail == NULL) return; | 109 delete (CFPDF_DataAvail*)avail; |
110 » delete (CFPDF_DataAvail*)avail; | |
111 } | 110 } |
112 | 111 |
113 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* h
ints) | 112 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* h
ints) |
114 { | 113 { |
115 if (avail == NULL || hints == NULL) return 0; | 114 if (avail == NULL || hints == NULL) return 0; |
116 CFPDF_DownloadHintsWrap hints_wrap(hints); | 115 CFPDF_DownloadHintsWrap hints_wrap(hints); |
117 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap); | 116 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap); |
118 } | 117 } |
119 | 118 |
120 extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); | 119 extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 CFPDF_DownloadHintsWrap hints_wrap(hints); | 155 CFPDF_DownloadHintsWrap hints_wrap(hints); |
157 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap)
; | 156 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap)
; |
158 } | 157 } |
159 | 158 |
160 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) | 159 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) |
161 { | 160 { |
162 if (avail == NULL) return -1; | 161 if (avail == NULL) return -1; |
163 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 162 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
164 | 163 |
165 } | 164 } |
OLD | NEW |