From ad2441ef675866eb84c7392eeda03391a5a5d474 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 24 Oct 2016 10:19:11 -0700 Subject: Rename IFX_ stream names It's been troubling for some time that an IFX_FileStream might actually be an in-memory buffer with no backing file. Review-Url: https://codereview.chromium.org/2443723002 --- fpdfsdk/cpdfsdk_formfillenvironment.cpp | 2 +- fpdfsdk/cpdfsdk_formfillenvironment.h | 2 +- fpdfsdk/fpdf_dataavail.cpp | 4 ++-- fpdfsdk/fpdfeditimg.cpp | 2 +- fpdfsdk/fpdfsave.cpp | 2 +- fpdfsdk/fpdfview.cpp | 7 ++++--- fpdfsdk/fpdfxfa/cpdfxfa_app.cpp | 2 +- fpdfsdk/fpdfxfa/cpdfxfa_app.h | 2 +- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 2 +- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h | 4 ++-- fpdfsdk/fsdk_define.h | 10 +++++----- 11 files changed, 20 insertions(+), 19 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index 71b83b2655..d93e309d2f 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -470,7 +470,7 @@ FPDF_FILEHANDLER* CPDFSDK_FormFillEnvironment::OpenFile(int fileType, return nullptr; } -IFX_FileRead* CPDFSDK_FormFillEnvironment::DownloadFromURL( +IFX_SeekableReadStream* CPDFSDK_FormFillEnvironment::DownloadFromURL( const FX_WCHAR* url) { if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL) return nullptr; diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index f59999f9ce..4cdbda3f7c 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -147,7 +147,7 @@ class CPDFSDK_FormFillEnvironment FPDF_FILEHANDLER* OpenFile(int fileType, FPDF_WIDESTRING wsURL, const char* mode); - IFX_FileRead* DownloadFromURL(const FX_WCHAR* url); + IFX_SeekableReadStream* DownloadFromURL(const FX_WCHAR* url); CFX_WideString PostRequestURL(const FX_WCHAR* wsURL, const FX_WCHAR* wsData, const FX_WCHAR* wsContentType, diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp index fb866ec229..0bf67e9826 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -57,14 +57,14 @@ class CFPDF_FileAvailWrap : public CPDF_DataAvail::FileAvail { FX_FILEAVAIL* m_pfileAvail; }; -class CFPDF_FileAccessWrap : public IFX_FileRead { +class CFPDF_FileAccessWrap : public IFX_SeekableReadStream { public: CFPDF_FileAccessWrap() { m_pFileAccess = nullptr; } ~CFPDF_FileAccessWrap() override {} void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } - // IFX_FileRead + // IFX_SeekableReadStream FX_FILESIZE GetSize() override { return m_pFileAccess->m_FileLen; } FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp index 042ad2bf37..282244970d 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -32,7 +32,7 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, if (!image_object || !fileAccess || !pages) return FALSE; - IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess); + IFX_SeekableReadStream* pFile = new CPDF_CustomAccess(fileAccess); CPDF_ImageObject* pImgObj = reinterpret_cast(image_object); for (int index = 0; index < nCount; index++) { CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 364f4d2d6f..9cdc714f3f 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -36,7 +36,7 @@ #include #endif -class CFX_IFileWrite final : public IFX_StreamWrite { +class CFX_IFileWrite final : public IFX_WriteStream { public: CFX_IFileWrite(); FX_BOOL Init(FPDF_FILEWRITE* pFileWriteStruct); diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index e0c24ec792..92ca34effa 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -96,7 +96,7 @@ CFPDF_FileStream::CFPDF_FileStream(FPDF_FILEHANDLER* pFS) { m_nCurPos = 0; } -IFX_FileStream* CFPDF_FileStream::Retain() { +IFX_SeekableStream* CFPDF_FileStream::Retain() { return this; } @@ -325,7 +325,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password) { // NOTE: the creation of the file needs to be by the embedder on the // other side of this API. - IFX_FileRead* pFileAccess = FX_CreateFileRead((const FX_CHAR*)file_path); + IFX_SeekableReadStream* pFileAccess = + FX_CreateFileRead((const FX_CHAR*)file_path); if (!pFileAccess) { return nullptr; } @@ -381,7 +382,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) { } #endif // PDF_ENABLE_XFA -class CMemFile final : public IFX_FileRead { +class CMemFile final : public IFX_SeekableReadStream { public: CMemFile(uint8_t* pBuf, FX_FILESIZE size) : m_pBuf(pBuf), m_size(size) {} diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp index 61694d0a28..dc5c4be0d6 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp @@ -187,7 +187,7 @@ CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, return wsAnswer; } -IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { +IFX_SeekableReadStream* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); return pFormFillEnv ? pFormFillEnv->DownloadFromURL(wsURL.c_str()) : nullptr; } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_app.h b/fpdfsdk/fpdfxfa/cpdfxfa_app.h index 78184d1434..9ec045f540 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_app.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_app.h @@ -48,7 +48,7 @@ class CPDFXFA_App : public IXFA_AppProvider { const CFX_WideString& wsDefaultAnswer, FX_BOOL bMark) override; - IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) override; + IFX_SeekableReadStream* DownloadURL(const CFX_WideString& wsURL) override; FX_BOOL PostRequestURL(const CFX_WideString& wsURL, const CFX_WideString& wsData, const CFX_WideString& wsContentType, diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 7e7ee50825..13b79baf9b 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -704,7 +704,7 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, return ret; } -IFX_FileRead* CPDFXFA_DocEnvironment::OpenLinkedFile( +IFX_SeekableReadStream* CPDFXFA_DocEnvironment::OpenLinkedFile( CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) { CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h index 537e1ebed3..999d44586c 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h @@ -85,8 +85,8 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) override; - IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, - const CFX_WideString& wsLink) override; + IFX_SeekableReadStream* OpenLinkedFile(CXFA_FFDoc* hDoc, + const CFX_WideString& wsLink) override; private: FX_BOOL OnBeforeNotifySubmit(); diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h index b59a3c2657..4fea138779 100644 --- a/fpdfsdk/fsdk_define.h +++ b/fpdfsdk/fsdk_define.h @@ -25,12 +25,12 @@ class CPDF_Page; class CPDF_PageRenderContext; class IFSDK_PAUSE_Adapter; -class CPDF_CustomAccess final : public IFX_FileRead { +class CPDF_CustomAccess final : public IFX_SeekableReadStream { public: explicit CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess); ~CPDF_CustomAccess() override {} - // IFX_FileRead + // IFX_SeekableReadStream FX_FILESIZE GetSize() override; void Release() override; FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; @@ -40,13 +40,13 @@ class CPDF_CustomAccess final : public IFX_FileRead { }; #ifdef PDF_ENABLE_XFA -class CFPDF_FileStream : public IFX_FileStream { +class CFPDF_FileStream : public IFX_SeekableStream { public: explicit CFPDF_FileStream(FPDF_FILEHANDLER* pFS); ~CFPDF_FileStream() override {} - // IFX_FileStream: - IFX_FileStream* Retain() override; + // IFX_SeekableStream: + IFX_SeekableStream* Retain() override; void Release() override; FX_FILESIZE GetSize() override; FX_BOOL IsEOF() override; -- cgit v1.2.3