| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/include/fpdfapi/fpdf_parser.h" | 7 #include "core/include/fpdfapi/fpdf_parser.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 | 1700 |
| 1701 // static | 1701 // static |
| 1702 int CPDF_SyntaxParser::s_CurrentRecursionDepth = 0; | 1702 int CPDF_SyntaxParser::s_CurrentRecursionDepth = 0; |
| 1703 | 1703 |
| 1704 CPDF_SyntaxParser::CPDF_SyntaxParser() { | 1704 CPDF_SyntaxParser::CPDF_SyntaxParser() { |
| 1705 m_pFileAccess = NULL; | 1705 m_pFileAccess = NULL; |
| 1706 m_pFileBuf = NULL; | 1706 m_pFileBuf = NULL; |
| 1707 m_BufSize = CPDF_ModuleMgr::kFileBufSize; | 1707 m_BufSize = CPDF_ModuleMgr::kFileBufSize; |
| 1708 m_pFileBuf = NULL; | 1708 m_pFileBuf = NULL; |
| 1709 m_MetadataObjnum = 0; | 1709 m_MetadataObjnum = 0; |
| 1710 m_dwWordPos = 0; | |
| 1711 m_bFileStream = FALSE; | |
| 1712 } | 1710 } |
| 1713 | 1711 |
| 1714 CPDF_SyntaxParser::~CPDF_SyntaxParser() { | 1712 CPDF_SyntaxParser::~CPDF_SyntaxParser() { |
| 1715 FX_Free(m_pFileBuf); | 1713 FX_Free(m_pFileBuf); |
| 1716 } | 1714 } |
| 1717 | 1715 |
| 1718 FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) { | 1716 FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) { |
| 1719 CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos); | 1717 CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos); |
| 1720 m_Pos = pos; | 1718 m_Pos = pos; |
| 1721 return GetNextChar(ch); | 1719 return GetNextChar(ch); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 } | 1992 } |
| 1995 } | 1993 } |
| 1996 } | 1994 } |
| 1997 void CPDF_SyntaxParser::ToNextWord() { | 1995 void CPDF_SyntaxParser::ToNextWord() { |
| 1998 uint8_t ch; | 1996 uint8_t ch; |
| 1999 if (!GetNextChar(ch)) | 1997 if (!GetNextChar(ch)) |
| 2000 return; | 1998 return; |
| 2001 | 1999 |
| 2002 while (1) { | 2000 while (1) { |
| 2003 while (PDFCharIsWhitespace(ch)) { | 2001 while (PDFCharIsWhitespace(ch)) { |
| 2004 m_dwWordPos = m_Pos; | |
| 2005 if (!GetNextChar(ch)) | 2002 if (!GetNextChar(ch)) |
| 2006 return; | 2003 return; |
| 2007 } | 2004 } |
| 2008 | 2005 |
| 2009 if (ch != '%') | 2006 if (ch != '%') |
| 2010 break; | 2007 break; |
| 2011 | 2008 |
| 2012 while (1) { | 2009 while (1) { |
| 2013 if (!GetNextChar(ch)) | 2010 if (!GetNextChar(ch)) |
| 2014 return; | 2011 return; |
| (...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4890 if (!m_pLinearizedDict) | 4887 if (!m_pLinearizedDict) |
| 4891 return -1; | 4888 return -1; |
| 4892 CPDF_Array* pRange = m_pLinearizedDict->GetArray("H"); | 4889 CPDF_Array* pRange = m_pLinearizedDict->GetArray("H"); |
| 4893 if (!pRange) | 4890 if (!pRange) |
| 4894 return -1; | 4891 return -1; |
| 4895 CPDF_Object* pStreamLen = pRange->GetElementValue(1); | 4892 CPDF_Object* pStreamLen = pRange->GetElementValue(1); |
| 4896 if (!pStreamLen) | 4893 if (!pStreamLen) |
| 4897 return -1; | 4894 return -1; |
| 4898 return pStreamLen->GetInteger(); | 4895 return pStreamLen->GetInteger(); |
| 4899 } | 4896 } |
| OLD | NEW |