OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfapi/parser/cpdf_syntax_parser.h" | 7 #include "core/fpdfapi/parser/cpdf_syntax_parser.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 int numMarkers = ReadEOLMarkers(m_Pos); | 775 int numMarkers = ReadEOLMarkers(m_Pos); |
776 if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && | 776 if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && |
777 numMarkers != 0 && | 777 numMarkers != 0 && |
778 FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(), | 778 FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(), |
779 kEndObjStr.GetLength()) == 0) { | 779 kEndObjStr.GetLength()) == 0) { |
780 m_Pos = streamStartPos; | 780 m_Pos = streamStartPos; |
781 } | 781 } |
782 return pStream; | 782 return pStream; |
783 } | 783 } |
784 | 784 |
785 void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, | 785 void CPDF_SyntaxParser::InitParser(IFX_SeekableReadStream* pFileAccess, |
786 uint32_t HeaderOffset) { | 786 uint32_t HeaderOffset) { |
787 FX_Free(m_pFileBuf); | 787 FX_Free(m_pFileBuf); |
788 | 788 |
789 m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); | 789 m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); |
790 m_HeaderOffset = HeaderOffset; | 790 m_HeaderOffset = HeaderOffset; |
791 m_FileLen = pFileAccess->GetSize(); | 791 m_FileLen = pFileAccess->GetSize(); |
792 m_Pos = 0; | 792 m_Pos = 0; |
793 m_pFileAccess = pFileAccess; | 793 m_pFileAccess = pFileAccess; |
794 m_BufOffset = 0; | 794 m_BufOffset = 0; |
795 pFileAccess->ReadBlock( | 795 pFileAccess->ReadBlock( |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 } | 988 } |
989 | 989 |
990 void CPDF_SyntaxParser::SetEncrypt( | 990 void CPDF_SyntaxParser::SetEncrypt( |
991 std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) { | 991 std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) { |
992 m_pCryptoHandler = std::move(pCryptoHandler); | 992 m_pCryptoHandler = std::move(pCryptoHandler); |
993 } | 993 } |
994 | 994 |
995 CFX_ByteString CPDF_SyntaxParser::MaybeIntern(const CFX_ByteString& str) { | 995 CFX_ByteString CPDF_SyntaxParser::MaybeIntern(const CFX_ByteString& str) { |
996 return m_pPool ? m_pPool->Intern(str) : str; | 996 return m_pPool ? m_pPool->Intern(str) : str; |
997 } | 997 } |
OLD | NEW |