| 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/fpdf_edit/editint.h" | 7 #include "core/fpdfapi/fpdf_edit/editint.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 if (m_pParser->IsObjectFreeOrNull(objnum)) | 1232 if (m_pParser->IsObjectFreeOrNull(objnum)) |
| 1233 return 0; | 1233 return 0; |
| 1234 | 1234 |
| 1235 m_ObjectOffset[objnum] = m_Offset; | 1235 m_ObjectOffset[objnum] = m_Offset; |
| 1236 FX_BOOL bExistInMap = | 1236 FX_BOOL bExistInMap = |
| 1237 pdfium::ContainsKey(m_pDocument->m_IndirectObjs, objnum); | 1237 pdfium::ContainsKey(m_pDocument->m_IndirectObjs, 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->GetIndirectObject(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 } |
| 1250 if (!bExistInMap) { | 1250 if (!bExistInMap) { |
| 1251 m_pDocument->ReleaseIndirectObject(objnum); | 1251 m_pDocument->ReleaseIndirectObject(objnum); |
| 1252 } | 1252 } |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { | 1696 int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { |
| 1697 ASSERT(m_iStage >= 90); | 1697 ASSERT(m_iStage >= 90); |
| 1698 if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) { | 1698 if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) { |
| 1699 FX_BOOL bXRefStream = | 1699 FX_BOOL bXRefStream = |
| 1700 (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream(); | 1700 (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream(); |
| 1701 if (!bXRefStream) { | 1701 if (!bXRefStream) { |
| 1702 if (m_File.AppendString("trailer\r\n<<") < 0) { | 1702 if (m_File.AppendString("trailer\r\n<<") < 0) { |
| 1703 return -1; | 1703 return -1; |
| 1704 } | 1704 } |
| 1705 } else { | 1705 } else { |
| 1706 if (m_File.AppendDWord(m_pDocument->m_LastObjNum + 1) < 0) { | 1706 if (m_File.AppendDWord(m_pDocument->GetLastObjNum() + 1) < 0) { |
| 1707 return -1; | 1707 return -1; |
| 1708 } | 1708 } |
| 1709 if (m_File.AppendString(" 0 obj <<") < 0) { | 1709 if (m_File.AppendString(" 0 obj <<") < 0) { |
| 1710 return -1; | 1710 return -1; |
| 1711 } | 1711 } |
| 1712 } | 1712 } |
| 1713 if (m_pParser) { | 1713 if (m_pParser) { |
| 1714 CPDF_Dictionary* p = m_pParser->GetTrailer(); | 1714 CPDF_Dictionary* p = m_pParser->GetTrailer(); |
| 1715 for (const auto& it : *p) { | 1715 for (const auto& it : *p) { |
| 1716 const CFX_ByteString& key = it.first; | 1716 const CFX_ByteString& key = it.first; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 m_pCryptoHandler = nullptr; | 2016 m_pCryptoHandler = nullptr; |
| 2017 } | 2017 } |
| 2018 void CPDF_Creator::ResetStandardSecurity() { | 2018 void CPDF_Creator::ResetStandardSecurity() { |
| 2019 if (!m_bLocalCryptoHandler) | 2019 if (!m_bLocalCryptoHandler) |
| 2020 return; | 2020 return; |
| 2021 | 2021 |
| 2022 delete m_pCryptoHandler; | 2022 delete m_pCryptoHandler; |
| 2023 m_pCryptoHandler = nullptr; | 2023 m_pCryptoHandler = nullptr; |
| 2024 m_bLocalCryptoHandler = FALSE; | 2024 m_bLocalCryptoHandler = FALSE; |
| 2025 } | 2025 } |
| OLD | NEW |