From 5ab31ef3ed4c86211f1ebb3686abb4f5a66472ec Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 7 Nov 2016 13:49:17 -0800 Subject: Use unique_ptr return from CPDF_Parser::ParseIndirectObject() In turn, propgate to callers. This introduces a few release() calls that will go away as more code is converted. It also removes a couple of WrapUnique calls that are no longer needed as ownership of the object flows along. Review-Url: https://codereview.chromium.org/2479303002 --- core/fpdfapi/parser/cpdf_syntax_parser.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_syntax_parser.h') diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h index 6aab8db3fe..29eb3e1896 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.h +++ b/core/fpdfapi/parser/cpdf_syntax_parser.h @@ -27,30 +27,29 @@ class CPDF_SyntaxParser { ~CPDF_SyntaxParser(); void InitParser(IFX_SeekableReadStream* pFileAccess, uint32_t HeaderOffset); - FX_FILESIZE SavePos() const { return m_Pos; } void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } - CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, - uint32_t objnum, - uint32_t gennum, - bool bDecrypt); - CPDF_Object* GetObjectForStrict(CPDF_IndirectObjectHolder* pObjList, - uint32_t objnum, - uint32_t gennum); - CFX_ByteString GetKeyword(); + std::unique_ptr GetObject(CPDF_IndirectObjectHolder* pObjList, + uint32_t objnum, + uint32_t gennum, + bool bDecrypt); + std::unique_ptr GetObjectForStrict( + CPDF_IndirectObjectHolder* pObjList, + uint32_t objnum, + uint32_t gennum); + + CFX_ByteString GetKeyword(); void ToNextLine(); void ToNextWord(); - bool SearchWord(const CFX_ByteStringC& word, bool bWholeWord, bool bForward, FX_FILESIZE limit); - FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit); + FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit); void SetEncrypt(std::unique_ptr pCryptoHandler); - bool ReadBlock(uint8_t* pBuf, uint32_t size); bool GetCharAt(FX_FILESIZE pos, uint8_t& ch); CFX_ByteString GetNextWord(bool* bIsNumber); @@ -76,9 +75,9 @@ class CPDF_SyntaxParser { CFX_ByteString ReadString(); CFX_ByteString ReadHexString(); unsigned int ReadEOLMarkers(FX_FILESIZE pos); - CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, - uint32_t objnum, - uint32_t gennum); + std::unique_ptr ReadStream(CPDF_Dictionary* pDict, + uint32_t objnum, + uint32_t gennum); CFX_ByteString MaybeIntern(const CFX_ByteString& str); inline bool CheckPosition(FX_FILESIZE pos) { -- cgit v1.2.3