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

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

Issue 1987783002: Revert of Remove an unnecessary variable from CPDF_Creator (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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_edit/include/cpdf_creator.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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 else 874 else
875 m_IndexArray.push_back({objnum, 1}); 875 m_IndexArray.push_back({objnum, 1});
876 } 876 }
877 877
878 CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc) 878 CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
879 : m_pDocument(pDoc), 879 : m_pDocument(pDoc),
880 m_pParser(pDoc->GetParser()), 880 m_pParser(pDoc->GetParser()),
881 m_bSecurityChanged(FALSE), 881 m_bSecurityChanged(FALSE),
882 m_pEncryptDict(m_pParser ? m_pParser->GetEncryptDict() : nullptr), 882 m_pEncryptDict(m_pParser ? m_pParser->GetEncryptDict() : nullptr),
883 m_dwEncryptObjNum(0), 883 m_dwEncryptObjNum(0),
884 m_bEncryptCloned(FALSE),
885 m_pCryptoHandler(m_pParser ? m_pParser->GetCryptoHandler() : nullptr), 884 m_pCryptoHandler(m_pParser ? m_pParser->GetCryptoHandler() : nullptr),
886 m_pMetadata(nullptr), 885 m_pMetadata(nullptr),
887 m_pXRefStream(nullptr),
888 m_ObjectStreamSize(200), 886 m_ObjectStreamSize(200),
889 m_dwLastObjNum(m_pDocument->GetLastObjNum()), 887 m_dwLastObjNum(m_pDocument->GetLastObjNum()),
890 m_Offset(0), 888 m_Offset(0),
891 m_iStage(-1), 889 m_iStage(-1),
892 m_dwFlags(0), 890 m_dwFlags(0),
893 m_Pos(nullptr), 891 m_Pos(nullptr),
894 m_XrefStart(0), 892 m_XrefStart(0),
895 m_pIDArray(nullptr), 893 m_pIDArray(nullptr),
896 m_FileVersion(0) {} 894 m_FileVersion(0) {}
897 895
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 } 1952 }
1955 m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); 1953 m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone());
1956 if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { 1954 if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) {
1957 if (m_pEncryptDict->GetStringBy("Filter") == "Standard") { 1955 if (m_pEncryptDict->GetStringBy("Filter") == "Standard") {
1958 CFX_ByteString user_pass = m_pParser->GetPassword(); 1956 CFX_ByteString user_pass = m_pParser->GetPassword();
1959 uint32_t flag = PDF_ENCRYPT_CONTENT; 1957 uint32_t flag = PDF_ENCRYPT_CONTENT;
1960 1958
1961 CPDF_SecurityHandler handler; 1959 CPDF_SecurityHandler handler;
1962 handler.OnCreate(m_pEncryptDict, m_pIDArray, user_pass.raw_str(), 1960 handler.OnCreate(m_pEncryptDict, m_pIDArray, user_pass.raw_str(),
1963 user_pass.GetLength(), flag); 1961 user_pass.GetLength(), flag);
1964 delete m_pCryptoHandler; 1962 if (m_bLocalCryptoHandler)
1963 delete m_pCryptoHandler;
1965 m_pCryptoHandler = new CPDF_CryptoHandler; 1964 m_pCryptoHandler = new CPDF_CryptoHandler;
1966 m_pCryptoHandler->Init(m_pEncryptDict, &handler); 1965 m_pCryptoHandler->Init(m_pEncryptDict, &handler);
1966 m_bLocalCryptoHandler = TRUE;
1967 m_bSecurityChanged = TRUE; 1967 m_bSecurityChanged = TRUE;
1968 } 1968 }
1969 } 1969 }
1970 } 1970 }
1971 int32_t CPDF_Creator::Continue(IFX_Pause* pPause) { 1971 int32_t CPDF_Creator::Continue(IFX_Pause* pPause) {
1972 if (m_iStage < 0) { 1972 if (m_iStage < 0) {
1973 return m_iStage; 1973 return m_iStage;
1974 } 1974 }
1975 int32_t iRet = 0; 1975 int32_t iRet = 0;
1976 while (m_iStage < 100) { 1976 while (m_iStage < 100) {
(...skipping 24 matching lines...) Expand all
2001 m_FileVersion = fileVersion; 2001 m_FileVersion = fileVersion;
2002 return TRUE; 2002 return TRUE;
2003 } 2003 }
2004 void CPDF_Creator::RemoveSecurity() { 2004 void CPDF_Creator::RemoveSecurity() {
2005 ResetStandardSecurity(); 2005 ResetStandardSecurity();
2006 m_bSecurityChanged = TRUE; 2006 m_bSecurityChanged = TRUE;
2007 m_pEncryptDict = nullptr; 2007 m_pEncryptDict = nullptr;
2008 m_pCryptoHandler = nullptr; 2008 m_pCryptoHandler = nullptr;
2009 } 2009 }
2010 void CPDF_Creator::ResetStandardSecurity() { 2010 void CPDF_Creator::ResetStandardSecurity() {
2011 if (!m_bLocalCryptoHandler)
2012 return;
2013
2011 delete m_pCryptoHandler; 2014 delete m_pCryptoHandler;
2012 m_pCryptoHandler = nullptr; 2015 m_pCryptoHandler = nullptr;
2016 m_bLocalCryptoHandler = FALSE;
2013 } 2017 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_edit/include/cpdf_creator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698