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 "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fpdfapi/fpdf_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
10 #include "../../../../third_party/numerics/safe_math.h" | 10 #include "../../../../third_party/numerics/safe_math.h" |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1374 FX_DWORD real_objnum = FXSYS_atoi(word); | 1374 FX_DWORD real_objnum = FXSYS_atoi(word); |
1375 if (objnum && real_objnum != objnum) { | 1375 if (objnum && real_objnum != objnum) { |
1376 m_Syntax.RestorePos(SavedPos); | 1376 m_Syntax.RestorePos(SavedPos); |
1377 return NULL; | 1377 return NULL; |
1378 } | 1378 } |
1379 word = m_Syntax.GetNextWord(bIsNumber); | 1379 word = m_Syntax.GetNextWord(bIsNumber); |
1380 if (!bIsNumber) { | 1380 if (!bIsNumber) { |
1381 m_Syntax.RestorePos(SavedPos); | 1381 m_Syntax.RestorePos(SavedPos); |
1382 return NULL; | 1382 return NULL; |
1383 } | 1383 } |
1384 FX_DWORD gennum = FXSYS_atoi(word); | 1384 FX_DWORD gennum = FXSYS_atoi(word); |
Tom Sepez
2014/08/29 17:28:01
nit: I'd call this real_gennum for parallelism wit
Bo Xu
2014/09/19 21:48:19
I feel parser_objnum is better.
| |
1385 if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) { | 1385 if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) { |
1386 m_Syntax.RestorePos(SavedPos); | 1386 m_Syntax.RestorePos(SavedPos); |
1387 return NULL; | 1387 return NULL; |
1388 } | 1388 } |
1389 CPDF_Object* pObj = m_Syntax.GetObject(pObjList, objnum, gennum, 0, pContext ); | 1389 CPDF_Object* pObj = m_Syntax.GetObject(pObjList, objnum, gennum, 0, pContext ); |
1390 FX_FILESIZE endOffset = m_Syntax.SavePos(); | 1390 FX_FILESIZE endOffset = m_Syntax.SavePos(); |
1391 CFX_ByteString bsWord = m_Syntax.GetKeyword(); | 1391 CFX_ByteString bsWord = m_Syntax.GetKeyword(); |
1392 if (bsWord == FX_BSTRC("endobj")) { | 1392 if (bsWord == FX_BSTRC("endobj")) { |
1393 endOffset = m_Syntax.SavePos(); | 1393 endOffset = m_Syntax.SavePos(); |
1394 } | 1394 } |
1395 m_Syntax.RestorePos(SavedPos); | 1395 m_Syntax.RestorePos(SavedPos); |
1396 if (pObj && !objnum) { | 1396 if(pObj) { |
Bo Xu
2014/08/29 03:09:27
Here when objnum >1, real_objnum must equal objnum
Tom Sepez
2014/08/29 17:28:01
yes, I think you want this block to read
if (pObj
Bo Xu
2014/09/19 21:48:19
Done.
| |
1397 pObj->m_ObjNum = real_objnum; | 1397 pObj->m_ObjNum = real_objnum; |
1398 pObj->m_GenNum = gennum; | 1398 pObj->m_GenNum = gennum; |
1399 } | 1399 } |
1400 return pObj; | 1400 return pObj; |
1401 } | 1401 } |
1402 CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(CPDF_IndirectObjects* pO bjList, FX_FILESIZE pos, FX_DWORD objnum, | 1402 CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(CPDF_IndirectObjects* pO bjList, FX_FILESIZE pos, FX_DWORD objnum, |
1403 struct PARSE_CONTEXT* pContext, FX_FILESIZE *pResultPos) | 1403 struct PARSE_CONTEXT* pContext, FX_FILESIZE *pResultPos) |
1404 { | 1404 { |
1405 FX_FILESIZE SavedPos = m_Syntax.SavePos(); | 1405 FX_FILESIZE SavedPos = m_Syntax.SavePos(); |
1406 m_Syntax.RestorePos(pos); | 1406 m_Syntax.RestorePos(pos); |
(...skipping 3018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4425 { | 4425 { |
4426 FX_INT32 iSize = m_childNode.GetSize(); | 4426 FX_INT32 iSize = m_childNode.GetSize(); |
4427 for (FX_INT32 i = 0; i < iSize; ++i) { | 4427 for (FX_INT32 i = 0; i < iSize; ++i) { |
4428 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4428 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4429 if (pNode) { | 4429 if (pNode) { |
4430 delete pNode; | 4430 delete pNode; |
4431 } | 4431 } |
4432 } | 4432 } |
4433 m_childNode.RemoveAll(); | 4433 m_childNode.RemoveAll(); |
4434 } | 4434 } |
OLD | NEW |