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/fpdf_parser/include/cpdf_parser.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 if (!m_pSyntax->GetCharAt(5, ch)) | 179 if (!m_pSyntax->GetCharAt(5, ch)) |
180 return FORMAT_ERROR; | 180 return FORMAT_ERROR; |
181 if (std::isdigit(ch)) | 181 if (std::isdigit(ch)) |
182 m_FileVersion = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)) * 10; | 182 m_FileVersion = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)) * 10; |
183 | 183 |
184 if (!m_pSyntax->GetCharAt(7, ch)) | 184 if (!m_pSyntax->GetCharAt(7, ch)) |
185 return FORMAT_ERROR; | 185 return FORMAT_ERROR; |
186 if (std::isdigit(ch)) | 186 if (std::isdigit(ch)) |
187 m_FileVersion += FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)); | 187 m_FileVersion += FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)); |
188 | 188 |
189 if (m_pSyntax->m_FileLen < m_pSyntax->m_HeaderOffset + 9) | 189 if (static_cast<uint32_t>(m_pSyntax->m_FileLen) < |
190 m_pSyntax->m_HeaderOffset + 9) | |
Tom Sepez
2016/03/30 23:28:28
Maybe m_HeaderOffset should be a FX_FILESIZE, too.
Wei Li
2016/03/31 01:39:09
Done.
| |
190 return FORMAT_ERROR; | 191 return FORMAT_ERROR; |
191 | 192 |
192 m_pSyntax->RestorePos(m_pSyntax->m_FileLen - m_pSyntax->m_HeaderOffset - 9); | 193 m_pSyntax->RestorePos(m_pSyntax->m_FileLen - m_pSyntax->m_HeaderOffset - 9); |
193 m_pDocument = new CPDF_Document(this); | 194 m_pDocument = new CPDF_Document(this); |
194 | 195 |
195 FX_BOOL bXRefRebuilt = FALSE; | 196 FX_BOOL bXRefRebuilt = FALSE; |
196 if (m_pSyntax->SearchWord("startxref", TRUE, FALSE, 4096)) { | 197 if (m_pSyntax->SearchWord("startxref", TRUE, FALSE, 4096)) { |
197 m_SortedOffset.insert(m_pSyntax->SavePos()); | 198 m_SortedOffset.insert(m_pSyntax->SavePos()); |
198 m_pSyntax->GetKeyword(); | 199 m_pSyntax->GetKeyword(); |
199 | 200 |
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1643 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1644 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
1644 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1645 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1645 m_LastXRefOffset = 0; | 1646 m_LastXRefOffset = 0; |
1646 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1647 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1647 return FORMAT_ERROR; | 1648 return FORMAT_ERROR; |
1648 } | 1649 } |
1649 | 1650 |
1650 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1651 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1651 return SUCCESS; | 1652 return SUCCESS; |
1652 } | 1653 } |
OLD | NEW |