From 0b95042db2e6dab5876abd12ce485fff0a8e08fe Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 21 Sep 2017 15:49:49 -0400 Subject: 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 Commit-Queue: dsinclair --- core/fpdfapi/parser/cfdf_document.cpp | 4 ++-- core/fpdfapi/parser/cfdf_document.h | 6 +++--- core/fpdfapi/parser/cpdf_crypto_handler.h | 6 +++--- core/fpdfapi/parser/cpdf_data_avail.cpp | 6 +++--- core/fpdfapi/parser/cpdf_data_avail.h | 8 ++++---- core/fpdfapi/parser/cpdf_document.cpp | 8 +++----- core/fpdfapi/parser/cpdf_document.h | 6 +++--- core/fpdfapi/parser/cpdf_object_avail_unittest.cpp | 8 ++++---- .../parser/cpdf_page_object_avail_unittest.cpp | 8 ++++---- core/fpdfapi/parser/cpdf_parser.cpp | 18 +++++++++--------- core/fpdfapi/parser/cpdf_parser.h | 19 +++++++++---------- core/fpdfapi/parser/cpdf_parser_unittest.cpp | 6 +++--- core/fpdfapi/parser/cpdf_read_validator.cpp | 2 +- core/fpdfapi/parser/cpdf_read_validator.h | 6 +++--- core/fpdfapi/parser/cpdf_read_validator_unittest.cpp | 2 +- core/fpdfapi/parser/cpdf_stream.cpp | 2 +- core/fpdfapi/parser/cpdf_stream.h | 4 ++-- core/fpdfapi/parser/cpdf_stream_acc.h | 6 +++--- core/fpdfapi/parser/cpdf_syntax_parser.cpp | 8 ++++---- core/fpdfapi/parser/cpdf_syntax_parser.h | 17 ++++++++--------- core/fpdfapi/parser/fpdf_parser_utility.cpp | 2 +- core/fpdfapi/parser/fpdf_parser_utility.h | 4 ++-- 22 files changed, 76 insertions(+), 80 deletions(-) (limited to 'core/fpdfapi/parser') 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::CreateNewDoc() { } std::unique_ptr CFDF_Document::ParseFile( - const CFX_RetainPtr& pFile) { + const RetainPtr& pFile) { if (!pFile) return nullptr; @@ -46,7 +46,7 @@ std::unique_ptr CFDF_Document::ParseMemory(uint8_t* pData, } void CFDF_Document::ParseStream( - const CFX_RetainPtr& pFile) { + const RetainPtr& 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 CreateNewDoc(); static std::unique_ptr ParseFile( - const CFX_RetainPtr& pFile); + const RetainPtr& pFile); static std::unique_ptr 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& pFile); + void ParseStream(const RetainPtr& pFile); CFX_UnownedPtr m_pRootDict; - CFX_RetainPtr m_pFile; + RetainPtr 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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& pFileRead, + const RetainPtr& pFileRead, bool bSupportHintTable) : m_pFileAvail(pFileAvail) { ASSERT(pFileRead); @@ -1422,11 +1422,11 @@ bool CPDF_DataAvail::CheckResources() { return true; } -CFX_RetainPtr CPDF_DataAvail::GetFileRead() const { +RetainPtr CPDF_DataAvail::GetFileRead() const { return m_pFileRead; } -CFX_RetainPtr CPDF_DataAvail::GetValidator() const { +RetainPtr 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& pFileRead, + const RetainPtr& pFileRead, bool bSupportHintTable); ~CPDF_DataAvail(); @@ -105,10 +105,10 @@ class CPDF_DataAvail final { DocFormStatus IsFormAvail(DownloadHints* pHints); DocLinearizationStatus IsLinearizedPDF(); bool IsLinearized(); - CFX_RetainPtr GetFileRead() const; + RetainPtr GetFileRead() const; int GetPageCount() const; CPDF_Dictionary* GetPage(int index); - CFX_RetainPtr GetValidator() const; + RetainPtr GetValidator() const; protected: class PageNode { @@ -178,7 +178,7 @@ class CPDF_DataAvail final { bool ValidateForm(); FileAvail* const m_pFileAvail; - CFX_RetainPtr m_pFileRead; + RetainPtr m_pFileRead; CPDF_Parser m_parser; CPDF_SyntaxParser m_syntaxParser; std::unique_ptr 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_Document::LoadFontFile( - CPDF_Stream* pStream) { +RetainPtr 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_Document::LoadIccProfile( - CPDF_Stream* pStream) { +RetainPtr CPDF_Document::LoadIccProfile(CPDF_Stream* pStream) { return m_pDocPage->GetIccProfile(pStream); } -CFX_RetainPtr CPDF_Document::LoadImageFromPageData( +RetainPtr 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 LoadImageFromPageData(uint32_t dwStreamObjNum); - CFX_RetainPtr LoadFontFile(CPDF_Stream* pStream); - CFX_RetainPtr LoadIccProfile(CPDF_Stream* pStream); + RetainPtr LoadImageFromPageData(uint32_t dwStreamObjNum); + RetainPtr LoadFontFile(CPDF_Stream* pStream); + RetainPtr 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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 GetValidator() { return validator_; } + RetainPtr GetValidator() { return validator_; } void AddObject(uint32_t objnum, std::unique_ptr object, @@ -103,7 +103,7 @@ class TestHolder : public CPDF_IndirectObjectHolder { ObjectState state = ObjectState::Unavailable; }; std::map objects_data_; - CFX_RetainPtr validator_; + RetainPtr 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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 GetValidator() { return validator_; } + RetainPtr GetValidator() { return validator_; } void AddObject(uint32_t objnum, std::unique_ptr object, @@ -104,7 +104,7 @@ class TestHolder : public CPDF_IndirectObjectHolder { ObjectState state = ObjectState::Unavailable; }; std::map objects_data_; - CFX_RetainPtr validator_; + RetainPtr 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& pObjStream) { +int32_t GetStreamNCount(const RetainPtr& pObjStream) { return pObjStream->GetDict()->GetIntegerFor("N"); } -int32_t GetStreamFirst(const CFX_RetainPtr& pObjStream) { +int32_t GetStreamFirst(const RetainPtr& pObjStream) { return pObjStream->GetDict()->GetIntegerFor("First"); } @@ -164,11 +164,11 @@ void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict) { m_pEncryptDict = pDict; } -CFX_RetainPtr CPDF_Parser::GetCryptoHandler() const { +RetainPtr CPDF_Parser::GetCryptoHandler() const { return m_pSyntax->m_pCryptoHandler; } -CFX_RetainPtr CPDF_Parser::GetFileAccess() const { +RetainPtr 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& file_access) { + const RetainPtr& 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& pFileAccess, + const RetainPtr& pFileAccess, CPDF_Document* pDocument) { if (!InitSyntaxParser(pFileAccess)) return FORMAT_ERROR; @@ -1211,7 +1211,7 @@ std::unique_ptr CPDF_Parser::ParseIndirectObject( if (GetObjectType(objnum) != ObjectType::kCompressed) return nullptr; - CFX_RetainPtr pObjStream = + RetainPtr pObjStream = GetObjectStream(m_ObjectInfo[objnum].pos); if (!pObjStream) return nullptr; @@ -1240,7 +1240,7 @@ std::unique_ptr CPDF_Parser::ParseIndirectObject( return syntax.GetObject(pObjList, 0, 0, false); } -CFX_RetainPtr CPDF_Parser::GetObjectStream(uint32_t objnum) { +RetainPtr 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& pFileAccess, + const RetainPtr& 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 #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& pFile, + Error StartParse(const RetainPtr& pFile, CPDF_Document* pDocument); - Error StartLinearizedParse(const CFX_RetainPtr& pFile, + Error StartLinearizedParse(const RetainPtr& 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 GetCryptoHandler() const; - CFX_RetainPtr GetFileAccess() const; + RetainPtr GetCryptoHandler() const; + RetainPtr 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 GetObjectStream(uint32_t number); + RetainPtr 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& file_access); + bool InitSyntaxParser(const RetainPtr& file_access); bool ParseFileVersion(); CFX_UnownedPtr m_pDocument; @@ -205,7 +204,7 @@ class CPDF_Parser { uint32_t m_dwLinearizedFirstPageXRefStartObjNum; // A map of object numbers to indirect streams. - std::map> m_ObjectStreamMap; + std::map> 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, StreamObjectCache> m_ObjCache; + std::map, StreamObjectCache> m_ObjCache; // All indirect object numbers that are being parsed. std::set 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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 pFileAccess = + RetainPtr 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& file_read, + const RetainPtr& 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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& file_read, + CPDF_ReadValidator(const RetainPtr& file_read, CPDF_DataAvail::FileAvail* file_avail); ~CPDF_ReadValidator() override; private: void ScheduleDownload(FX_FILESIZE offset, size_t size); - CFX_RetainPtr file_read_; + RetainPtr file_read_; CFX_UnownedPtr file_avail_; CFX_UnownedPtr 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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& pFile, + const RetainPtr& pFile, std::unique_ptr 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 pDict); - void InitStreamFromFile(const CFX_RetainPtr& pFile, + void InitStreamFromFile(const RetainPtr& pFile, std::unique_ptr 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 m_pDict; std::unique_ptr m_pDataBuf; - CFX_RetainPtr m_pFile; + RetainPtr 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 - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr 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_SyntaxParser::ReadStream( } void CPDF_SyntaxParser::InitParser( - const CFX_RetainPtr& pFileAccess, + const RetainPtr& pFileAccess, uint32_t HeaderOffset) { ASSERT(pFileAccess); return InitParserWithValidator( @@ -730,7 +730,7 @@ void CPDF_SyntaxParser::InitParser( } void CPDF_SyntaxParser::InitParserWithValidator( - const CFX_RetainPtr& validator, + const RetainPtr& 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& pCryptoHandler) { + const RetainPtr& pCryptoHandler) { m_pCryptoHandler = pCryptoHandler; } -CFX_RetainPtr CPDF_SyntaxParser::GetFileAccess() const { +RetainPtr 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& pPool); ~CPDF_SyntaxParser(); - void InitParser(const CFX_RetainPtr& pFileAccess, + void InitParser(const RetainPtr& pFileAccess, uint32_t HeaderOffset); - void InitParserWithValidator( - const CFX_RetainPtr& pValidator, - uint32_t HeaderOffset); + void InitParserWithValidator(const RetainPtr& 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& pCryptoHandler); + void SetEncrypt(const RetainPtr& 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 GetFileAccess() const; + RetainPtr GetFileAccess() const; - const CFX_RetainPtr& GetValidator() const { + const RetainPtr& GetValidator() const { return m_pFileAccess; } @@ -113,13 +112,13 @@ class CPDF_SyntaxParser { FX_FILESIZE m_Pos; uint32_t m_MetadataObjnum; - CFX_RetainPtr m_pFileAccess; + RetainPtr m_pFileAccess; FX_FILESIZE m_HeaderOffset; FX_FILESIZE m_FileLen; uint8_t* m_pFileBuf; uint32_t m_BufSize; FX_FILESIZE m_BufOffset; - CFX_RetainPtr m_pCryptoHandler; + RetainPtr m_pCryptoHandler; uint8_t m_WordBuffer[257]; uint32_t m_WordSize; CFX_WeakPtr 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& pFile) { +int32_t GetHeaderOffset(const RetainPtr& 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& pFile); +int32_t GetHeaderOffset(const RetainPtr& pFile); int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key); -- cgit v1.2.3