diff options
author | tsepez <tsepez@chromium.org> | 2016-11-07 13:49:17 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-07 13:49:17 -0800 |
commit | 5ab31ef3ed4c86211f1ebb3686abb4f5a66472ec (patch) | |
tree | 87c1fda94151528b7fcfa3a18cfda87a78cd3b4f /core/fpdfapi/parser/cpdf_syntax_parser.h | |
parent | c09625ca59701fabeb49dc59edcf33031b2c6672 (diff) | |
download | pdfium-5ab31ef3ed4c86211f1ebb3686abb4f5a66472ec.tar.xz |
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
Diffstat (limited to 'core/fpdfapi/parser/cpdf_syntax_parser.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_syntax_parser.h | 29 |
1 files changed, 14 insertions, 15 deletions
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<CPDF_Object> GetObject(CPDF_IndirectObjectHolder* pObjList, + uint32_t objnum, + uint32_t gennum, + bool bDecrypt); + std::unique_ptr<CPDF_Object> 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<CPDF_CryptoHandler> 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<CPDF_Stream> ReadStream(CPDF_Dictionary* pDict, + uint32_t objnum, + uint32_t gennum); CFX_ByteString MaybeIntern(const CFX_ByteString& str); inline bool CheckPosition(FX_FILESIZE pos) { |