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 <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 int numMarkers = ReadEOLMarkers(m_Pos); | 749 int numMarkers = ReadEOLMarkers(m_Pos); |
750 if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && | 750 if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && |
751 numMarkers != 0 && | 751 numMarkers != 0 && |
752 FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(), | 752 FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(), |
753 kEndObjStr.GetLength()) == 0) { | 753 kEndObjStr.GetLength()) == 0) { |
754 m_Pos = streamStartPos; | 754 m_Pos = streamStartPos; |
755 } | 755 } |
756 return pStream; | 756 return pStream; |
757 } | 757 } |
758 | 758 |
759 void CPDF_SyntaxParser::InitParser(IFX_SeekableReadStream* pFileAccess, | 759 void CPDF_SyntaxParser::InitParser( |
760 uint32_t HeaderOffset) { | 760 const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess, |
| 761 uint32_t HeaderOffset) { |
761 FX_Free(m_pFileBuf); | 762 FX_Free(m_pFileBuf); |
762 | 763 |
763 m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); | 764 m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); |
764 m_HeaderOffset = HeaderOffset; | 765 m_HeaderOffset = HeaderOffset; |
765 m_FileLen = pFileAccess->GetSize(); | 766 m_FileLen = pFileAccess->GetSize(); |
766 m_Pos = 0; | 767 m_Pos = 0; |
767 m_pFileAccess = pFileAccess; | 768 m_pFileAccess = pFileAccess; |
768 m_BufOffset = 0; | 769 m_BufOffset = 0; |
769 pFileAccess->ReadBlock(m_pFileBuf, 0, | 770 pFileAccess->ReadBlock(m_pFileBuf, 0, |
770 std::min(m_BufSize, static_cast<uint32_t>(m_FileLen))); | 771 std::min(m_BufSize, static_cast<uint32_t>(m_FileLen))); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 if (limit && m_Pos == limit) | 902 if (limit && m_Pos == limit) |
902 return -1; | 903 return -1; |
903 } | 904 } |
904 return -1; | 905 return -1; |
905 } | 906 } |
906 | 907 |
907 void CPDF_SyntaxParser::SetEncrypt( | 908 void CPDF_SyntaxParser::SetEncrypt( |
908 std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) { | 909 std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) { |
909 m_pCryptoHandler = std::move(pCryptoHandler); | 910 m_pCryptoHandler = std::move(pCryptoHandler); |
910 } | 911 } |
OLD | NEW |