| 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 "core/fpdfapi/edit/editint.h" | 7 #include "core/fpdfapi/edit/editint.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 FX_BOOL bExistInMap = !!m_pDocument->GetIndirectObject(objnum); | 1237 FX_BOOL bExistInMap = !!m_pDocument->GetIndirectObject(objnum); |
| 1238 const uint8_t object_type = m_pParser->GetObjectType(objnum); | 1238 const uint8_t object_type = m_pParser->GetObjectType(objnum); |
| 1239 bool bObjStm = (object_type == 2) && m_pEncryptDict && !m_pXRefStream; | 1239 bool bObjStm = (object_type == 2) && m_pEncryptDict && !m_pXRefStream; |
| 1240 if (m_pParser->IsVersionUpdated() || m_bSecurityChanged || bExistInMap || | 1240 if (m_pParser->IsVersionUpdated() || m_bSecurityChanged || bExistInMap || |
| 1241 bObjStm) { | 1241 bObjStm) { |
| 1242 CPDF_Object* pObj = m_pDocument->GetOrParseIndirectObject(objnum); | 1242 CPDF_Object* pObj = m_pDocument->GetOrParseIndirectObject(objnum); |
| 1243 if (!pObj) { | 1243 if (!pObj) { |
| 1244 m_ObjectOffset[objnum] = 0; | 1244 m_ObjectOffset[objnum] = 0; |
| 1245 return 0; | 1245 return 0; |
| 1246 } | 1246 } |
| 1247 if (WriteIndirectObj(pObj)) { | 1247 if (WriteIndirectObj(pObj)) |
| 1248 return -1; | 1248 return -1; |
| 1249 } | 1249 if (!bExistInMap) |
| 1250 if (!bExistInMap) { | 1250 m_pDocument->DeleteIndirectObject(objnum); |
| 1251 m_pDocument->ReleaseIndirectObject(objnum); | |
| 1252 } | |
| 1253 } else { | 1251 } else { |
| 1254 uint8_t* pBuffer; | 1252 uint8_t* pBuffer; |
| 1255 uint32_t size; | 1253 uint32_t size; |
| 1256 m_pParser->GetIndirectBinary(objnum, pBuffer, size); | 1254 m_pParser->GetIndirectBinary(objnum, pBuffer, size); |
| 1257 if (!pBuffer) { | 1255 if (!pBuffer) { |
| 1258 return 0; | 1256 return 0; |
| 1259 } | 1257 } |
| 1260 if (object_type == 2) { | 1258 if (object_type == 2) { |
| 1261 if (m_pXRefStream) { | 1259 if (m_pXRefStream) { |
| 1262 if (WriteIndirectObjectToStream(objnum, pBuffer, size) < 0) { | 1260 if (WriteIndirectObjectToStream(objnum, pBuffer, size) < 0) { |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 m_pCryptoHandler = nullptr; | 2011 m_pCryptoHandler = nullptr; |
| 2014 } | 2012 } |
| 2015 void CPDF_Creator::ResetStandardSecurity() { | 2013 void CPDF_Creator::ResetStandardSecurity() { |
| 2016 if (!m_bLocalCryptoHandler) | 2014 if (!m_bLocalCryptoHandler) |
| 2017 return; | 2015 return; |
| 2018 | 2016 |
| 2019 delete m_pCryptoHandler; | 2017 delete m_pCryptoHandler; |
| 2020 m_pCryptoHandler = nullptr; | 2018 m_pCryptoHandler = nullptr; |
| 2021 m_bLocalCryptoHandler = FALSE; | 2019 m_bLocalCryptoHandler = FALSE; |
| 2022 } | 2020 } |
| OLD | NEW |