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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1035 CPDF_Object* pStartNumObj = NULL; | 1035 CPDF_Object* pStartNumObj = NULL; |
1036 CPDF_Object* pCountObj = NULL; | 1036 CPDF_Object* pCountObj = NULL; |
1037 for (FX_DWORD i = 0; i < nPairSize; i++) { | 1037 for (FX_DWORD i = 0; i < nPairSize; i++) { |
1038 pStartNumObj = pArray->GetElement(i * 2); | 1038 pStartNumObj = pArray->GetElement(i * 2); |
1039 pCountObj = pArray->GetElement(i * 2 + 1); | 1039 pCountObj = pArray->GetElement(i * 2 + 1); |
1040 if (pStartNumObj && pStartNumObj->GetType() == PDFOBJ_NUMBER | 1040 if (pStartNumObj && pStartNumObj->GetType() == PDFOBJ_NUMBER |
1041 && pCountObj && pCountObj->GetType() == PDFOBJ_NUMBER) { | 1041 && pCountObj && pCountObj->GetType() == PDFOBJ_NUMBER) { |
1042 arrIndex.push_back(std::make_pair(pStartNumObj->GetInteger(), pC ountObj->GetInteger())); | 1042 arrIndex.push_back(std::make_pair(pStartNumObj->GetInteger(), pC ountObj->GetInteger())); |
1043 } | 1043 } |
1044 } | 1044 } |
1045 nSegs = arrIndex.size(); | 1045 } else { |
1046 if (nSegs == 0) { | 1046 arrIndex.push_back(std::make_pair(0, size)); |
1047 arrIndex.push_back(std::make_pair(0, size)); | |
1048 nSegs = 1; | |
1049 } | |
1050 } | 1047 } |
1048 nSegs = arrIndex.size(); | |
jun_fang
2014/09/18 18:00:22
arrIndex may be empty here. If it's empty, we shou
| |
1051 pArray = pStream->GetDict()->GetArray(FX_BSTRC("W")); | 1049 pArray = pStream->GetDict()->GetArray(FX_BSTRC("W")); |
1052 if (pArray == NULL) { | 1050 if (pArray == NULL) { |
1053 pStream->Release(); | 1051 pStream->Release(); |
1054 return FALSE; | 1052 return FALSE; |
1055 } | 1053 } |
1056 CFX_DWordArray WidthArray; | 1054 CFX_DWordArray WidthArray; |
1057 FX_SAFE_DWORD dwAccWidth = 0; | 1055 FX_SAFE_DWORD dwAccWidth = 0; |
1058 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { | 1056 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { |
1059 WidthArray.Add(pArray->GetInteger(i)); | 1057 WidthArray.Add(pArray->GetInteger(i)); |
1060 dwAccWidth += WidthArray[i]; | 1058 dwAccWidth += WidthArray[i]; |
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4436 { | 4434 { |
4437 FX_INT32 iSize = m_childNode.GetSize(); | 4435 FX_INT32 iSize = m_childNode.GetSize(); |
4438 for (FX_INT32 i = 0; i < iSize; ++i) { | 4436 for (FX_INT32 i = 0; i < iSize; ++i) { |
4439 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4437 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4440 if (pNode) { | 4438 if (pNode) { |
4441 delete pNode; | 4439 delete pNode; |
4442 } | 4440 } |
4443 } | 4441 } |
4444 m_childNode.RemoveAll(); | 4442 m_childNode.RemoveAll(); |
4445 } | 4443 } |
OLD | NEW |