Chromium Code Reviews| 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 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2165 | 2165 |
| 2166 if (key == FX_BSTRC("endobj")) { | 2166 if (key == FX_BSTRC("endobj")) { |
| 2167 m_Pos = SavedPos; | 2167 m_Pos = SavedPos; |
| 2168 break; | 2168 break; |
| 2169 } | 2169 } |
| 2170 if (key[0] != '/') | 2170 if (key[0] != '/') |
| 2171 continue; | 2171 continue; |
| 2172 | 2172 |
| 2173 ++nKeys; | 2173 ++nKeys; |
| 2174 key = PDF_NameDecode(key); | 2174 key = PDF_NameDecode(key); |
| 2175 if (key.IsEmpty()) | |
| 2176 continue; | |
| 2177 | |
| 2178 CFX_ByteStringC keyNoSlash(key.c_str() + 1, key.GetLength() - 1); | |
| 2179 if (keyNoSlash.IsEmpty()) | |
|
Lei Zhang
2015/10/24 00:43:59
It turns out CFX_CMapByteStringToPtr has a bug whe
| |
| 2180 continue; | |
| 2181 | |
| 2175 if (key == FX_BSTRC("/Contents")) | 2182 if (key == FX_BSTRC("/Contents")) |
| 2176 dwSignValuePos = m_Pos; | 2183 dwSignValuePos = m_Pos; |
| 2177 | 2184 |
| 2178 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); | 2185 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); |
| 2179 if (!pObj) | 2186 if (!pObj) |
| 2180 continue; | 2187 continue; |
| 2181 | 2188 |
| 2182 if (key.GetLength() >= 1) { | 2189 if (nKeys < 32) { |
| 2183 if (nKeys < 32) { | 2190 pDict->SetAt(keyNoSlash, pObj); |
|
Tom Sepez
2015/10/24 17:04:46
nit: One of my favorite lines of code. Because ch
Lei Zhang
2015/10/26 20:54:23
Ah, this smelled fishy. Wasn't sure exactly why.
| |
| 2184 pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), | 2191 } else { |
| 2185 pObj); | 2192 pDict->AddValue(keyNoSlash, pObj); |
| 2186 } else { | |
| 2187 pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), | |
| 2188 pObj); | |
| 2189 } | |
| 2190 } | 2193 } |
| 2191 } | 2194 } |
| 2192 | 2195 |
| 2193 if (IsSignatureDict(pDict.get())) { | 2196 if (IsSignatureDict(pDict.get())) { |
| 2194 FX_FILESIZE dwSavePos = m_Pos; | 2197 FX_FILESIZE dwSavePos = m_Pos; |
| 2195 m_Pos = dwSignValuePos; | 2198 m_Pos = dwSignValuePos; |
| 2196 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, NULL, FALSE); | 2199 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, NULL, FALSE); |
| 2197 pDict->SetAt(FX_BSTRC("Contents"), pObj); | 2200 pDict->SetAt(FX_BSTRC("Contents"), pObj); |
| 2198 m_Pos = dwSavePos; | 2201 m_Pos = dwSavePos; |
| 2199 } | 2202 } |
| (...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4608 return FALSE; | 4611 return FALSE; |
| 4609 } | 4612 } |
| 4610 CPDF_PageNode::~CPDF_PageNode() { | 4613 CPDF_PageNode::~CPDF_PageNode() { |
| 4611 int32_t iSize = m_childNode.GetSize(); | 4614 int32_t iSize = m_childNode.GetSize(); |
| 4612 for (int32_t i = 0; i < iSize; ++i) { | 4615 for (int32_t i = 0; i < iSize; ++i) { |
| 4613 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; | 4616 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; |
| 4614 delete pNode; | 4617 delete pNode; |
| 4615 } | 4618 } |
| 4616 m_childNode.RemoveAll(); | 4619 m_childNode.RemoveAll(); |
| 4617 } | 4620 } |
| OLD | NEW |