diff options
Diffstat (limited to 'fpdfsdk/fpdf_dataavail.cpp')
-rw-r--r-- | fpdfsdk/fpdf_dataavail.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp index 7232def75d..f781a3d59f 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -43,10 +43,10 @@ static_assert(CPDF_DataAvail::FormNotExist == PDF_FORM_NOTEXIST, namespace { -class CFPDF_FileAvailWrap : public CPDF_DataAvail::FileAvail { +class FPDF_FileAvailContext : public CPDF_DataAvail::FileAvail { public: - CFPDF_FileAvailWrap() : m_pfileAvail(nullptr) {} - ~CFPDF_FileAvailWrap() override {} + FPDF_FileAvailContext() : m_pfileAvail(nullptr) {} + ~FPDF_FileAvailContext() override {} void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } @@ -59,12 +59,12 @@ class CFPDF_FileAvailWrap : public CPDF_DataAvail::FileAvail { FX_FILEAVAIL* m_pfileAvail; }; -class CFPDF_FileAccessWrap : public IFX_SeekableReadStream { +class FPDF_FileAccessContext : public IFX_SeekableReadStream { public: template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); - ~CFPDF_FileAccessWrap() override {} + ~FPDF_FileAccessContext() override {} void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } @@ -77,17 +77,17 @@ class CFPDF_FileAccessWrap : public IFX_SeekableReadStream { } private: - CFPDF_FileAccessWrap() : m_pFileAccess(nullptr) {} + FPDF_FileAccessContext() : m_pFileAccess(nullptr) {} FPDF_FILEACCESS* m_pFileAccess; }; -class CFPDF_DownloadHintsWrap : public CPDF_DataAvail::DownloadHints { +class FPDF_DownloadHintsContext : public CPDF_DataAvail::DownloadHints { public: - explicit CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { + explicit FPDF_DownloadHintsContext(FX_DOWNLOADHINTS* pDownloadHints) { m_pDownloadHints = pDownloadHints; } - ~CFPDF_DownloadHintsWrap() override {} + ~FPDF_DownloadHintsContext() override {} public: // IFX_DownloadHints @@ -99,27 +99,27 @@ class CFPDF_DownloadHintsWrap : public CPDF_DataAvail::DownloadHints { FX_DOWNLOADHINTS* m_pDownloadHints; }; -class CFPDF_DataAvail { +class FPDF_AvailContext { public: - CFPDF_DataAvail() - : m_FileAvail(pdfium::MakeUnique<CFPDF_FileAvailWrap>()), - m_FileRead(pdfium::MakeRetain<CFPDF_FileAccessWrap>()) {} - ~CFPDF_DataAvail() {} + FPDF_AvailContext() + : m_FileAvail(pdfium::MakeUnique<FPDF_FileAvailContext>()), + m_FileRead(pdfium::MakeRetain<FPDF_FileAccessContext>()) {} + ~FPDF_AvailContext() {} - std::unique_ptr<CFPDF_FileAvailWrap> m_FileAvail; - RetainPtr<CFPDF_FileAccessWrap> m_FileRead; + std::unique_ptr<FPDF_FileAvailContext> m_FileAvail; + RetainPtr<FPDF_FileAccessContext> m_FileRead; std::unique_ptr<CPDF_DataAvail> m_pDataAvail; }; -CFPDF_DataAvail* CFPDFDataAvailFromFPDFAvail(FPDF_AVAIL avail) { - return static_cast<CFPDF_DataAvail*>(avail); +FPDF_AvailContext* FPDFAvailContextFromFPDFAvail(FPDF_AVAIL avail) { + return static_cast<FPDF_AvailContext*>(avail); } } // namespace FPDF_EXPORT FPDF_AVAIL FPDF_CALLCONV FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FILEACCESS* file) { - auto pAvail = pdfium::MakeUnique<CFPDF_DataAvail>(); + auto pAvail = pdfium::MakeUnique<FPDF_AvailContext>(); pAvail->m_FileAvail->Set(file_avail); pAvail->m_FileRead->Set(file); pAvail->m_pDataAvail = pdfium::MakeUnique<CPDF_DataAvail>( @@ -129,21 +129,21 @@ FPDF_EXPORT FPDF_AVAIL FPDF_CALLCONV FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_EXPORT void FPDF_CALLCONV FPDFAvail_Destroy(FPDF_AVAIL avail) { // Take ownership back from caller and destroy. - std::unique_ptr<CFPDF_DataAvail>(static_cast<CFPDF_DataAvail*>(avail)); + std::unique_ptr<FPDF_AvailContext>(FPDFAvailContextFromFPDFAvail(avail)); } FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints) { if (!avail || !hints) return PDF_DATA_ERROR; - CFPDF_DownloadHintsWrap hints_wrap(hints); - return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsDocAvail( - &hints_wrap); + FPDF_DownloadHintsContext hints_context(hints); + return FPDFAvailContextFromFPDFAvail(avail)->m_pDataAvail->IsDocAvail( + &hints_context); } FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { - CFPDF_DataAvail* pDataAvail = static_cast<CFPDF_DataAvail*>(avail); + auto* pDataAvail = FPDFAvailContextFromFPDFAvail(avail); if (!pDataAvail) return nullptr; @@ -174,22 +174,22 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail, return PDF_DATA_ERROR; if (page_index < 0) return PDF_DATA_NOTAVAIL; - CFPDF_DownloadHintsWrap hints_wrap(hints); - return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsPageAvail( - page_index, &hints_wrap); + FPDF_DownloadHintsContext hints_context(hints); + return FPDFAvailContextFromFPDFAvail(avail)->m_pDataAvail->IsPageAvail( + page_index, &hints_context); } FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsFormAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints) { if (!avail || !hints) return PDF_FORM_ERROR; - CFPDF_DownloadHintsWrap hints_wrap(hints); - return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( - &hints_wrap); + FPDF_DownloadHintsContext hints_context(hints); + return FPDFAvailContextFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( + &hints_context); } FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsLinearized(FPDF_AVAIL avail) { if (!avail) return PDF_LINEARIZATION_UNKNOWN; - return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); + return FPDFAvailContextFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); } |