diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-09-21 15:49:49 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-21 20:17:31 +0000 |
commit | 0b95042db2e6dab5876abd12ce485fff0a8e08fe (patch) | |
tree | 02132ed53945fde30bfbf230ff4e9b5308dd7732 /core/fpdfapi/parser | |
parent | a5eb9f05b7c3f82630784e043ccf75c4e019b18f (diff) | |
download | pdfium-0b95042db2e6dab5876abd12ce485fff0a8e08fe.tar.xz |
Rename CFX_RetainPtr to RetainPtr
This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt
namespace.
Bug: pdfium:898
Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e
Reviewed-on: https://pdfium-review.googlesource.com/14616
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
22 files changed, 76 insertions, 80 deletions
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp index 1f84f56547..1d5cf8ade7 100644 --- a/core/fpdfapi/parser/cfdf_document.cpp +++ b/core/fpdfapi/parser/cfdf_document.cpp @@ -30,7 +30,7 @@ std::unique_ptr<CFDF_Document> CFDF_Document::CreateNewDoc() { } std::unique_ptr<CFDF_Document> CFDF_Document::ParseFile( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) { + const RetainPtr<IFX_SeekableReadStream>& pFile) { if (!pFile) return nullptr; @@ -46,7 +46,7 @@ std::unique_ptr<CFDF_Document> CFDF_Document::ParseMemory(uint8_t* pData, } void CFDF_Document::ParseStream( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) { + const RetainPtr<IFX_SeekableReadStream>& pFile) { m_pFile = pFile; CPDF_SyntaxParser parser; parser.InitParser(m_pFile, 0); diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h index a24415b099..9065621ea7 100644 --- a/core/fpdfapi/parser/cfdf_document.h +++ b/core/fpdfapi/parser/cfdf_document.h @@ -20,7 +20,7 @@ class CFDF_Document : public CPDF_IndirectObjectHolder { public: static std::unique_ptr<CFDF_Document> CreateNewDoc(); static std::unique_ptr<CFDF_Document> ParseFile( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFile); + const RetainPtr<IFX_SeekableReadStream>& pFile); static std::unique_ptr<CFDF_Document> ParseMemory(uint8_t* pData, uint32_t size); @@ -31,10 +31,10 @@ class CFDF_Document : public CPDF_IndirectObjectHolder { CPDF_Dictionary* GetRoot() const { return m_pRootDict.Get(); } protected: - void ParseStream(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile); + void ParseStream(const RetainPtr<IFX_SeekableReadStream>& pFile); CFX_UnownedPtr<CPDF_Dictionary> m_pRootDict; - CFX_RetainPtr<IFX_SeekableReadStream> m_pFile; + RetainPtr<IFX_SeekableReadStream> m_pFile; }; #endif // CORE_FPDFAPI_PARSER_CFDF_DOCUMENT_H_ diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.h b/core/fpdfapi/parser/cpdf_crypto_handler.h index 252f41c333..d815e786f6 100644 --- a/core/fpdfapi/parser/cpdf_crypto_handler.h +++ b/core/fpdfapi/parser/cpdf_crypto_handler.h @@ -11,18 +11,18 @@ #include "core/fdrm/crypto/fx_crypt.h" #include "core/fxcrt/cfx_binarybuf.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" class CPDF_Dictionary; class CPDF_SecurityHandler; -class CPDF_CryptoHandler : public CFX_Retainable { +class CPDF_CryptoHandler : public Retainable { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); bool Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler); diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index bbd61dda00..5dd6285526 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -76,7 +76,7 @@ CPDF_DataAvail::DownloadHints::~DownloadHints() {} CPDF_DataAvail::CPDF_DataAvail( FileAvail* pFileAvail, - const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead, + const RetainPtr<IFX_SeekableReadStream>& pFileRead, bool bSupportHintTable) : m_pFileAvail(pFileAvail) { ASSERT(pFileRead); @@ -1422,11 +1422,11 @@ bool CPDF_DataAvail::CheckResources() { return true; } -CFX_RetainPtr<IFX_SeekableReadStream> CPDF_DataAvail::GetFileRead() const { +RetainPtr<IFX_SeekableReadStream> CPDF_DataAvail::GetFileRead() const { return m_pFileRead; } -CFX_RetainPtr<CPDF_ReadValidator> CPDF_DataAvail::GetValidator() const { +RetainPtr<CPDF_ReadValidator> CPDF_DataAvail::GetValidator() const { return m_pFileRead; } diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h index befb84f833..f48abb5be0 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.h +++ b/core/fpdfapi/parser/cpdf_data_avail.h @@ -94,7 +94,7 @@ class CPDF_DataAvail final { }; CPDF_DataAvail(FileAvail* pFileAvail, - const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead, + const RetainPtr<IFX_SeekableReadStream>& pFileRead, bool bSupportHintTable); ~CPDF_DataAvail(); @@ -105,10 +105,10 @@ class CPDF_DataAvail final { DocFormStatus IsFormAvail(DownloadHints* pHints); DocLinearizationStatus IsLinearizedPDF(); bool IsLinearized(); - CFX_RetainPtr<IFX_SeekableReadStream> GetFileRead() const; + RetainPtr<IFX_SeekableReadStream> GetFileRead() const; int GetPageCount() const; CPDF_Dictionary* GetPage(int index); - CFX_RetainPtr<CPDF_ReadValidator> GetValidator() const; + RetainPtr<CPDF_ReadValidator> GetValidator() const; protected: class PageNode { @@ -178,7 +178,7 @@ class CPDF_DataAvail final { bool ValidateForm(); FileAvail* const m_pFileAvail; - CFX_RetainPtr<CPDF_ReadValidator> m_pFileRead; + RetainPtr<CPDF_ReadValidator> m_pFileRead; CPDF_Parser m_parser; CPDF_SyntaxParser m_syntaxParser; std::unique_ptr<CPDF_Object> m_pRoot; diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index f47551f82b..fef031119f 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -625,8 +625,7 @@ CPDF_Font* CPDF_Document::LoadFont(CPDF_Dictionary* pFontDict) { return m_pDocPage->GetFont(pFontDict); } -CFX_RetainPtr<CPDF_StreamAcc> CPDF_Document::LoadFontFile( - CPDF_Stream* pStream) { +RetainPtr<CPDF_StreamAcc> CPDF_Document::LoadFontFile(CPDF_Stream* pStream) { return m_pDocPage->GetFontFileStreamAcc(pStream); } @@ -641,12 +640,11 @@ CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, return m_pDocPage->GetPattern(pPatternObj, bShading, matrix); } -CFX_RetainPtr<CPDF_IccProfile> CPDF_Document::LoadIccProfile( - CPDF_Stream* pStream) { +RetainPtr<CPDF_IccProfile> CPDF_Document::LoadIccProfile(CPDF_Stream* pStream) { return m_pDocPage->GetIccProfile(pStream); } -CFX_RetainPtr<CPDF_Image> CPDF_Document::LoadImageFromPageData( +RetainPtr<CPDF_Image> CPDF_Document::LoadImageFromPageData( uint32_t dwStreamObjNum) { ASSERT(dwStreamObjNum); return m_pDocPage->GetImage(dwStreamObjNum); diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h index ff80fa85c3..1b985dd7e1 100644 --- a/core/fpdfapi/parser/cpdf_document.h +++ b/core/fpdfapi/parser/cpdf_document.h @@ -81,9 +81,9 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { bool bShading, const CFX_Matrix& matrix); - CFX_RetainPtr<CPDF_Image> LoadImageFromPageData(uint32_t dwStreamObjNum); - CFX_RetainPtr<CPDF_StreamAcc> LoadFontFile(CPDF_Stream* pStream); - CFX_RetainPtr<CPDF_IccProfile> LoadIccProfile(CPDF_Stream* pStream); + RetainPtr<CPDF_Image> LoadImageFromPageData(uint32_t dwStreamObjNum); + RetainPtr<CPDF_StreamAcc> LoadFontFile(CPDF_Stream* pStream); + RetainPtr<CPDF_IccProfile> LoadIccProfile(CPDF_Stream* pStream); void LoadDoc(); void LoadLinearizedDoc(const CPDF_LinearizedHeader* pLinearizationParams); diff --git a/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp b/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp index cb9ceac101..1a8c6d5d14 100644 --- a/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp @@ -22,7 +22,7 @@ namespace { class InvalidReader : public IFX_SeekableReadStream { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); // IFX_SeekableReadStream overrides: bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { @@ -38,7 +38,7 @@ class InvalidReader : public IFX_SeekableReadStream { class TestReadValidator : public CPDF_ReadValidator { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); void SimulateReadError() { ReadBlock(nullptr, 0, 1); } @@ -71,7 +71,7 @@ class TestHolder : public CPDF_IndirectObjectHolder { return obj_data.object.get(); } - CFX_RetainPtr<CPDF_ReadValidator> GetValidator() { return validator_; } + RetainPtr<CPDF_ReadValidator> GetValidator() { return validator_; } void AddObject(uint32_t objnum, std::unique_ptr<CPDF_Object> object, @@ -103,7 +103,7 @@ class TestHolder : public CPDF_IndirectObjectHolder { ObjectState state = ObjectState::Unavailable; }; std::map<uint32_t, ObjectData> objects_data_; - CFX_RetainPtr<TestReadValidator> validator_; + RetainPtr<TestReadValidator> validator_; }; class CPDF_ObjectAvailFailOnExclude : public CPDF_ObjectAvail { diff --git a/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp b/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp index a6454cd9fe..1e83e80d32 100644 --- a/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp @@ -23,7 +23,7 @@ namespace { class InvalidReader : public IFX_SeekableReadStream { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); // IFX_SeekableReadStream overrides: bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { @@ -39,7 +39,7 @@ class InvalidReader : public IFX_SeekableReadStream { class TestReadValidator : public CPDF_ReadValidator { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); void SimulateReadError() { ReadBlock(nullptr, 0, 1); } @@ -72,7 +72,7 @@ class TestHolder : public CPDF_IndirectObjectHolder { return obj_data.object.get(); } - CFX_RetainPtr<CPDF_ReadValidator> GetValidator() { return validator_; } + RetainPtr<CPDF_ReadValidator> GetValidator() { return validator_; } void AddObject(uint32_t objnum, std::unique_ptr<CPDF_Object> object, @@ -104,7 +104,7 @@ class TestHolder : public CPDF_IndirectObjectHolder { ObjectState state = ObjectState::Unavailable; }; std::map<uint32_t, ObjectData> objects_data_; - CFX_RetainPtr<TestReadValidator> validator_; + RetainPtr<TestReadValidator> validator_; }; } // namespace diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 9239c5f0d0..a45ac13ad5 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -43,11 +43,11 @@ uint32_t GetVarInt(const uint8_t* p, int32_t n) { return result; } -int32_t GetStreamNCount(const CFX_RetainPtr<CPDF_StreamAcc>& pObjStream) { +int32_t GetStreamNCount(const RetainPtr<CPDF_StreamAcc>& pObjStream) { return pObjStream->GetDict()->GetIntegerFor("N"); } -int32_t GetStreamFirst(const CFX_RetainPtr<CPDF_StreamAcc>& pObjStream) { +int32_t GetStreamFirst(const RetainPtr<CPDF_StreamAcc>& pObjStream) { return pObjStream->GetDict()->GetIntegerFor("First"); } @@ -164,11 +164,11 @@ void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict) { m_pEncryptDict = pDict; } -CFX_RetainPtr<CPDF_CryptoHandler> CPDF_Parser::GetCryptoHandler() const { +RetainPtr<CPDF_CryptoHandler> CPDF_Parser::GetCryptoHandler() const { return m_pSyntax->m_pCryptoHandler; } -CFX_RetainPtr<IFX_SeekableReadStream> CPDF_Parser::GetFileAccess() const { +RetainPtr<IFX_SeekableReadStream> CPDF_Parser::GetFileAccess() const { return m_pSyntax->GetFileAccess(); } @@ -189,7 +189,7 @@ void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) { } bool CPDF_Parser::InitSyntaxParser( - const CFX_RetainPtr<IFX_SeekableReadStream>& file_access) { + const RetainPtr<IFX_SeekableReadStream>& file_access) { const int32_t header_offset = GetHeaderOffset(file_access); if (header_offset == kInvalidHeaderOffset) return false; @@ -218,7 +218,7 @@ bool CPDF_Parser::ParseFileVersion() { } CPDF_Parser::Error CPDF_Parser::StartParse( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess, + const RetainPtr<IFX_SeekableReadStream>& pFileAccess, CPDF_Document* pDocument) { if (!InitSyntaxParser(pFileAccess)) return FORMAT_ERROR; @@ -1211,7 +1211,7 @@ std::unique_ptr<CPDF_Object> CPDF_Parser::ParseIndirectObject( if (GetObjectType(objnum) != ObjectType::kCompressed) return nullptr; - CFX_RetainPtr<CPDF_StreamAcc> pObjStream = + RetainPtr<CPDF_StreamAcc> pObjStream = GetObjectStream(m_ObjectInfo[objnum].pos); if (!pObjStream) return nullptr; @@ -1240,7 +1240,7 @@ std::unique_ptr<CPDF_Object> CPDF_Parser::ParseIndirectObject( return syntax.GetObject(pObjList, 0, 0, false); } -CFX_RetainPtr<CPDF_StreamAcc> CPDF_Parser::GetObjectStream(uint32_t objnum) { +RetainPtr<CPDF_StreamAcc> CPDF_Parser::GetObjectStream(uint32_t objnum) { auto it = m_ObjectStreamMap.find(objnum); if (it != m_ObjectStreamMap.end()) return it->second; @@ -1348,7 +1348,7 @@ bool CPDF_Parser::ParseLinearizedHeader() { } CPDF_Parser::Error CPDF_Parser::StartLinearizedParse( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess, + const RetainPtr<IFX_SeekableReadStream>& pFileAccess, CPDF_Document* pDocument) { ASSERT(!m_bHasParsed); m_bXRefStream = false; diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h index 5cd1301ddd..f59691fe36 100644 --- a/core/fpdfapi/parser/cpdf_parser.h +++ b/core/fpdfapi/parser/cpdf_parser.h @@ -14,10 +14,10 @@ #include <vector> #include "core/fpdfapi/parser/cpdf_syntax_parser.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" class CPDF_Array; class CPDF_CryptoHandler; @@ -57,9 +57,9 @@ class CPDF_Parser { CPDF_Parser(); ~CPDF_Parser(); - Error StartParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile, + Error StartParse(const RetainPtr<IFX_SeekableReadStream>& pFile, CPDF_Document* pDocument); - Error StartLinearizedParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile, + Error StartLinearizedParse(const RetainPtr<IFX_SeekableReadStream>& pFile, CPDF_Document* pDocument); void SetPassword(const char* password) { m_Password = password; } @@ -84,8 +84,8 @@ class CPDF_Parser { ObjectType GetObjectType(uint32_t objnum) const; uint16_t GetObjectGenNum(uint32_t objnum) const; bool IsObjectFreeOrNull(uint32_t objnum) const; - CFX_RetainPtr<CPDF_CryptoHandler> GetCryptoHandler() const; - CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const; + RetainPtr<CPDF_CryptoHandler> GetCryptoHandler() const; + RetainPtr<IFX_SeekableReadStream> GetFileAccess() const; FX_FILESIZE GetObjectOffset(uint32_t objnum) const; @@ -164,7 +164,7 @@ class CPDF_Parser { bool LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount); bool LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); Error LoadLinearizedMainXRefTable(); - CFX_RetainPtr<CPDF_StreamAcc> GetObjectStream(uint32_t number); + RetainPtr<CPDF_StreamAcc> GetObjectStream(uint32_t number); bool ParseLinearizedHeader(); void SetEncryptDictionary(CPDF_Dictionary* pDict); void ShrinkObjectMap(uint32_t size); @@ -188,8 +188,7 @@ class CPDF_Parser { CPDF_SyntaxParser::ParseType parse_type, FX_FILESIZE* pResultPos); - bool InitSyntaxParser( - const CFX_RetainPtr<IFX_SeekableReadStream>& file_access); + bool InitSyntaxParser(const RetainPtr<IFX_SeekableReadStream>& file_access); bool ParseFileVersion(); CFX_UnownedPtr<CPDF_Document> m_pDocument; @@ -205,7 +204,7 @@ class CPDF_Parser { uint32_t m_dwLinearizedFirstPageXRefStartObjNum; // A map of object numbers to indirect streams. - std::map<uint32_t, CFX_RetainPtr<CPDF_StreamAcc>> m_ObjectStreamMap; + std::map<uint32_t, RetainPtr<CPDF_StreamAcc>> m_ObjectStreamMap; // Mapping of object numbers to offsets. The offsets are relative to the first // object in the stream. @@ -213,7 +212,7 @@ class CPDF_Parser { // Mapping of streams to their object caches. This is valid as long as the // streams in |m_ObjectStreamMap| are valid. - std::map<CFX_RetainPtr<CPDF_StreamAcc>, StreamObjectCache> m_ObjCache; + std::map<RetainPtr<CPDF_StreamAcc>, StreamObjectCache> m_ObjCache; // All indirect object numbers that are being parsed. std::set<uint32_t> m_ParsingObjNums; diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp index d441b12cef..b3352975a9 100644 --- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp @@ -7,9 +7,9 @@ #include "core/fpdfapi/parser/cpdf_parser.h" #include "core/fpdfapi/parser/cpdf_syntax_parser.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_stream.h" +#include "core/fxcrt/retain_ptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/utils/path_service.h" @@ -17,7 +17,7 @@ class CFX_TestBufferRead : public IFX_SeekableReadStream { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); // IFX_SeekableReadStream: bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { @@ -46,7 +46,7 @@ class CPDF_TestParser : public CPDF_Parser { // Setup reading from a file and initial states. bool InitTestFromFile(const char* path) { - CFX_RetainPtr<IFX_SeekableReadStream> pFileAccess = + RetainPtr<IFX_SeekableReadStream> pFileAccess = IFX_SeekableReadStream::CreateFromFilename(path); if (!pFileAccess) return false; diff --git a/core/fpdfapi/parser/cpdf_read_validator.cpp b/core/fpdfapi/parser/cpdf_read_validator.cpp index d01b3c61e6..bf086008ca 100644 --- a/core/fpdfapi/parser/cpdf_read_validator.cpp +++ b/core/fpdfapi/parser/cpdf_read_validator.cpp @@ -40,7 +40,7 @@ CPDF_ReadValidator::Session::~Session() { } CPDF_ReadValidator::CPDF_ReadValidator( - const CFX_RetainPtr<IFX_SeekableReadStream>& file_read, + const RetainPtr<IFX_SeekableReadStream>& file_read, CPDF_DataAvail::FileAvail* file_avail) : file_read_(file_read), file_avail_(file_avail), diff --git a/core/fpdfapi/parser/cpdf_read_validator.h b/core/fpdfapi/parser/cpdf_read_validator.h index cc04a1f55e..812a5ccb1b 100644 --- a/core/fpdfapi/parser/cpdf_read_validator.h +++ b/core/fpdfapi/parser/cpdf_read_validator.h @@ -11,7 +11,7 @@ class CPDF_ReadValidator : public IFX_SeekableReadStream { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); class Session { public: @@ -48,14 +48,14 @@ class CPDF_ReadValidator : public IFX_SeekableReadStream { FX_FILESIZE GetSize() override; protected: - CPDF_ReadValidator(const CFX_RetainPtr<IFX_SeekableReadStream>& file_read, + CPDF_ReadValidator(const RetainPtr<IFX_SeekableReadStream>& file_read, CPDF_DataAvail::FileAvail* file_avail); ~CPDF_ReadValidator() override; private: void ScheduleDownload(FX_FILESIZE offset, size_t size); - CFX_RetainPtr<IFX_SeekableReadStream> file_read_; + RetainPtr<IFX_SeekableReadStream> file_read_; CFX_UnownedPtr<CPDF_DataAvail::FileAvail> file_avail_; CFX_UnownedPtr<CPDF_DataAvail::DownloadHints> hints_; diff --git a/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp b/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp index cb6c07ecb6..c6007a6c31 100644 --- a/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp @@ -65,7 +65,7 @@ class MockDownloadHints : public CPDF_DataAvail::DownloadHints { class InvalidReader : public IFX_SeekableReadStream { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); // IFX_SeekableReadStream overrides: bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp index c00096df8b..bf2feaed22 100644 --- a/core/fpdfapi/parser/cpdf_stream.cpp +++ b/core/fpdfapi/parser/cpdf_stream.cpp @@ -60,7 +60,7 @@ void CPDF_Stream::InitStream(const uint8_t* pData, } void CPDF_Stream::InitStreamFromFile( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFile, + const RetainPtr<IFX_SeekableReadStream>& pFile, std::unique_ptr<CPDF_Dictionary> pDict) { m_pDict = std::move(pDict); m_bMemoryBased = false; diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h index be70e05e72..f8b09af7e2 100644 --- a/core/fpdfapi/parser/cpdf_stream.h +++ b/core/fpdfapi/parser/cpdf_stream.h @@ -51,7 +51,7 @@ class CPDF_Stream : public CPDF_Object { void InitStream(const uint8_t* pData, uint32_t size, std::unique_ptr<CPDF_Dictionary> pDict); - void InitStreamFromFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile, + void InitStreamFromFile(const RetainPtr<IFX_SeekableReadStream>& pFile, std::unique_ptr<CPDF_Dictionary> pDict); bool ReadRawData(FX_FILESIZE start_pos, @@ -70,7 +70,7 @@ class CPDF_Stream : public CPDF_Object { uint32_t m_dwSize = 0; std::unique_ptr<CPDF_Dictionary> m_pDict; std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf; - CFX_RetainPtr<IFX_SeekableReadStream> m_pFile; + RetainPtr<IFX_SeekableReadStream> m_pFile; }; inline CPDF_Stream* ToStream(CPDF_Object* obj) { diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h index 2161dd1950..a6cca095a6 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.h +++ b/core/fpdfapi/parser/cpdf_stream_acc.h @@ -11,14 +11,14 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_stream.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" -class CPDF_StreamAcc : public CFX_Retainable { +class CPDF_StreamAcc : public Retainable { public: template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); CPDF_StreamAcc(const CPDF_StreamAcc&) = delete; CPDF_StreamAcc& operator=(const CPDF_StreamAcc&) = delete; diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp index 4556dc9627..7bea4c45fc 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp @@ -721,7 +721,7 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream( } void CPDF_SyntaxParser::InitParser( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess, + const RetainPtr<IFX_SeekableReadStream>& pFileAccess, uint32_t HeaderOffset) { ASSERT(pFileAccess); return InitParserWithValidator( @@ -730,7 +730,7 @@ void CPDF_SyntaxParser::InitParser( } void CPDF_SyntaxParser::InitParserWithValidator( - const CFX_RetainPtr<CPDF_ReadValidator>& validator, + const RetainPtr<CPDF_ReadValidator>& validator, uint32_t HeaderOffset) { ASSERT(validator); FX_Free(m_pFileBuf); @@ -843,10 +843,10 @@ FX_FILESIZE CPDF_SyntaxParser::FindTag(const ByteStringView& tag, } void CPDF_SyntaxParser::SetEncrypt( - const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler) { + const RetainPtr<CPDF_CryptoHandler>& pCryptoHandler) { m_pCryptoHandler = pCryptoHandler; } -CFX_RetainPtr<IFX_SeekableReadStream> CPDF_SyntaxParser::GetFileAccess() const { +RetainPtr<IFX_SeekableReadStream> CPDF_SyntaxParser::GetFileAccess() const { return m_pFileAccess; } diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h index 4e28c2fb92..78d5345001 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.h +++ b/core/fpdfapi/parser/cpdf_syntax_parser.h @@ -29,12 +29,11 @@ class CPDF_SyntaxParser { explicit CPDF_SyntaxParser(const CFX_WeakPtr<ByteStringPool>& pPool); ~CPDF_SyntaxParser(); - void InitParser(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess, + void InitParser(const RetainPtr<IFX_SeekableReadStream>& pFileAccess, uint32_t HeaderOffset); - void InitParserWithValidator( - const CFX_RetainPtr<CPDF_ReadValidator>& pValidator, - uint32_t HeaderOffset); + void InitParserWithValidator(const RetainPtr<CPDF_ReadValidator>& pValidator, + uint32_t HeaderOffset); FX_FILESIZE GetPos() const { return m_Pos; } void SetPos(FX_FILESIZE pos) { m_Pos = std::min(pos, m_FileLen); } @@ -61,15 +60,15 @@ class CPDF_SyntaxParser { void ToNextWord(); bool BackwardsSearchToWord(const ByteStringView& word, FX_FILESIZE limit); FX_FILESIZE FindTag(const ByteStringView& tag, FX_FILESIZE limit); - void SetEncrypt(const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler); + void SetEncrypt(const RetainPtr<CPDF_CryptoHandler>& pCryptoHandler); bool ReadBlock(uint8_t* pBuf, uint32_t size); bool GetCharAt(FX_FILESIZE pos, uint8_t& ch); ByteString GetNextWord(bool* bIsNumber); ByteString PeekNextWord(bool* bIsNumber); - CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const; + RetainPtr<IFX_SeekableReadStream> GetFileAccess() const; - const CFX_RetainPtr<CPDF_ReadValidator>& GetValidator() const { + const RetainPtr<CPDF_ReadValidator>& GetValidator() const { return m_pFileAccess; } @@ -113,13 +112,13 @@ class CPDF_SyntaxParser { FX_FILESIZE m_Pos; uint32_t m_MetadataObjnum; - CFX_RetainPtr<CPDF_ReadValidator> m_pFileAccess; + RetainPtr<CPDF_ReadValidator> m_pFileAccess; FX_FILESIZE m_HeaderOffset; FX_FILESIZE m_FileLen; uint8_t* m_pFileBuf; uint32_t m_BufSize; FX_FILESIZE m_BufOffset; - CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler; + RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler; uint8_t m_WordBuffer[257]; uint32_t m_WordSize; CFX_WeakPtr<ByteStringPool> m_pPool; diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp index 82804528ab..e57f834cee 100644 --- a/core/fpdfapi/parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp @@ -71,7 +71,7 @@ const char PDF_CharType[256] = { 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W'}; -int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) { +int32_t GetHeaderOffset(const RetainPtr<IFX_SeekableReadStream>& pFile) { const size_t kBufSize = 4; uint8_t buf[kBufSize]; for (int32_t offset = 0; offset <= 1024; ++offset) { diff --git a/core/fpdfapi/parser/fpdf_parser_utility.h b/core/fpdfapi/parser/fpdf_parser_utility.h index 5f85551a53..e4b922cad2 100644 --- a/core/fpdfapi/parser/fpdf_parser_utility.h +++ b/core/fpdfapi/parser/fpdf_parser_utility.h @@ -7,8 +7,8 @@ #ifndef CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_ #define CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/retain_ptr.h" class IFX_SeekableReadStream; class CPDF_Dictionary; @@ -39,7 +39,7 @@ constexpr int32_t kInvalidHeaderOffset = -1; // On success, return a positive offset value to the PDF header.. If the header // cannot be found, or if there is an error reading from |pFile|, then return // |kInvalidHeaderOffset|. -int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile); +int32_t GetHeaderOffset(const RetainPtr<IFX_SeekableReadStream>& pFile); int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key); |