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 <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 class CFPDF_FileAccessWrap : public IFX_SeekableReadStream { | 60 class CFPDF_FileAccessWrap : public IFX_SeekableReadStream { |
61 public: | 61 public: |
62 CFPDF_FileAccessWrap() { m_pFileAccess = nullptr; } | 62 CFPDF_FileAccessWrap() { m_pFileAccess = nullptr; } |
63 ~CFPDF_FileAccessWrap() override {} | 63 ~CFPDF_FileAccessWrap() override {} |
64 | 64 |
65 void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } | 65 void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } |
66 | 66 |
67 // IFX_SeekableReadStream | 67 // IFX_SeekableReadStream |
68 FX_FILESIZE GetSize() override { return m_pFileAccess->m_FileLen; } | 68 FX_FILESIZE GetSize() override { return m_pFileAccess->m_FileLen; } |
69 | 69 |
70 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { | 70 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { |
71 return m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset, | 71 return !!m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset, |
72 (uint8_t*)buffer, size); | 72 (uint8_t*)buffer, size); |
73 } | 73 } |
74 | 74 |
75 void Release() override {} | 75 void Release() override {} |
76 | 76 |
77 private: | 77 private: |
78 FPDF_FILEACCESS* m_pFileAccess; | 78 FPDF_FILEACCESS* m_pFileAccess; |
79 }; | 79 }; |
80 | 80 |
81 class CFPDF_DownloadHintsWrap : public CPDF_DataAvail::DownloadHints { | 81 class CFPDF_DownloadHintsWrap : public CPDF_DataAvail::DownloadHints { |
82 public: | 82 public: |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 CFPDF_DownloadHintsWrap hints_wrap(hints); | 180 CFPDF_DownloadHintsWrap hints_wrap(hints); |
181 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( | 181 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( |
182 &hints_wrap); | 182 &hints_wrap); |
183 } | 183 } |
184 | 184 |
185 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 185 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
186 if (!avail) | 186 if (!avail) |
187 return PDF_LINEARIZATION_UNKNOWN; | 187 return PDF_LINEARIZATION_UNKNOWN; |
188 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); | 188 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); |
189 } | 189 } |
OLD | NEW |