| 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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 return 1; | 922 return 1; |
| 923 | 923 |
| 924 CPDF_Dictionary* pDict = pObj->GetDict(); | 924 CPDF_Dictionary* pDict = pObj->GetDict(); |
| 925 if (pObj->IsStream()) { | 925 if (pObj->IsStream()) { |
| 926 if (pDict && pDict->GetStringFor("Type") == "XRef") | 926 if (pDict && pDict->GetStringFor("Type") == "XRef") |
| 927 return 0; | 927 return 0; |
| 928 return 1; | 928 return 1; |
| 929 } | 929 } |
| 930 | 930 |
| 931 if (pDict) { | 931 if (pDict) { |
| 932 if (pDict == m_pDocument->m_pRootDict || pDict == m_pEncryptDict) | 932 if (pDict == m_pDocument->GetRoot() || pDict == m_pEncryptDict) |
| 933 return 1; | 933 return 1; |
| 934 if (pDict->IsSignatureDict()) | 934 if (pDict->IsSignatureDict()) |
| 935 return 1; | 935 return 1; |
| 936 if (pDict->GetStringFor("Type") == "Page") | 936 if (pDict->GetStringFor("Type") == "Page") |
| 937 return 1; | 937 return 1; |
| 938 } | 938 } |
| 939 | 939 |
| 940 m_pXRefStream->AddObjectNumberToIndexArray(objnum); | 940 m_pXRefStream->AddObjectNumberToIndexArray(objnum); |
| 941 if (m_pXRefStream->CompressIndirectObject(objnum, pObj, this) < 0) | 941 if (m_pXRefStream->CompressIndirectObject(objnum, pObj, this) < 0) |
| 942 return -1; | 942 return -1; |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1742 FX_FILESIZE offset = 0; | 1742 FX_FILESIZE offset = 0; |
| 1743 if (PDF_CreatorAppendObject(pValue, &m_File, offset) < 0) { | 1743 if (PDF_CreatorAppendObject(pValue, &m_File, offset) < 0) { |
| 1744 return -1; | 1744 return -1; |
| 1745 } | 1745 } |
| 1746 } | 1746 } |
| 1747 } | 1747 } |
| 1748 } else { | 1748 } else { |
| 1749 if (m_File.AppendString("\r\n/Root ") < 0) { | 1749 if (m_File.AppendString("\r\n/Root ") < 0) { |
| 1750 return -1; | 1750 return -1; |
| 1751 } | 1751 } |
| 1752 if (m_File.AppendDWord(m_pDocument->m_pRootDict->GetObjNum()) < 0) { | 1752 if (m_File.AppendDWord(m_pDocument->GetRoot()->GetObjNum()) < 0) { |
| 1753 return -1; | 1753 return -1; |
| 1754 } | 1754 } |
| 1755 if (m_File.AppendString(" 0 R\r\n") < 0) { | 1755 if (m_File.AppendString(" 0 R\r\n") < 0) { |
| 1756 return -1; | 1756 return -1; |
| 1757 } | 1757 } |
| 1758 if (m_pDocument->m_pInfoDict) { | 1758 if (m_pDocument->GetInfo()) { |
| 1759 if (m_File.AppendString("/Info ") < 0) { | 1759 if (m_File.AppendString("/Info ") < 0) { |
| 1760 return -1; | 1760 return -1; |
| 1761 } | 1761 } |
| 1762 if (m_File.AppendDWord(m_pDocument->m_pInfoDict->GetObjNum()) < 0) { | 1762 if (m_File.AppendDWord(m_pDocument->GetInfo()->GetObjNum()) < 0) { |
| 1763 return -1; | 1763 return -1; |
| 1764 } | 1764 } |
| 1765 if (m_File.AppendString(" 0 R\r\n") < 0) { | 1765 if (m_File.AppendString(" 0 R\r\n") < 0) { |
| 1766 return -1; | 1766 return -1; |
| 1767 } | 1767 } |
| 1768 } | 1768 } |
| 1769 } | 1769 } |
| 1770 if (m_pEncryptDict) { | 1770 if (m_pEncryptDict) { |
| 1771 if (m_File.AppendString("/Encrypt") < 0) { | 1771 if (m_File.AppendString("/Encrypt") < 0) { |
| 1772 return -1; | 1772 return -1; |
| (...skipping 243 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 |