diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2017-07-28 19:05:55 +0300 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-01 23:08:16 +0000 |
commit | 33dd830890d38f9083b732cd908ef082f1d89d65 (patch) | |
tree | 7035019c33cbbc65811fad9e09652844762bb8ac /core | |
parent | 07a71da70e7d52dbc65cd184edec3c45e1e8567e (diff) | |
download | pdfium-33dd830890d38f9083b732cd908ef082f1d89d65.tar.xz |
Add public access for read stream into CPDF_SyntaxParser
Change-Id: I5deb6049db41387ac030a6ba5296ee6187120190
Reviewed-on: https://pdfium-review.googlesource.com/9470
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_syntax_parser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_syntax_parser.h | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 657d0e0865..2ca820eb98 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -126,7 +126,7 @@ CFX_RetainPtr<CPDF_CryptoHandler> CPDF_Parser::GetCryptoHandler() const { } CFX_RetainPtr<IFX_SeekableReadStream> CPDF_Parser::GetFileAccess() const { - return m_pSyntax->m_pFileAccess; + return m_pSyntax->GetFileAccess(); } void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) { @@ -615,7 +615,7 @@ bool CPDF_Parser::RebuildCrossRef() { bool bOverFlow = false; uint32_t size = std::min((uint32_t)(m_pSyntax->m_FileLen - pos), kBufferSize); - if (!m_pSyntax->m_pFileAccess->ReadBlock(buffer.data(), pos, size)) + if (!m_pSyntax->GetFileAccess()->ReadBlock(buffer.data(), pos, size)) break; for (uint32_t i = 0; i < size; i++) { @@ -1506,7 +1506,6 @@ CPDF_Parser::Error CPDF_Parser::StartLinearizedParse( return FORMAT_ERROR; if (!IsLinearizedFile(pFileAccess, offset)) { - m_pSyntax->m_pFileAccess = nullptr; return StartParse(pFileAccess, std::move(pDocument)); } m_bHasParsed = true; diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp index ce5a83579d..5fa3372d50 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp @@ -879,3 +879,7 @@ void CPDF_SyntaxParser::SetEncrypt( const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler) { m_pCryptoHandler = pCryptoHandler; } + +CFX_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 4c5e252978..d522b4ae7a 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.h +++ b/core/fpdfapi/parser/cpdf_syntax_parser.h @@ -53,6 +53,8 @@ class CPDF_SyntaxParser { bool GetCharAt(FX_FILESIZE pos, uint8_t& ch); CFX_ByteString GetNextWord(bool* bIsNumber); + CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const; + private: friend class CPDF_Parser; friend class CPDF_DataAvail; |