Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1014)

Side by Side Diff: core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp

Issue 2349353003: CPDF_Document friend cleanup (Closed)
Patch Set: Rebase to master Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/include/cpdf_document.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/include/cpdf_document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698