| 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 <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 | 2132 |
| 2133 if (key == FX_BSTRC("endobj")) { | 2133 if (key == FX_BSTRC("endobj")) { |
| 2134 m_Pos = SavedPos; | 2134 m_Pos = SavedPos; |
| 2135 break; | 2135 break; |
| 2136 } | 2136 } |
| 2137 if (key[0] != '/') | 2137 if (key[0] != '/') |
| 2138 continue; | 2138 continue; |
| 2139 | 2139 |
| 2140 ++nKeys; | 2140 ++nKeys; |
| 2141 key = PDF_NameDecode(key); | 2141 key = PDF_NameDecode(key); |
| 2142 if (key.IsEmpty()) |
| 2143 continue; |
| 2144 |
| 2145 CFX_ByteStringC keyNoSlash(key.c_str() + 1, key.GetLength() - 1); |
| 2146 if (keyNoSlash.IsEmpty()) |
| 2147 continue; |
| 2148 |
| 2142 if (key == FX_BSTRC("/Contents")) | 2149 if (key == FX_BSTRC("/Contents")) |
| 2143 dwSignValuePos = m_Pos; | 2150 dwSignValuePos = m_Pos; |
| 2144 | 2151 |
| 2145 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); | 2152 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); |
| 2146 if (!pObj) | 2153 if (!pObj) |
| 2147 continue; | 2154 continue; |
| 2148 | 2155 |
| 2149 if (key.GetLength() >= 1) { | 2156 // TODO(thestig): Remove this conditional once CPDF_Dictionary has a |
| 2150 if (nKeys < 32) { | 2157 // better underlying map implementation. |
| 2151 pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), | 2158 if (nKeys < 32) { |
| 2152 pObj); | 2159 pDict->SetAt(keyNoSlash, pObj); |
| 2153 } else { | 2160 } else { |
| 2154 pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), | 2161 pDict->AddValue(keyNoSlash, pObj); |
| 2155 pObj); | |
| 2156 } | |
| 2157 } | 2162 } |
| 2158 } | 2163 } |
| 2159 | 2164 |
| 2160 if (IsSignatureDict(pDict.get())) { | 2165 if (IsSignatureDict(pDict.get())) { |
| 2161 FX_FILESIZE dwSavePos = m_Pos; | 2166 FX_FILESIZE dwSavePos = m_Pos; |
| 2162 m_Pos = dwSignValuePos; | 2167 m_Pos = dwSignValuePos; |
| 2163 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, NULL, FALSE); | 2168 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, NULL, FALSE); |
| 2164 pDict->SetAt(FX_BSTRC("Contents"), pObj); | 2169 pDict->SetAt(FX_BSTRC("Contents"), pObj); |
| 2165 m_Pos = dwSavePos; | 2170 m_Pos = dwSavePos; |
| 2166 } | 2171 } |
| (...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4568 return FALSE; | 4573 return FALSE; |
| 4569 } | 4574 } |
| 4570 CPDF_PageNode::~CPDF_PageNode() { | 4575 CPDF_PageNode::~CPDF_PageNode() { |
| 4571 int32_t iSize = m_childNode.GetSize(); | 4576 int32_t iSize = m_childNode.GetSize(); |
| 4572 for (int32_t i = 0; i < iSize; ++i) { | 4577 for (int32_t i = 0; i < iSize; ++i) { |
| 4573 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; | 4578 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; |
| 4574 delete pNode; | 4579 delete pNode; |
| 4575 } | 4580 } |
| 4576 m_childNode.RemoveAll(); | 4581 m_childNode.RemoveAll(); |
| 4577 } | 4582 } |
| OLD | NEW |