diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2017-08-23 15:53:20 +0300 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-23 13:08:19 +0000 |
commit | 81692ab7daf5389bae1bed55c4a3a8e9e68fada4 (patch) | |
tree | 5f48454525fed11d91a748c16d66bbc8dbe3dc28 /core/fpdfapi/parser/cpdf_parser.h | |
parent | 77d8317f2e6bb9c75d96390fdf843b86694ba6d2 (diff) | |
download | pdfium-81692ab7daf5389bae1bed55c4a3a8e9e68fada4.tar.xz |
Simplify Trailers usage in CPDF_Parser.
Do not store non main trailers in memory.
Improve readability.
Change-Id: I2eab5d31a5be056871e7e5953e4b38662b91f5ae
Reviewed-on: https://pdfium-review.googlesource.com/10750
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h index f636704162..437f214db6 100644 --- a/core/fpdfapi/parser/cpdf_parser.h +++ b/core/fpdfapi/parser/cpdf_parser.h @@ -61,10 +61,7 @@ class CPDF_Parser { void SetPassword(const char* password) { m_Password = password; } CFX_ByteString GetPassword() { return m_Password; } - CPDF_Dictionary* GetTrailer() const { - return m_TrailerPos == kInvalidPos ? nullptr - : m_Trailers[m_TrailerPos].get(); - } + CPDF_Dictionary* GetTrailer() const; FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } uint32_t GetPermissions() const; @@ -128,6 +125,8 @@ class CPDF_Parser { private: friend class CPDF_DataAvail; + class TrailerData; + enum class ParserState { kDefault, kComment, @@ -176,8 +175,7 @@ class CPDF_Parser { uint32_t start_objnum, uint32_t count, std::vector<CrossRefObjData>* out_objects); - bool ParseCrossRefV4(std::vector<CrossRefObjData>* out_objects, - uint32_t* start_obj_num_at_last_block); + bool ParseCrossRefV4(std::vector<CrossRefObjData>* out_objects); void MergeCrossRefObjectsData(const std::vector<CrossRefObjData>& objects); std::unique_ptr<CPDF_Object> ParseIndirectObjectAtInternal( @@ -199,10 +197,9 @@ class CPDF_Parser { FX_FILESIZE m_LastXRefOffset; std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; CFX_ByteString m_Password; - std::vector<std::unique_ptr<CPDF_Dictionary>> m_Trailers; - size_t m_TrailerPos; + std::unique_ptr<TrailerData> m_TrailerData; std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized; - uint32_t m_dwXrefStartObjNum; + uint32_t m_linearized_first_page_cross_ref_start_obj_num; // A map of object numbers to indirect streams. std::map<uint32_t, CFX_RetainPtr<CPDF_StreamAcc>> m_ObjectStreamMap; |