diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdf_dataavail.cpp | 62 | ||||
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 34 |
2 files changed, 48 insertions, 48 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(); } diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index df46ec5218..5312383000 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -168,12 +168,12 @@ bool CPDF_CustomAccess::ReadBlock(void* buffer, } #ifdef PDF_ENABLE_XFA -class CFPDF_FileStream : public IFX_SeekableStream { +class FPDF_FileHandlerContext : public IFX_SeekableStream { public: template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); - ~CFPDF_FileStream() override; + ~FPDF_FileHandlerContext() override; // IFX_SeekableStream: FX_FILESIZE GetSize() override; @@ -187,39 +187,39 @@ class CFPDF_FileStream : public IFX_SeekableStream { void SetPosition(FX_FILESIZE pos) { m_nCurPos = pos; } protected: - explicit CFPDF_FileStream(FPDF_FILEHANDLER* pFS); + explicit FPDF_FileHandlerContext(FPDF_FILEHANDLER* pFS); FPDF_FILEHANDLER* m_pFS; FX_FILESIZE m_nCurPos; }; -CFPDF_FileStream::CFPDF_FileStream(FPDF_FILEHANDLER* pFS) { +FPDF_FileHandlerContext::FPDF_FileHandlerContext(FPDF_FILEHANDLER* pFS) { m_pFS = pFS; m_nCurPos = 0; } -CFPDF_FileStream::~CFPDF_FileStream() { +FPDF_FileHandlerContext::~FPDF_FileHandlerContext() { if (m_pFS && m_pFS->Release) m_pFS->Release(m_pFS->clientData); } -FX_FILESIZE CFPDF_FileStream::GetSize() { +FX_FILESIZE FPDF_FileHandlerContext::GetSize() { if (m_pFS && m_pFS->GetSize) return (FX_FILESIZE)m_pFS->GetSize(m_pFS->clientData); return 0; } -bool CFPDF_FileStream::IsEOF() { +bool FPDF_FileHandlerContext::IsEOF() { return m_nCurPos >= GetSize(); } -FX_FILESIZE CFPDF_FileStream::GetPosition() { +FX_FILESIZE FPDF_FileHandlerContext::GetPosition() { return m_nCurPos; } -bool CFPDF_FileStream::ReadBlock(void* buffer, - FX_FILESIZE offset, - size_t size) { +bool FPDF_FileHandlerContext::ReadBlock(void* buffer, + FX_FILESIZE offset, + size_t size) { if (!buffer || !size || !m_pFS->ReadBlock) return false; @@ -231,7 +231,7 @@ bool CFPDF_FileStream::ReadBlock(void* buffer, return false; } -size_t CFPDF_FileStream::ReadBlock(void* buffer, size_t size) { +size_t FPDF_FileHandlerContext::ReadBlock(void* buffer, size_t size) { if (!buffer || !size || !m_pFS->ReadBlock) return 0; @@ -250,9 +250,9 @@ size_t CFPDF_FileStream::ReadBlock(void* buffer, size_t size) { return 0; } -bool CFPDF_FileStream::WriteBlock(const void* buffer, - FX_FILESIZE offset, - size_t size) { +bool FPDF_FileHandlerContext::WriteBlock(const void* buffer, + FX_FILESIZE offset, + size_t size) { if (!m_pFS || !m_pFS->WriteBlock) return false; @@ -264,7 +264,7 @@ bool CFPDF_FileStream::WriteBlock(const void* buffer, return false; } -bool CFPDF_FileStream::Flush() { +bool FPDF_FileHandlerContext::Flush() { if (!m_pFS || !m_pFS->Flush) return true; @@ -417,7 +417,7 @@ RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream( #ifdef PDF_ENABLE_XFA RetainPtr<IFX_SeekableStream> MakeSeekableStream( FPDF_FILEHANDLER* pFilehandler) { - return pdfium::MakeRetain<CFPDF_FileStream>(pFilehandler); + return pdfium::MakeRetain<FPDF_FileHandlerContext>(pFilehandler); } #endif // PDF_ENABLE_XFA |